Skip to content

Commit

Permalink
feat(payments-plugin): Backend admin api implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnvdbrug committed Feb 27, 2024
1 parent 5a720bb commit 5390a4c
Show file tree
Hide file tree
Showing 8 changed files with 2,986 additions and 3,245 deletions.
15 changes: 6 additions & 9 deletions packages/payments-plugin/e2e/mollie-dev-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ import { CREATE_MOLLIE_PAYMENT_INTENT, setShipping } from './payment-helpers';
* 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 +48,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 +90,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 @@ -118,7 +116,7 @@ async function runMollieDevServer(useDynamicRedirectUrl: boolean) {
// 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 All @@ -133,7 +131,7 @@ async function runMollieDevServer(useDynamicRedirectUrl: boolean) {
await new Promise(resolve => setTimeout(resolve, 10000));
const { createMolliePaymentIntent: secondIntent } = 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',
},
});
Expand All @@ -142,6 +140,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 5390a4c

Please sign in to comment.