Browse Source

fix(payments-plugin): Enable use of "klarna" payment via Mollie (#3538)

Martijn 8 months ago
parent
commit
6313d0fb87

+ 2 - 15
packages/payments-plugin/e2e/mollie-payment.e2e-spec.ts

@@ -291,21 +291,6 @@ describe('Mollie payments', () => {
             expect(result.errorCode).toBe('ORDER_PAYMENT_STATE_ERROR');
         });
 
-        it('Should fail to create payment intent with invalid Mollie method', async () => {
-            await shopClient.asUserWithCredentials(customers[0].emailAddress, 'test');
-            await setShipping(shopClient);
-            const { createMolliePaymentIntent: result } = await shopClient.query(
-                CREATE_MOLLIE_PAYMENT_INTENT,
-                {
-                    input: {
-                        paymentMethodCode: mockData.methodCode,
-                        molliePaymentMethodCode: 'invalid',
-                    },
-                },
-            );
-            expect(result.errorCode).toBe('INELIGIBLE_PAYMENT_METHOD_ERROR');
-        });
-
         it('Should fail to get payment url when items are out of stock', async () => {
             let { updateProductVariants } = await adminClient.query(UPDATE_PRODUCT_VARIANTS, {
                 input: {
@@ -316,6 +301,8 @@ describe('Mollie payments', () => {
                 },
             });
             expect(updateProductVariants[0].stockOnHand).toBe(1);
+            await shopClient.asUserWithCredentials(customers[0].emailAddress, 'test');
+            await setShipping(shopClient);
             const { createMolliePaymentIntent: result } = await shopClient.query(
                 CREATE_MOLLIE_PAYMENT_INTENT,
                 {

+ 0 - 6
packages/payments-plugin/src/mollie/mollie.service.ts

@@ -82,12 +82,6 @@ export class MollieService {
         input: MolliePaymentIntentInput,
     ): Promise<MolliePaymentIntentResult> {
         const { paymentMethodCode, molliePaymentMethodCode } = input;
-        const allowedMethods = Object.values(MollieClientMethod) as string[];
-        if (molliePaymentMethodCode && !allowedMethods.includes(molliePaymentMethodCode)) {
-            return new InvalidInputError(
-                `molliePaymentMethodCode has to be one of "${allowedMethods.join(',')}"`,
-            );
-        }
         const [order, paymentMethod] = await Promise.all([
             this.getOrder(ctx, input.orderId),
             this.getPaymentMethod(ctx, paymentMethodCode),