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

Paytrail for WooCommerce 2.0.2 - Activating the Test Mode checkmark does not redirect customers to test merchant Paytrail at checkout #150

Closed
agendad opened this issue Apr 23, 2024 · 1 comment
Labels
question Further information is requested

Comments

@agendad
Copy link

agendad commented Apr 23, 2024

Describe the bug

Paytrail for WooCommerce 2.0.2 - Activating the Test Mode checkmark does not redirect customers to test merchant Paytrail at checkout.

Steps to Reproduce

  1. Open Paytrail for WooCommerce gateway settings page in admin panel
  2. Empty the Merchant ID and Merchant Secret fields
  3. Turn on Test Mode checkmark
  4. Save settings
  5. Add product to cart
  6. Proceed to checkout
  7. Choose Paytrail as payment method
  8. Confirm Order
  9. Checkout displays error "HMAC signature is invalid." and does not proceed to Paytrail to select payment method

Expected behaviour

  1. Open Paytrail for WooCommerce gateway settings page in admin panel
  2. Empty the Merchant ID and Merchant Secret fields
  3. Turn on Test Mode checkmark
  4. Save settings
  5. Add product to cart
  6. Proceed to checkout
  7. Choose Paytrail as payment method
  8. Confirm Order
  9. Redirected to Paytrail Test Merchant payment method selection

Actual behaviour

  1. Open Paytrail for WooCommerce gateway settings page in admin panel
  2. Empty the Merchant ID and Merchant Secret fields
  3. Turn on Test Mode checkmark
  4. Save settings
  5. Add product to cart
  6. Proceed to checkout
  7. Choose Paytrail as payment method
  8. Confirm Order
  9. Checkout displays error "HMAC signature is invalid." and does not proceed to Paytrail to select payment method
2024-04-23T13:42:03+00:00 Debug Paytrail: process_payment
2024-04-23T13:42:03+00:00 Debug Paytrail: init PaymentRequest
2024-04-23T13:42:03+00:00 Debug Paytrail: process_payment, order update_meta_data
2024-04-23T13:42:03+00:00 Debug Paytrail: create_normal_payment
2024-04-23T13:42:03+00:00 Info Paytrail\SDK\Request\PaymentRequest: {"stamp":"1-209781-1713879723","reference":"209781","amount":2418,"currency":"EUR","language":"EN","items":[{"unitPrice":2418,"units":1,"vatPercentage":24,"productCode":"1001","description":"Online Course - \u00fchekordne tellimus","stamp":"269833"}],"customer":{"email":"developer@staging.shop.com","firstName":"Dasdasw","lastName":"Asd","phone":"012345679","companyName":"Test"},"invoicingAddress":{"streetAddress":"Test 123","postalCode":"0000000","city":"Tallinn","county":"","country":"ET"},"redirectUrls":{"success":"https:\/\/staging.shop.com\/et\/checkout\/order-received\/209781\/?key=wc_order_XDi1Qr5OLatUQ","cancel":"https:\/\/staging.shop.com\/et\/checkout\/order-pay\/209781\/?pay_for_order=true&key=wc_order_XDi1Qr5OLatUQ"},"callbackUrls":{"success":"https:\/\/staging.shop.com\/paytrail\/callback\/index","cancel":"https:\/\/staging.shop.com\/paytrail\/callback\/index"},"callbackDelay":3}
2024-04-23T13:42:04+00:00 Error HMAC signature is invalid.#0 /data/wordpress/htdocs/wp-content/plugins/paytrail-for-woocommerce/vendor/paytrail/paytrail-php-sdk/src/Client.php(824): Paytrail\SDK\Util\Signature::validateHmac(Array, '{"status":"erro...', '', '')
#1 /data/wordpress/htdocs/wp-content/plugins/paytrail-for-woocommerce/vendor/paytrail/paytrail-php-sdk/src/PaytrailClient.php(99): Paytrail\SDK\Client->validateHmac(Array, '{"status":"erro...', '')
#2 /data/wordpress/htdocs/wp-content/plugins/paytrail-for-woocommerce/vendor/paytrail/paytrail-php-sdk/src/Client.php(206): Paytrail\SDK\PaytrailClient->post('/payments', Object(Paytrail\SDK\Request\PaymentRequest), Object(Closure))
#3 /data/wordpress/htdocs/wp-content/plugins/paytrail-for-woocommerce/src/Gateway.php(1170): Paytrail\SDK\Client->createPayment(Object(Paytrail\SDK\Request\PaymentRequest))
#4 /data/wordpress/htdocs/wp-content/plugins/paytrail-for-woocommerce/src/Gateway.php(1128): Paytrail\WooCommercePaymentGateway\Gateway->create_normal_payment(Object(Paytrail\SDK\Request\PaymentRequest), Object(Automattic\WooCommerce\Admin\Overrides\Order), 'paytrail')
#5 /data/wordpress/htdocs/wp-content/plugins/woocommerce/includes/class-wc-checkout.php(1062): Paytrail\WooCommercePaymentGateway\Gateway->process_payment(209781)
#6 /data/wordpress/htdocs/wp-content/plugins/woocommerce/includes/class-wc-checkout.php(1291): WC_Checkout->process_order_payment(209781, 'paytrail')
#7 /data/wordpress/htdocs/wp-content/plugins/woocommerce/includes/class-wc-ajax.php(520): WC_Checkout->process_checkout()
#8 /data/wordpress/htdocs/wordpress/wp-includes/class-wp-hook.php(324): WC_AJAX::checkout('')
#9 /data/wordpress/htdocs/wordpress/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#10 /data/wordpress/htdocs/wordpress/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#11 /data/wordpress/htdocs/wp-content/plugins/woocommerce/includes/class-wc-ajax.php(96): do_action('wc_ajax_checkou...')
#12 /data/wordpress/htdocs/wordpress/wp-includes/class-wp-hook.php(324): WC_AJAX::do_wc_ajax('')
#13 /data/wordpress/htdocs/wordpress/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(false, Array)
#14 /data/wordpress/htdocs/wordpress/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#15 /data/wordpress/htdocs/wordpress/wp-includes/template-loader.php(13): do_action('template_redire...')
#16 /data/wordpress/htdocs/wordpress/wp-blog-header.php(19): require_once('/data/wordpress...')
#17 /data/wordpress/htdocs/index.php(4): require('/data/wordpress...')
#18 {main}
2024-04-23T13:42:04+00:00 Error FAILURE: Response is NULL or empty

Workaround

  1. Open Paytrail for WooCommerce gateway settings page in admin panel
  2. Set 375917 as the Merchant ID
  3. Set SAIPPUAKAUPPIAS as the Merchant Secret
  4. Make sure the Test Mode is turned off
  5. Save settings
  6. Add product to cart
  7. Proceed to checkout
  8. Choose Paytrail as payment method
  9. Confirm Order
  10. Redirected to Paytrail Test Merchant payment method selection

Additional context

WooCommerce: 8.8.2
Paytrail for WooCommerce: 2.0.2
Polylang for WooCommerce: 1.9.4

@agendad agendad added the question Further information is requested label Apr 23, 2024
@loueranta-paytrail
Copy link
Collaborator

This was fixed on 2.0.3 that was released today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants