vippsas / vipps-recurring-woocommerce

Vipps Recurring payments for WooCommerce
GNU Affero General Public License v3.0
6 stars 4 forks source link

Abort in Vipps returns incorrectly #43

Closed dinamo-morten closed 3 years ago

dinamo-morten commented 3 years ago

Hi,

We have an installation for a client using Vipps & Vipps recurring (https://kingsvenner.dev.webcore.no). If a user klicks on cancel in Vipps (https://api.vipps.no/vippsgateway?v=2&token=.....) - before entering phone-number - control is returned to "Thank you for your order" page and an order is created. In settings for vipps recurring we have set "Cancelled order redirect page" to the page responsible for handling this. (https://kingsvenner.dev.webcore.no/avlyst-vippsbetaling/).

Are we doing something obviously wrong or is this a known issue?

WP 5.7.2 Woo: 5.4.1 Woo subscriptions: 3.0.4 Vipps recurring: 1.8.0

Marcuzz commented 3 years ago

Hi Morten,

Are you able to download the latest version from GitHub (https://github.com/vippsas/vipps-recurring-woocommerce/archive/refs/heads/master.zip) and test it on that version?

It looks like we forgot to stop the rest of the code from executing after attempting to redirect to the page, and that made it not redirect to the correct page every time.

dinamo-morten commented 3 years ago

Hi,

Downloaded and installed latest version, 1.8.1. Unfortunately, user is still returned to "Thank you" page if clicking "cancel", link looks like this:

https://kingsvenner.dev.webcore.no/kassen/order-received/1317/?key=wc_order_w8c6iNg5ugeFf

This is also the link assigned to "go back" button if there is a timeout.

Solution can be tested here:

https://kingsvenner.dev.webcore.no/bli-venn/

Morten Rønseth Tech lead / senior utvikler

M (+47) 99 16 80 00

Dinamo Storgata 2 0155 Oslo

www.dinamo.nohttps://www.dinamo.no/


Fra: Marcus @.> Sendt: fredag 18. juni 2021 15:23 Til: vippsas/vipps-recurring-woocommerce @.> Kopi: Morten Rønseth @.>; Author @.> Emne: Re: [vippsas/vipps-recurring-woocommerce] Abort in Vipps returns incorrectly (#43)

Hi Morten,

Are you able to download the latest version from GitHub (https://github.com/vippsas/vipps-recurring-woocommerce/archive/refs/heads/master.ziphttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fvippsas%2Fvipps-recurring-woocommerce%2Farchive%2Frefs%2Fheads%2Fmaster.zip&data=04%7C01%7Cmorten%40dinamo.no%7C80401ff489fa42b3d9dc08d9325c3951%7Cd082a1fa3f014efc8d216a61c1670a24%7C0%7C0%7C637596195296780320%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=CSpJLepuzx5THUrt3unaaJVMXlDvnnyD8af%2FI7i6j1g%3D&reserved=0) and test it on that version?

It looks like we forgot to stop the rest of the code from executing after attempting to redirect to the page, and that made it not redirect to the correct page every time.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fvippsas%2Fvipps-recurring-woocommerce%2Fissues%2F43%23issuecomment-864036181&data=04%7C01%7Cmorten%40dinamo.no%7C80401ff489fa42b3d9dc08d9325c3951%7Cd082a1fa3f014efc8d216a61c1670a24%7C0%7C0%7C637596195296790277%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=in%2BH0mGmJG4pdmDIdTRg%2Fg0NoY0nBz72xhs0f0JhetU%3D&reserved=0, or unsubscribehttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAUQ4N76T4P5OBYRIGBV2M5DTTNCD7ANCNFSM465FAQ5A&data=04%7C01%7Cmorten%40dinamo.no%7C80401ff489fa42b3d9dc08d9325c3951%7Cd082a1fa3f014efc8d216a61c1670a24%7C0%7C0%7C637596195296790277%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=UROQuW505e64H45sk7Cy9TI7wyyi57WtgXiv2cx6pDA%3D&reserved=0.

Marcuzz commented 3 years ago

The cancel link is supposed to go to "order received" as the Recurring API does not have a dedicated cancel URL like the e-com single payments API, but you are supposed to be redirected to the "Cancelled order redirect page" set in your settings. I am not able to reproduce this behaviour locally or on any of the merchants running 1.8.1 and that's why I need to ask some additional questions:

dinamo-morten commented 3 years ago

Hei,

In vipps recurring:

Default status to give orders with a reserved charge - on hold

Default status to give pending renewal orders - on hold

Any other places to set this?

Morten Rønseth Tech lead / senior utvikler

M (+47) 99 16 80 00

Dinamo Storgata 2 0155 Oslo

www.dinamo.nohttps://www.dinamo.no/


Fra: Marcus @.> Sendt: mandag 21. juni 2021 10:33 Til: vippsas/vipps-recurring-woocommerce @.> Kopi: Morten Rønseth @.>; Author @.> Emne: Re: [vippsas/vipps-recurring-woocommerce] Abort in Vipps returns incorrectly (#43)

The cancel link is supposed to go to "order received" as the Recurring API does not have a dedicated cancel URL like the e-com single payments API, but you are supposed to be redirected to the "Cancelled order redirect page" set in your settings. I am not able to reproduce this behaviour locally or on any of the merchants running 1.8.1 and that's why I need to ask some additional questions:

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fvippsas%2Fvipps-recurring-woocommerce%2Fissues%2F43%23issuecomment-864842622&data=04%7C01%7Cmorten%40dinamo.no%7Cc68f09aa88914474517a08d9348f4c7d%7Cd082a1fa3f014efc8d216a61c1670a24%7C0%7C0%7C637598612339416291%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=s63QRDaBKWO0uB%2BZbZqfWBKhzMjTRO20uI5M8qIxugY%3D&reserved=0, or unsubscribehttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAUQ4N75LGRFUUZZ2TGPAVVTTT32OLANCNFSM465FAQ5A&data=04%7C01%7Cmorten%40dinamo.no%7Cc68f09aa88914474517a08d9348f4c7d%7Cd082a1fa3f014efc8d216a61c1670a24%7C0%7C0%7C637598612339426248%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=h3nyJFhrmc2ntF02s2hynLmfO3AQmfy5zXnJ4LRwYxo%3D&reserved=0.

Marcuzz commented 3 years ago

The only other place would be if another plugin does this.. hmm.

Can you try downloading the latest version from GitHub again? I've added a debug log message that should be able to tell us more. Make sure to enable the "Log debug messages" option in the Vipps Recurring Payments settings.

Now try checking out again and hit "Cancel". If you search for process_redirect_payment in the latest woocommerce-gateway-vipps-recurring log found in WooCommerce -> Status -> Logs. What does it say?

dinamo-morten commented 3 years ago

Hei,

Are you sure github is updated? Log-message doesn't look any different from before:

2021-06-21T09:07:03+00:00 DEBUG ==== Vipps Recurring Version: 1.8.1 ==== ==== Start Log ==== [1332] process_payment (gateway change: No) Created agreement with agreement ID: agr_2VRJvbP Debug body: {"currency":"NOK","price":15000,"interval":"MONTH","intervalCount":1,"productName":"St\u00f8tt oss fast","productDescription":"St\u00f8tt oss fast","isApp":false,"merchantAgreementUrl":"https:\/\/kingsvenner.dev.webcore.no\/min-konto\/","merchantRedirectUrl":"https:\/\/kingsvenner.dev.webcore.no\/kassen\/order-received\/1332\/?key=wc_order_9pF0i83h7OlDb","initialCharge":{"amount":15000,"currency":"NOK","description":"St\u00f8tt oss fast","transactionType":"DIRECT_CAPTURE"}} Debug response: {"vippsConfirmationUrl":"redacted","agreementResource":"https:\/\/api.vipps.no\/recurring\/v2\/agreements\/agr_2VRJvbP","agreementId":"agr_2VRJvbP","chargeId":"chr-79VzUFd"} ==== End Log ====

Could I maybe give you admin-login to wp-admin?

Morten Rønseth Tech lead / senior utvikler

M (+47) 99 16 80 00

Dinamo Storgata 2 0155 Oslo

www.dinamo.nohttps://www.dinamo.no/


Fra: Marcus @.> Sendt: mandag 21. juni 2021 10:57 Til: vippsas/vipps-recurring-woocommerce @.> Kopi: Morten Rønseth @.>; Author @.> Emne: Re: [vippsas/vipps-recurring-woocommerce] Abort in Vipps returns incorrectly (#43)

The only other place would be if another plugin does this.. hmm.

Can you try downloading the latest version from GitHub again? I've added a debug log message that should be able to tell us more. Make sure to enable the "Log debug messages" option in the Vipps Recurring Payments settings.

Now try checking out again and hit "Cancel". If you search for process_redirect_payment in the latest woocommerce-gateway-vipps-recurring log found in WooCommerce -> Status -> Logs. What does it say?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fvippsas%2Fvipps-recurring-woocommerce%2Fissues%2F43%23issuecomment-864859801&data=04%7C01%7Cmorten%40dinamo.no%7C5306269516794ff0756a08d93492a7bd%7Cd082a1fa3f014efc8d216a61c1670a24%7C0%7C0%7C637598626750608436%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=RMB%2FTc0p1gJPqnyWYvhNHykD71OeQUXV40cwjT7DJas%3D&reserved=0, or unsubscribehttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAUQ4N77O6BR7STYAA5YTAPDTT35I7ANCNFSM465FAQ5A&data=04%7C01%7Cmorten%40dinamo.no%7C5306269516794ff0756a08d93492a7bd%7Cd082a1fa3f014efc8d216a61c1670a24%7C0%7C0%7C637598626750618394%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=8RgkVQ7GlvoOkZs8EciAQcfIy555vZK29t9E8fIvcdQ%3D&reserved=0.

Marcuzz commented 3 years ago

Yeah that might be easier. My email address is marcus.dahl@everyday.no

GitHub is updated, but this could mean it's failing earlier in the chain but I could debug that with access :)

Marcuzz commented 3 years ago

Thanks! I logged in and changed the password immediately and deleted your comment from here, GitHub issues is a public area and we don't want someone else logging in 😅

dinamo-morten commented 3 years ago

😄 didn't see that comming, responding via email...

Morten Rønseth Tech lead / senior utvikler

M (+47) 99 16 80 00

Dinamo Storgata 2 0155 Oslo

www.dinamo.nohttps://www.dinamo.no/


Fra: Marcus @.> Sendt: mandag 21. juni 2021 11:16 Til: vippsas/vipps-recurring-woocommerce @.> Kopi: Morten Rønseth @.>; Author @.> Emne: Re: [vippsas/vipps-recurring-woocommerce] Abort in Vipps returns incorrectly (#43)

Thanks! I logged in and changed the password immediately and deleted your comment from here, GitHub issues is a public area and we don't want someone else logging in 😅

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fvippsas%2Fvipps-recurring-woocommerce%2Fissues%2F43%23issuecomment-864874425&data=04%7C01%7Cmorten%40dinamo.no%7C06146c07305d4f56420608d934954e3c%7Cd082a1fa3f014efc8d216a61c1670a24%7C0%7C0%7C637598638135506360%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=vLmVdDSJiYZMkwaKxx4LppJWu%2FNtI0hgF8Ko6kRA570%3D&reserved=0, or unsubscribehttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAUQ4N76WVQY7JI7ODGZV3C3TT37QFANCNFSM465FAQ5A&data=04%7C01%7Cmorten%40dinamo.no%7C06146c07305d4f56420608d934954e3c%7Cd082a1fa3f014efc8d216a61c1670a24%7C0%7C0%7C637598638135516308%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=F3ztLk%2F4JW5hnPpHGq%2F%2FXxnIaUnXUHrGAxLG7RFa5Sw%3D&reserved=0.

Marcuzz commented 3 years ago

Yeah, GitHub automatically posts the replies to the issues section :D

Anyway, is it possible to give me access to manage plugins so that I can upload new test versions of the Vipps Recurring Payments plugin?

Marcuzz commented 3 years ago

Here's a summary of what caused this issue in this specific case

The following line of code was missing in their checkout/thankyou.php template

<?php do_action( 'woocommerce_thankyou', $order->get_id() ); ?>

If anyone else comes across this issue please check that the above code is present in the template file 😃