fix(medusa-payment-stripe): Fix options typo (#1899)
**What** Fix the options usage across the plugin `this.options_` instead of `this.options` **Tests** New unit tests Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
1 parent
aa4bf795b2
commit
e51fdd3304
6 files changed
+32
-5
No files matched your search
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"medusa-payment-stripe": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix options typo in payment intent descriptions
|
||||||
@@ -51,7 +51,7 @@ describe("StripeProviderService", () => {
|
|||||||
totalsService: TotalsServiceMock,
|
totalsService: TotalsServiceMock,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
api_key: "test",
|
api_key: "test"
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -79,6 +79,28 @@ describe("StripeProviderService", () => {
|
|||||||
description: 'some description',
|
description: 'some description',
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("returns created stripe payment intent for cart with no customer and the options default description", async () => {
|
||||||
|
const localStripeProviderService = new StripeProviderService({
|
||||||
|
customerService: CustomerServiceMock,
|
||||||
|
regionService: RegionServiceMock,
|
||||||
|
totalsService: TotalsServiceMock,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
api_key: "test",
|
||||||
|
payment_description: "test options description"
|
||||||
|
})
|
||||||
|
|
||||||
|
carts.frCart.customer_id = ""
|
||||||
|
carts.frCart.context.payment_description = null
|
||||||
|
result = await localStripeProviderService.createPayment(carts.frCart)
|
||||||
|
expect(result).toEqual({
|
||||||
|
id: "pi_lebron",
|
||||||
|
customer: "cus_lebron",
|
||||||
|
amount: 100,
|
||||||
|
description: "test options description",
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("retrievePayment", () => {
|
describe("retrievePayment", () => {
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ class BancontactProviderService extends PaymentService {
|
|||||||
|
|
||||||
const intentRequest = {
|
const intentRequest = {
|
||||||
amount: Math.round(amount),
|
amount: Math.round(amount),
|
||||||
description: cart?.context?.payment_description ?? this.options?.payment_description,
|
description: cart?.context?.payment_description ?? this.options_?.payment_description,
|
||||||
currency: currency_code,
|
currency: currency_code,
|
||||||
payment_method_types: ["bancontact"],
|
payment_method_types: ["bancontact"],
|
||||||
capture_method: "automatic",
|
capture_method: "automatic",
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ class GiropayProviderService extends PaymentService {
|
|||||||
|
|
||||||
const intentRequest = {
|
const intentRequest = {
|
||||||
amount: Math.round(amount),
|
amount: Math.round(amount),
|
||||||
description: cart?.context?.payment_description ?? this.options?.payment_description,
|
description: cart?.context?.payment_description ?? this.options_?.payment_description,
|
||||||
currency: currency_code,
|
currency: currency_code,
|
||||||
payment_method_types: ["giropay"],
|
payment_method_types: ["giropay"],
|
||||||
capture_method: "automatic",
|
capture_method: "automatic",
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ class IdealProviderService extends PaymentService {
|
|||||||
|
|
||||||
const intentRequest = {
|
const intentRequest = {
|
||||||
amount: Math.round(amount),
|
amount: Math.round(amount),
|
||||||
description: cart?.context?.payment_description ?? this.options?.payment_description,
|
description: cart?.context?.payment_description ?? this.options_?.payment_description,
|
||||||
currency: currency_code,
|
currency: currency_code,
|
||||||
payment_method_types: ["ideal"],
|
payment_method_types: ["ideal"],
|
||||||
capture_method: "automatic",
|
capture_method: "automatic",
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ class StripeProviderService extends PaymentService {
|
|||||||
const amount = await this.totalsService_.getTotal(cart)
|
const amount = await this.totalsService_.getTotal(cart)
|
||||||
|
|
||||||
const intentRequest = {
|
const intentRequest = {
|
||||||
description: cart?.context?.payment_description ?? this.options?.payment_description,
|
description: cart?.context?.payment_description ?? this.options_?.payment_description,
|
||||||
amount: Math.round(amount),
|
amount: Math.round(amount),
|
||||||
currency: currency_code,
|
currency: currency_code,
|
||||||
setup_future_usage: "on_session",
|
setup_future_usage: "on_session",
|
||||||
|
|||||||
Reference in new issue
Block a user