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

[core] Add Stripe credit card payment support #279

Merged
merged 8 commits into from
Aug 28, 2022
Merged

Conversation

haVincy
Copy link
Contributor

@haVincy haVincy commented Jul 5, 2022

No description provided.

@haVincy haVincy marked this pull request as draft July 5, 2022 13:52
@haVincy
Copy link
Contributor Author

haVincy commented Jul 7, 2022

Test link - https://core-stripe-payment.d22tqykss69onq.amplifyapp.com/
Note: Need the Stripe public key to test, only available in internal team.

@haVincy haVincy force-pushed the core/stripe-payment branch 2 times, most recently from e65900f to 7f479e3 Compare July 10, 2022 10:48
@vanminh1701 vanminh1701 force-pushed the core/stripe-payment branch from ab1f107 to 7f479e3 Compare July 13, 2022 10:35
@haVincy haVincy force-pushed the core/stripe-payment branch 2 times, most recently from 65b25f9 to 642b1af Compare July 17, 2022 13:59
@haVincy haVincy force-pushed the core/stripe-payment branch 5 times, most recently from 7629b70 to b0a1585 Compare July 31, 2022 14:34
@haVincy haVincy force-pushed the core/stripe-payment branch from b4d980c to 545602c Compare August 7, 2022 07:48
haVincy and others added 7 commits August 28, 2022 14:15
[LIQ-624] Prototype credit card payment in CandyShop

Setup
- Create CandyShopPayProvider to provide payment setup for children
- Config to provide the Stripe public key for CandyShopPayProvider

Add Payment folder under src/components
- StripePayment.tsx to enable stripe.js if stripe pubkey is provided
- StripeCardDetail.tsx to use CardElement from stripe UI
- Get Order's ShopId for StripePayment
Modify the logic to avoid showing Credit Card Button while StripePubkey
is not provided.

- Add PaymentErrorName enum to differentiate payment error after catched
- Add CreditCardPayAvailability enum to determin the disabled case while
  InsufficientPurchaseBalance or BelowMinPurchasePrice error occurs
- Refactor the useCallback calls on APIs
- Only fetch the checkPaymentAvailability when haven't fetched
- Do not show the Credit Card Pay CTA on those not allowed tokens
PaymentService will not expose the stripePaymentId to client
but the entityId to let client continue calling the confirm
with that info to Server.

Fix the BuyModalState when error or failed case occurs from
processing CandyShopPay.confirmPayment.
- We should also handle other errors, not only purchase or transfer
  to abort the processing state and show the error modal.
@haVincy haVincy force-pushed the core/stripe-payment branch from affff4c to 6cc9f84 Compare August 28, 2022 06:43
@haVincy haVincy marked this pull request as ready for review August 28, 2022 06:43
@haVincy haVincy force-pushed the core/stripe-payment branch from 6cc9f84 to e3948d0 Compare August 28, 2022 06:49
@haVincy haVincy force-pushed the core/stripe-payment branch from e3948d0 to 2c3f800 Compare August 28, 2022 06:50
export interface PaymentErrorDetails {
title: string;
content: string;
moreInfo?: PaymentErrorMoreInfo;
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: can name it PaymentErrorExtra

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -12,3 +12,5 @@ export * from './public/Modal';

export { TransactionState, OrderDefaultFilter } from './model';
export { CandyContext, CandyShopDataValidator } from './public/Context/CandyShopDataValidator';
/* Don't export every usages from contexts */
Copy link
Contributor

Choose a reason for hiding this comment

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

/* Don't export every usage from context */

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The folder is named contexts under ui/src/ so I wrote contexts here.

@haVincy haVincy merged commit 09d02f5 into master Aug 28, 2022
@haVincy haVincy deleted the core/stripe-payment branch September 4, 2022 14:49
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.

4 participants