@unchainedshop/plugins
Version:
Because of a Typescript issue with upstream "postfinancecheckout", the Postfinance plugin has been disabled from transpilation, import the source ts files from src and enable node_module tsc or copy over the src/payment/postfinance-checkout to your projec
51 lines (40 loc) • 1.12 kB
text/typescript
import { DeliveryAdapter, DeliveryDirector, IDeliveryAdapter } from '@unchainedshop/core';
import { DeliveryProviderType } from '@unchainedshop/core-delivery';
const SendMessage: IDeliveryAdapter = {
...DeliveryAdapter,
key: 'shop.unchained.delivery.send-message',
label: 'Forward via Messaging',
version: '1.0.0',
initialConfiguration: [
{ key: 'from', value: '' },
{ key: 'to', value: '' },
{ key: 'cc', value: '' },
],
typeSupported: (type) => {
return type === DeliveryProviderType.SHIPPING;
},
actions: (config, context) => {
return {
...DeliveryAdapter.actions(config, context),
isActive: () => {
return true;
},
configurationError: () => {
return null;
},
send: async () => {
const { modules, order } = context;
return modules.worker.addWork({
type: 'MESSAGE',
retries: 0,
input: {
template: 'DELIVERY',
orderId: order._id,
config,
},
});
},
};
},
};
DeliveryDirector.registerAdapter(SendMessage);