From cb26f7fb5e2849eb0ee92dc4b918e417d9ac4344 Mon Sep 17 00:00:00 2001 From: Martijn Date: Tue, 10 Oct 2023 11:07:24 +0200 Subject: [PATCH 1/2] fix(payments-plugin): list available methods for orders api --- packages/payments-plugin/src/mollie/mollie.service.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/payments-plugin/src/mollie/mollie.service.ts b/packages/payments-plugin/src/mollie/mollie.service.ts index da3fbf39f7..e48b7e2051 100644 --- a/packages/payments-plugin/src/mollie/mollie.service.ts +++ b/packages/payments-plugin/src/mollie/mollie.service.ts @@ -334,7 +334,8 @@ export class MollieService { throw Error(`No apiKey configured for payment method ${paymentMethodCode}`); } const client = createMollieClient({ apiKey }); - const methods = await client.methods.list(); + // We use the orders API, so list available methods for that API usage + const methods = await client.methods.list({resource: 'orders'}); return methods.map(m => ({ ...m, code: m.id, From 0ddfbd485ad7eaa60340982eb167760c14257400 Mon Sep 17 00:00:00 2001 From: Martijn Date: Tue, 10 Oct 2023 13:40:23 +0200 Subject: [PATCH 2/2] fix(payments-plugin): mock request with resource paramter --- packages/payments-plugin/e2e/mollie-payment.e2e-spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/payments-plugin/e2e/mollie-payment.e2e-spec.ts b/packages/payments-plugin/e2e/mollie-payment.e2e-spec.ts index de7d5b07ec..0cab90543a 100644 --- a/packages/payments-plugin/e2e/mollie-payment.e2e-spec.ts +++ b/packages/payments-plugin/e2e/mollie-payment.e2e-spec.ts @@ -349,7 +349,7 @@ describe('Mollie payments (with useDynamicRedirectUrl set to true)', () => { it('Should get available paymentMethods', async () => { nock('https://api.mollie.com/') - .get('/v2/methods') + .get('/v2/methods?resource=orders') .reply(200, mockData.molliePaymentMethodsResponse); await shopClient.asUserWithCredentials(customers[0].emailAddress, 'test'); const { molliePaymentMethods } = await shopClient.query(GET_MOLLIE_PAYMENT_METHODS, {