From d2a5a14436634aa1b30f55152aff91f5f941cf9b Mon Sep 17 00:00:00 2001 From: casperiv0 <53900565+casperiv0@users.noreply.github.com> Date: Tue, 7 Nov 2023 16:51:34 +0100 Subject: [PATCH] feat(mollie-plugin): Support amount parameter --- .../src/mollie/graphql/generated-shop-types.ts | 7 +++++++ packages/payments-plugin/src/mollie/mollie-shop-schema.ts | 5 +++++ packages/payments-plugin/src/mollie/mollie.service.ts | 1 + 3 files changed, 13 insertions(+) diff --git a/packages/payments-plugin/src/mollie/graphql/generated-shop-types.ts b/packages/payments-plugin/src/mollie/graphql/generated-shop-types.ts index af02c7067a..04d72a3701 100644 --- a/packages/payments-plugin/src/mollie/graphql/generated-shop-types.ts +++ b/packages/payments-plugin/src/mollie/graphql/generated-shop-types.ts @@ -1644,6 +1644,12 @@ export type MollieAmount = { value?: Maybe; }; +export type MollieAmountInput = { + __typename?: 'MollieAmountInput'; + currency: Scalars['String']['output']; + value: Scalars['Int']['output']; +}; + export type MolliePaymentIntent = { __typename?: 'MolliePaymentIntent'; url: Scalars['String']['output']; @@ -1681,6 +1687,7 @@ export type MolliePaymentMethodImages = { }; export type MolliePaymentMethodsInput = { + amount?: InputMaybe; billingCountry?: InputMaybe; locale?: InputMaybe; paymentMethodCode: Scalars['String']['input']; diff --git a/packages/payments-plugin/src/mollie/mollie-shop-schema.ts b/packages/payments-plugin/src/mollie/mollie-shop-schema.ts index cfc32273e5..715c4ad279 100644 --- a/packages/payments-plugin/src/mollie/mollie-shop-schema.ts +++ b/packages/payments-plugin/src/mollie/mollie-shop-schema.ts @@ -31,10 +31,15 @@ export const shopSchema = gql` paymentMethodCode: String! molliePaymentMethodCode: String } + type MollieAmountInput { + value: Int! + currency: String! + } input MolliePaymentMethodsInput { paymentMethodCode: String! billingCountry: String locale: String + amount: MollieAmountInput } extend type Mutation { createMolliePaymentIntent(input: MolliePaymentIntentInput!): MolliePaymentIntentResult! diff --git a/packages/payments-plugin/src/mollie/mollie.service.ts b/packages/payments-plugin/src/mollie/mollie.service.ts index 8d822767f9..1b4f2ee140 100644 --- a/packages/payments-plugin/src/mollie/mollie.service.ts +++ b/packages/payments-plugin/src/mollie/mollie.service.ts @@ -341,6 +341,7 @@ export class MollieService { const methods = await client.methods.list({ locale: (input.locale as Locale | null) ?? undefined, billingCountry: input.billingCountry ?? undefined, + amount: input.amount ? toAmount(input.amount.value, input.amount.currency) : undefined, resource: 'orders', }); return methods.map(m => ({