feat(medusa,medusa-react): PaymentCollection support (#2659)

* chore: medusa react, order edit complete fix and single payment session
This commit is contained in:
Carlos R. L. Rodrigues authored and GitHub committed 2022-12-07 12:39:35 -03:00
1 parent 42d9c7222b
commit 15c667fbd3
54 files changed
+2001 -261

No files matched your search

@@ -181,7 +181,7 @@ class StripeProviderService extends AbstractPaymentService {
async createPaymentNew(paymentInput, intentRequestData = {}) {
const { customer, currency_code, amount, resource_id, cart } = paymentInput
const { id: customer_id, email } = customer
const { id: customer_id, email } = customer ?? {}
const intentRequest = {
description:
@@ -205,7 +205,7 @@ class StripeProviderService extends AbstractPaymentService {
intentRequest.customer = stripeCustomer.id
}
} else {
} else if (email) {
const stripeCustomer = await this.createCustomer({
email,
})
@@ -302,7 +302,7 @@ class StripeProviderService extends AbstractPaymentService {
try {
const stripeId = paymentInput.customer?.metadata?.stripe_id
if (stripeId !== paymentInput.customer_id) {
if (stripeId !== paymentSessionData.customer) {
return await this.createPaymentNew(paymentInput, intentRequestData)
} else {
if (paymentSessionData.amount === Math.round(paymentInput.amount)) {