Skip to content

Commit

Permalink
Remove adyen payment method (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
keoko authored Jan 25, 2024
1 parent fb4a68b commit e7d197f
Show file tree
Hide file tree
Showing 14 changed files with 3,250 additions and 872 deletions.
20 changes: 0 additions & 20 deletions blocks/commerce-checkout/commerce-checkout.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
/* eslint-disable import/no-unresolved */
import * as adyenApi from '@dropins/adyen-checkout-extension/api.js';
import AdyenExtension from '@dropins/adyen-checkout-extension/containers/AdyenPaymentMethod.js';
import { render as adyenRenderer } from '@dropins/adyen-checkout-extension/render.js';
import { events } from '@dropins/elsie/event-bus.js';
import { setEndpoint } from '@dropins/elsie/fetch-graphql.js';
import { initializers } from '@dropins/elsie/initializer.js';
Expand All @@ -16,32 +13,16 @@ import { store } from '../../scripts/minicart/api.js';
*/
export default async function decorate(block) {
const commerceEndpoint = await getConfigValue('commerce-core-endpoint');
const adyenClientKey = await getConfigValue('adyen-client-key');

setEndpoint(commerceEndpoint);

initializers.register(checkoutApi.initialize, {
cartId: store.getCartId(),
});

initializers.register(adyenApi.initialize, {
clientKey: adyenClientKey,
locale: 'en-US',
environment: 'test',
});

checkoutRenderer.render(Checkout, {
slots: {
PaymentMethods: async (context) => {
context.addPaymentMethodHandler('adyen_cc', {
render: (ctx, element) => {
if (element) {
// clear the element first
element.innerHTML = '';
adyenRenderer.render(AdyenExtension, ctx)(element);
}
},
});
context.addPaymentMethodHandler('checkmo', {
render: (ctx, element) => {
if (element) {
Expand Down Expand Up @@ -71,7 +52,6 @@ export default async function decorate(block) {
// events.emit('locale', 'en_US')
//--------------------
events.on('checkout/order', (data) => {
console.log('order placed successfully');
// redirect to order confirmation page
window.location.replace(`/order-confirmation?orderRef=${data.masked_order_id}`);
});
Expand Down
1 change: 0 additions & 1 deletion head.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"imports": {
"@dropins/elsie/": "/scripts/dropins/elsie/",
"@dropins/storefront-checkout/": "/scripts/dropins/storefront-checkout/",
"@dropins/adyen-checkout-extension/": "/scripts/dropins/adyen-checkout-extension/",
"@dropins/storefront-pdp/": "/scripts/dropins/storefront-pdp/",
"@dropins/storefront-order-confirmation/": "/scripts/dropins/storefront-order-confirmation/"
}
Expand Down
Loading

0 comments on commit e7d197f

Please sign in to comment.