Skip to content

Commit

Permalink
Merge branch 'fork/feat/mollie-admin-payment' into minor
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Mar 13, 2024
2 parents 8725ba6 + d3470a8 commit 926895d
Show file tree
Hide file tree
Showing 12 changed files with 2,727 additions and 2,749 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -388,3 +388,4 @@ Icon
Network Trash Folder
Temporary Items
.apdisk
__admin-ui/
81 changes: 65 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 9 additions & 12 deletions packages/payments-plugin/e2e/mollie-dev-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,19 @@ import {
ChannelService,
DefaultLogger,
DefaultSearchPlugin,
Logger,
LogLevel,
mergeConfig,
OrderService,
PaymentService,
RequestContext,
} from '@vendure/core';
import { createTestEnvironment, registerInitializer, SqljsInitializer, testConfig } from '@vendure/testing';
import { compileUiExtensions } from '@vendure/ui-devkit/compiler';
import gql from 'graphql-tag';
import localtunnel from 'localtunnel';
import path from 'path';

import { initialData } from '../../../e2e-common/e2e-initial-data';
import { MolliePlugin } from '../package/mollie';
import { molliePaymentHandler } from '../package/mollie/mollie.handler';
import { MolliePlugin } from '../src/mollie';

import { CREATE_PAYMENT_METHOD } from './graphql/admin-queries';
import {
Expand All @@ -32,11 +30,10 @@ import { CREATE_MOLLIE_PAYMENT_INTENT, setShipping } from './payment-helpers';
/**
* This should only be used to locally test the Mollie payment plugin
* Make sure you have `MOLLIE_APIKEY=test_xxxx` in your .env file
* Make sure you have `MOLLIE_APIKEY=test_xxxx` in your .env file
*/
/* eslint-disable @typescript-eslint/no-floating-promises */
async function runMollieDevServer(useDynamicRedirectUrl: boolean) {
// eslint-disable-next-line no-console
console.log('Starting Mollie dev server with dynamic redirectUrl: ', useDynamicRedirectUrl);
async function runMollieDevServer() {
// eslint-disable-next-line @typescript-eslint/no-var-requires
require('dotenv').config();

Expand All @@ -50,7 +47,7 @@ async function runMollieDevServer(useDynamicRedirectUrl: boolean) {
route: 'admin',
port: 5001,
}),
MolliePlugin.init({ vendureHost: tunnel.url, useDynamicRedirectUrl }),
MolliePlugin.init({ vendureHost: tunnel.url }),
],
logger: new DefaultLogger({ level: LogLevel.Debug }),
apiOptions: {
Expand Down Expand Up @@ -92,7 +89,7 @@ async function runMollieDevServer(useDynamicRedirectUrl: boolean) {
arguments: [
{
name: 'redirectUrl',
value: `${tunnel.url}/admin/orders?filter=open&page=1&dynamicRedirectUrl=false`,
value: `${tunnel.url}/admin/orders?filter=open&page=1`,
},
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
{ name: 'apiKey', value: process.env.MOLLIE_APIKEY! },
Expand All @@ -115,9 +112,10 @@ async function runMollieDevServer(useDynamicRedirectUrl: boolean) {
});
await setShipping(shopClient);
// Create payment intent
// Create payment intent
const { createMolliePaymentIntent } = await shopClient.query(CREATE_MOLLIE_PAYMENT_INTENT, {
input: {
redirectUrl: `${tunnel.url}/admin/orders?filter=open&page=1&dynamicRedirectUrl=true`,
redirectUrl: `${tunnel.url}/admin/orders?filter=open&page=1`,
paymentMethodCode: 'mollie',
// molliePaymentMethodCode: 'klarnapaylater'
},
Expand Down Expand Up @@ -148,6 +146,5 @@ async function runMollieDevServer(useDynamicRedirectUrl: boolean) {
}

(async () => {
// Change the value of the parameter to true to test with the dynamic redirectUrl functionality
await runMollieDevServer(false);
await runMollieDevServer();
})();
Loading

0 comments on commit 926895d

Please sign in to comment.