Updates method to reflect correct payment provider API
This commit is contained in:
@@ -120,14 +120,10 @@ describe("StripeProviderService", () => {
|
||||
|
||||
result = await stripeProviderService.updatePayment(
|
||||
{
|
||||
payment_method: {
|
||||
data: {
|
||||
id: "pi_lebron",
|
||||
},
|
||||
},
|
||||
id: "pi_lebron",
|
||||
},
|
||||
{
|
||||
amount: 1000,
|
||||
total: 1000,
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
@@ -122,14 +122,17 @@ class StripeProviderService extends PaymentService {
|
||||
|
||||
/**
|
||||
* Updates Stripe PaymentIntent.
|
||||
* @param {string} cart - the cart to update payment intent for
|
||||
* @param {Object} data - the update object for the payment intent
|
||||
* @param {object} data - The payment session data.
|
||||
* @param {Object} cart - the current cart value
|
||||
* @returns {Object} Stripe PaymentIntent
|
||||
*/
|
||||
async updatePayment(cart, update) {
|
||||
async updatePayment(data, cart) {
|
||||
try {
|
||||
const { data } = cart.payment_method
|
||||
return this.stripe_.paymentIntents.update(data.id, update)
|
||||
const { id } = data
|
||||
const amount = this.totalsService_.getTotal(cart)
|
||||
return this.stripe_.paymentIntents.update(id, {
|
||||
amount
|
||||
})
|
||||
} catch (error) {
|
||||
throw error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user