Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for callback url #37

Merged
merged 9 commits into from
Jun 6, 2017
Merged

Conversation

mayankamencherla
Copy link
Contributor

Added support for callback url.

Copy link
Contributor

@captn3m0 captn3m0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in the magento callback_url PR, the failure modes need to be handled in the callback URL, otherwise this breaks.

@captn3m0 captn3m0 added this to the Jun-S1 milestone Jun 2, 2017
@captn3m0
Copy link
Contributor

captn3m0 commented Jun 5, 2017

Pushed a fix for a variable assignment issue (callbackUrl), but there are still a few errors.

Notice:  Undefined variable: callbackUrl in razorpay-woocommerce/razorpay-payments.php on line 262
Stack trace:
  1. {main}() index.php:0
  2. require() index.php:17
  3. require_once() wp-blog-header.php:19
  4. include() wp-includes/template-loader.php:74
  5. get_template_part() wp-content/themes/twentyfifteen/page.php:24
  6. locate_template() wp-includes/general-template.php:167
  7. load_template() wp-includes/template.php:643
  8. require() wp-includes/template.php:686
  9. the_content() wp-content/themes/twentyfifteen/content-page.php:22
 10. apply_filters() wp-includes/post-template.php:240
 11. WP_Hook->apply_filters() wp-includes/plugin.php:203
 12. do_shortcode() wp-includes/class-wp-hook.php:298
 13. preg_replace_callback() wp-includes/shortcodes.php:223
 14. do_shortcode_tag() wp-includes/shortcodes.php:223
 15. WC_Shortcodes::checkout() wp-includes/shortcodes.php:345
 16. WC_Shortcodes::shortcode_wrapper() wp-content/plugins/woocommerce/includes/class-wc-shortcodes.php:145
 17. WC_Shortcode_Checkout::output() wp-content/plugins/woocommerce/includes/class-wc-shortcodes.php:71
 18. WC_Shortcode_Checkout::order_pay() wp-content/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-checkout.php:57
 19. do_action() wp-content/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-checkout.php:157
 20. WP_Hook->do_action() wp-includes/plugin.php:453
 21. WP_Hook->apply_filters() wp-includes/class-wp-hook.php:323
 22. WC_Razorpay->receipt_page() wp-includes/class-wp-hook.php:298
 23. WC_Razorpay->generate_razorpay_form() razorpay-woocommerce/razorpay-payments.php:147
 24. WC_Razorpay->getCheckoutArguments() razorpay-woocommerce/razorpay-payments.php:228
Notice:  Undefined variable: order_id in razorpay-woocommerce/razorpay-payments.php on line 626
Stack trace:
  1. {main}() index.php:0
  2. require() index.php:17
  3. wp() wp-blog-header.php:16
  4. WP->main() wp-includes/functions.php:955
  5. WP->parse_request() wp-includes/class-wp.php:733
  6. do_action_ref_array() wp-includes/class-wp.php:386
  7. WP_Hook->do_action() wp-includes/plugin.php:515
  8. WP_Hook->apply_filters() wp-includes/class-wp-hook.php:323
  9. WC_API->handle_api_requests() wp-includes/class-wp-hook.php:298
 10. do_action() wp-content/plugins/woocommerce/includes/class-wc-api.php:96
 11. WP_Hook->do_action() wp-includes/plugin.php:453
 12. WP_Hook->apply_filters() wp-includes/class-wp-hook.php:323
 13. WC_Razorpay->check_razorpay_response() wp-includes/class-wp-hook.php:298
 14. WC_Razorpay->handlePaymentStatus() razorpay-woocommerce/razorpay-payments.php:556
Notice:  Undefined variable: razorpay_payment_id in razorpay-woocommerce/razorpay-payments.php on line 629
Stack trace:
  1. {main}() index.php:0
  2. require() index.php:17
  3. wp() wp-blog-header.php:16
  4. WP->main() wp-includes/functions.php:955
  5. WP->parse_request() wp-includes/class-wp.php:733
  6. do_action_ref_array() wp-includes/class-wp.php:386
  7. WP_Hook->do_action() wp-includes/plugin.php:515
  8. WP_Hook->apply_filters() wp-includes/class-wp-hook.php:323
  9. WC_API->handle_api_requests() wp-includes/class-wp-hook.php:298
 10. do_action() wp-content/plugins/woocommerce/includes/class-wc-api.php:96
 11. WP_Hook->do_action() wp-includes/plugin.php:453
 12. WP_Hook->apply_filters() wp-includes/class-wp-hook.php:323
 13. WC_Razorpay->check_razorpay_response() wp-includes/class-wp-hook.php:298
 14. WC_Razorpay->handlePaymentStatus() razorpay-woocommerce/razorpay-payments.php:556

Please ensure that you have wordpress error display enabled. This is how my wp-config.php looks:

<?php
define( 'WP_DEBUG', true );

// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );

// Disable display of errors and warnings 
define( 'WP_DEBUG_DISPLAY', true );
@ini_set( 'display_errors', 0 );

// Use dev versions of core JS and CSS files (only needed if you are modifying these core files)
define( 'SCRIPT_DEBUG', true );

mayankamencherla and others added 2 commits June 6, 2017 02:03
}
}

protected function handleErrorCase($order_id, & $order)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

take only order here as well, use the getOrderId() I just committed

$order->add_order_note("Payment Failed. Please check Razorpay Dashboard. <br/> Razorpay Id: " . $attributes[self::RAZORPAY_PAYMENT_ID]);
$order->update_status('failed');
}
$this->updateOrder($order, $success, $razorpayPaymentId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updateOrder should also be called with success=false for the error case?

Copy link
Contributor

@captn3m0 captn3m0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do a squash merge post testing.

@mayankamencherla mayankamencherla merged commit 4cf4b6d into master Jun 6, 2017
@captn3m0 captn3m0 deleted the callback_url_support branch June 6, 2017 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants