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

Quickpay fixes #13

Merged
merged 9 commits into from
Jun 4, 2024
Merged

Quickpay fixes #13

merged 9 commits into from
Jun 4, 2024

Conversation

StanislavSmetaninSSM
Copy link
Contributor

@StanislavSmetaninSSM StanislavSmetaninSSM commented May 23, 2024

Originally these changes are related with these bugs:
DW10: QuickPay - error exception on ordering - https://dev.azure.com/dynamicwebsoftware/Dynamicweb/_workitems/edit/19122
DW10: QuickPay - post template not rendered - https://dev.azure.com/dynamicwebsoftware/Dynamicweb/_workitems/edit/19123
DW10: Capture amount not shown in order overview-capture operations widget -
https://dev.azure.com/dynamicwebsoftware/Dynamicweb/_workitems/edit/19660

1). DW10: QuickPay - error exception on ordering.

We have a method CheckData, where we check the quickpay response for a needed data. For payment operation, we check that order_id field is present in response, since this field is mandatory for payment command.
image
See: https://learn.quickpay.net/tech-talk/api/services/#POST-payments---format-

But we also can save card and then pay by saved card. And for card related operations, we don't have the field order_id.
See: https://learn.quickpay.net/tech-talk/api/services/#POST-cards--id-authorize---format-
And since we always checked the order_id field, the provider threw an exception, while QuickPay marked
operation successful. To fix this, order_id has been removed from the required checks.

2). DW10: QuickPay - post template not rendered.
This part is more tricky.
The bug said that that Post template is not rendered. I can guess, that original provider was tested on sites, where we don't use "Save new card" functionality, or where this functionality is not mandatory. In Swift we always save card (if user is logged in). There is no way to reject this unless the user logs out (anonymous user can't save card).
In the old QuickPay provider code there is next part:
image

For usual payment operation, we have a Quickpay Form. See: https://learn.quickpay.net/tech-talk/payments/form/
And for usual payment operation, we use template to set form settings and then redirect user to QuickPay site. The form like this:
image
See: https://learn.quickpay.net/tech-talk/payments/form/

For saving card case, we have one recommended way to do this: create a card link, and then redirect user to this link to authorize the card. See: https://learn.quickpay.net/tech-talk/guides/cards/
So there is no some predefined way to use template, like for the Quickpay Form case. It looks like the reason why we just skip the templates and always do auto post to Quickpay instead.

But this is not good idea. We have to show some template, because we have this setting in the provider. There is no restrictions to do that. We just need implement our own template with Ajax interactions, so user could set needed settings, and then we create a card, return the link to authorize card and redirect user there. The same things like we already do, but with template.

This is what I did in that part of PR. I created a new template, Card.cshtml.
It looks like this:
image
So here we can set Branding, Language, payment methods - all things that we do to adjust Quickpay Form, like for usual payment operation template. And it works! After the button "Start payment" is clicked, user is redirected to Quickpay site with the selected QuickPay parameters.
Of course we need some guy to make this template more beautiful.

3). DW10: Capture amount not shown in order overview-capture operations widget.
Added captured amount to logs for "final capture result". We have this information for split capture, for final capture we also need it to make information more understandable.

4). Common changes:

  • Errors output. We have used here a strange behavior: wrote all information to logs and show on the screen: "Some error is occured. Please see logs". After new changes, we should see errors on the screen instead of "see logs pls".
  • Moved HttpClient interactions to separate class QuickPayRequest. Also documented all used Quickpay commands to make them more readable.
  • Added templates to Update folder: Card.cshtml, Post.cshtml, and update provider to copy them to needed folders.

@dw-sha dw-sha merged commit e0fe450 into main Jun 4, 2024
5 checks passed
@dw-sha dw-sha deleted the ssm/19122-quick_pay_fixes branch June 4, 2024 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants