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

Payment Processor Migration #20

Merged
merged 16 commits into from
Aug 18, 2023
Merged

Payment Processor Migration #20

merged 16 commits into from
Aug 18, 2023

Conversation

a11rew
Copy link
Owner

@a11rew a11rew commented Aug 6, 2023

Overview

Payment Providers are considered deprecated in Medusa. This PR updates this plugin to support new Payment Processor API.

This will be a minor version bump.

Changes

  • Update to use Payment Processor API
    The plugin exports a service which is an instance of an AbstractPaymentProcessor. The internal class methods have changed but no user facing functionality is changed.
  • Taking this opportunity to rewrite the plugin in Typescript, long overdue.
    The plugin now exports a PluginOptions interface for type annotations when configuring the plugin.
    Replaced previous Babel build process with TSC. Jest tests also rewritten in Typescript.
  • Removed amount verification logic in authorizePayment.
    We previously tried to ensure the amount paid on Paystack matched the cart total before marking an order as paid. This was problematic because for a number of reasons: handling currencies is a lot more complex than just rounding up and asserting equality - currencies need to be considered, floating point arithmetic pitfalls handled and amounts evaluated without rounding up.
    I consider getting that part right out of the scope of this project, users are responsible for ensuring the txRef they get from the plugin is sent to Paystack on the frontend along with the right amount.
  • Updated cuid dependency

Removes prior clunky gitignore workarounds for top level publishing. Files are output to dist folder
- Updates to Typescript
- Updates to use new Payment Processor API
@a11rew a11rew mentioned this pull request Aug 6, 2023
@a11rew a11rew marked this pull request as ready for review August 17, 2023 02:30
@a11rew a11rew requested a review from femakin August 17, 2023 02:37
@femakin
Copy link
Collaborator

femakin commented Aug 17, 2023

I'm going to check it out and update soon but a quick one @a11rew did you test it locally ?

@a11rew
Copy link
Owner Author

a11rew commented Aug 17, 2023

Yes @femakin. On v1.13 as well as v1.8.

@a11rew a11rew linked an issue Aug 18, 2023 that may be closed by this pull request
Copy link
Collaborator

@femakin femakin left a comment

Choose a reason for hiding this comment

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

Everything looks good to me. I will integrate and test locally as well

@femakin femakin merged commit 1430481 into main Aug 18, 2023
2 checks passed
@a11rew a11rew deleted the ag/typescript-migration branch October 21, 2023 17:13
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.

Medusa >=v1.8 support RFC
2 participants