@vendure/payments-plugin 1.3.1 → 1.4.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package/braintree/braintree-common.d.ts +2 -2
- package/package/braintree/braintree-common.js +2 -2
- package/package/braintree/braintree-common.js.map +1 -1
- package/package/braintree/braintree.handler.d.ts +28 -0
- package/package/braintree/{braintree-payment-method.js → braintree.handler.js} +11 -7
- package/package/braintree/braintree.handler.js.map +1 -0
- package/package/braintree/braintree.plugin.d.ts +176 -0
- package/package/braintree/braintree.plugin.js +218 -0
- package/package/braintree/braintree.plugin.js.map +1 -0
- package/package/braintree/braintree.resolver.d.ts +4 -2
- package/package/braintree/braintree.resolver.js +12 -9
- package/package/braintree/braintree.resolver.js.map +1 -1
- package/package/braintree/constants.d.ts +1 -0
- package/package/braintree/constants.js +2 -1
- package/package/braintree/constants.js.map +1 -1
- package/package/braintree/index.d.ts +3 -2
- package/package/braintree/index.js +3 -2
- package/package/braintree/index.js.map +1 -1
- package/package/braintree/types.d.ts +16 -1
- package/package/index.d.ts +1 -1
- package/package/index.js +1 -1
- package/package/mollie/constants.d.ts +2 -0
- package/package/mollie/constants.js +6 -0
- package/package/mollie/constants.js.map +1 -0
- package/package/mollie/index.d.ts +2 -0
- package/package/mollie/index.js +15 -0
- package/package/mollie/index.js.map +1 -0
- package/package/mollie/mollie.controller.d.ts +10 -0
- package/package/mollie/mollie.controller.js +101 -0
- package/package/mollie/mollie.controller.js.map +1 -0
- package/package/mollie/mollie.handler.d.ts +18 -0
- package/package/mollie/mollie.handler.js +127 -0
- package/package/mollie/mollie.handler.js.map +1 -0
- package/package/mollie/mollie.plugin.d.ts +101 -0
- package/package/mollie/mollie.plugin.js +116 -0
- package/package/mollie/mollie.plugin.js.map +1 -0
- package/package.json +37 -29
- package/package/braintree/braintree-payment-method.d.ts +0 -15
- package/package/braintree/braintree-payment-method.js.map +0 -1
- package/package/braintree/braintree-plugin.d.ts +0 -5
- package/package/braintree/braintree-plugin.js +0 -38
- package/package/braintree/braintree-plugin.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BraintreeGateway, Transaction } from 'braintree';
|
|
2
|
-
import { PaymentMethodArgsHash } from './types';
|
|
3
|
-
export declare function getGateway(args: PaymentMethodArgsHash): BraintreeGateway;
|
|
2
|
+
import { BraintreePluginOptions, PaymentMethodArgsHash } from './types';
|
|
3
|
+
export declare function getGateway(args: PaymentMethodArgsHash, options: BraintreePluginOptions): BraintreeGateway;
|
|
4
4
|
/**
|
|
5
5
|
* Returns a subset of the Transaction object of interest to the Administrator.
|
|
6
6
|
*/
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.extractMetadataFromTransaction = exports.getGateway = void 0;
|
|
4
4
|
const braintree_1 = require("braintree");
|
|
5
|
-
function getGateway(args) {
|
|
5
|
+
function getGateway(args, options) {
|
|
6
6
|
return new braintree_1.BraintreeGateway({
|
|
7
|
-
environment: braintree_1.Environment.Sandbox,
|
|
7
|
+
environment: options.environment || braintree_1.Environment.Sandbox,
|
|
8
8
|
merchantId: args.merchantId,
|
|
9
9
|
privateKey: args.privateKey,
|
|
10
10
|
publicKey: args.publicKey,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"braintree-common.js","sourceRoot":"","sources":["../../src/braintree/braintree-common.ts"],"names":[],"mappings":";;;AAAA,yCAAuE;AAIvE,SAAgB,UAAU,CAAC,IAA2B;
|
|
1
|
+
{"version":3,"file":"braintree-common.js","sourceRoot":"","sources":["../../src/braintree/braintree-common.ts"],"names":[],"mappings":";;;AAAA,yCAAuE;AAIvE,SAAgB,UAAU,CAAC,IAA2B,EAAE,OAA+B;IACnF,OAAO,IAAI,4BAAgB,CAAC;QACxB,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,uBAAW,CAAC,OAAO;QACvD,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,SAAS,EAAE,IAAI,CAAC,SAAS;KAC5B,CAAC,CAAC;AACP,CAAC;AAPD,gCAOC;AAED;;GAEG;AACH,SAAgB,8BAA8B,CAAC,WAAwB;IACnE,MAAM,QAAQ,GAA2B;QACrC,MAAM,EAAE,WAAW,CAAC,MAAM;QAC1B,eAAe,EAAE,WAAW,CAAC,eAAe;QAC5C,iBAAiB,EAAE,WAAW,CAAC,iBAAiB;QAChD,QAAQ,EAAE,aAAa,CAAC,WAAW,CAAC,eAAe,CAAC;QACpD,gBAAgB,EAAE,aAAa,CAAC,WAAW,CAAC,yBAAyB,CAAC;QACtE,qBAAqB,EAAE,aAAa,CAAC,WAAW,CAAC,4BAA4B,CAAC;QAC9E,0BAA0B,EAAE,WAAW,CAAC,0BAA0B;QAClE,qBAAqB,EAAE,WAAW,CAAC,qBAAqB;QACxD,aAAa,EAAE,WAAW,CAAC,qBAAqB;KACnD,CAAC;IACF,IAAI,WAAW,CAAC,UAAU,IAAI,WAAW,CAAC,UAAU,CAAC,QAAQ,EAAE;QAC3D,QAAQ,CAAC,QAAQ,GAAG;YAChB,QAAQ,EAAE,WAAW,CAAC,UAAU,CAAC,QAAQ;YACzC,KAAK,EAAE,WAAW,CAAC,UAAU,CAAC,KAAK;YACnC,cAAc,EAAE,WAAW,CAAC,UAAU,CAAC,cAAc;SACxD,CAAC;KACL;IACD,IAAI,WAAW,CAAC,aAAa,IAAI,WAAW,CAAC,aAAa,CAAC,eAAe,EAAE;QACxE,QAAQ,CAAC,UAAU,GAAG;YAClB,UAAU,EAAE,WAAW,CAAC,aAAa,CAAC,UAAU;YAChD,SAAS,EAAE,WAAW,CAAC,aAAa,CAAC,SAAS;YAC9C,eAAe,EAAE,WAAW,CAAC,aAAa,CAAC,eAAe;YAC1D,WAAW,EAAE,WAAW,CAAC,aAAa,CAAC,WAAW;YAClD,sBAAsB,EAAE,WAAW,CAAC,aAAa,CAAC,sBAAsB;YACxE,oBAAoB,EAAE,WAAW,CAAC,aAAa,CAAC,oBAAoB;SACvE,CAAC;KACL;IACD,OAAO,QAAQ,CAAC;AACpB,CAAC;AA9BD,wEA8BC;AAED,SAAS,aAAa,CAAC,IAAY;IAC/B,QAAQ,IAAI,EAAE;QACV,KAAK,GAAG;YACJ,OAAO,cAAc,CAAC;QAC1B,KAAK,GAAG;YACJ,OAAO,SAAS,CAAC;QACrB,KAAK,GAAG;YACJ,OAAO,aAAa,CAAC;QACzB,KAAK,GAAG;YACJ,OAAO,cAAc,CAAC;QAC1B,KAAK,GAAG;YACJ,OAAO,eAAe,CAAC;QAC3B,KAAK,GAAG;YACJ,OAAO,kBAAkB,CAAC;QAC9B,KAAK,GAAG;YACJ,OAAO,gBAAgB,CAAC;QAC5B,KAAK,GAAG;YACJ,OAAO,SAAS,CAAC;QACrB;YACI,OAAO,SAAS,CAAC;KACxB;AACL,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { LanguageCode } from '@vendure/common/lib/generated-types';
|
|
2
|
+
import { PaymentMethodHandler } from '@vendure/core';
|
|
3
|
+
/**
|
|
4
|
+
* The handler for Braintree payments.
|
|
5
|
+
*/
|
|
6
|
+
export declare const braintreePaymentMethodHandler: PaymentMethodHandler<{
|
|
7
|
+
merchantId: {
|
|
8
|
+
type: "string";
|
|
9
|
+
label: {
|
|
10
|
+
languageCode: LanguageCode.en;
|
|
11
|
+
value: string;
|
|
12
|
+
}[];
|
|
13
|
+
};
|
|
14
|
+
publicKey: {
|
|
15
|
+
type: "string";
|
|
16
|
+
label: {
|
|
17
|
+
languageCode: LanguageCode.en;
|
|
18
|
+
value: string;
|
|
19
|
+
}[];
|
|
20
|
+
};
|
|
21
|
+
privateKey: {
|
|
22
|
+
type: "string";
|
|
23
|
+
label: {
|
|
24
|
+
languageCode: LanguageCode.en;
|
|
25
|
+
value: string;
|
|
26
|
+
}[];
|
|
27
|
+
};
|
|
28
|
+
}>;
|
|
@@ -5,19 +5,23 @@ const generated_types_1 = require("@vendure/common/lib/generated-types");
|
|
|
5
5
|
const core_1 = require("@vendure/core");
|
|
6
6
|
const braintree_common_1 = require("./braintree-common");
|
|
7
7
|
const constants_1 = require("./constants");
|
|
8
|
+
let options;
|
|
8
9
|
/**
|
|
9
10
|
* The handler for Braintree payments.
|
|
10
11
|
*/
|
|
11
12
|
exports.braintreePaymentMethodHandler = new core_1.PaymentMethodHandler({
|
|
12
13
|
code: 'braintree',
|
|
13
|
-
description: [{ languageCode: generated_types_1.LanguageCode.en, value: 'Braintree' }],
|
|
14
|
+
description: [{ languageCode: generated_types_1.LanguageCode.en, value: 'Braintree payments' }],
|
|
14
15
|
args: {
|
|
15
|
-
merchantId: { type: 'string' },
|
|
16
|
-
publicKey: { type: 'string' },
|
|
17
|
-
privateKey: { type: 'string' },
|
|
16
|
+
merchantId: { type: 'string', label: [{ languageCode: generated_types_1.LanguageCode.en, value: 'Merchant ID' }] },
|
|
17
|
+
publicKey: { type: 'string', label: [{ languageCode: generated_types_1.LanguageCode.en, value: 'Public Key' }] },
|
|
18
|
+
privateKey: { type: 'string', label: [{ languageCode: generated_types_1.LanguageCode.en, value: 'Private Key' }] },
|
|
19
|
+
},
|
|
20
|
+
init(injector) {
|
|
21
|
+
options = injector.get(constants_1.BRAINTREE_PLUGIN_OPTIONS);
|
|
18
22
|
},
|
|
19
23
|
async createPayment(ctx, order, amount, args, metadata) {
|
|
20
|
-
const gateway = braintree_common_1.getGateway(args);
|
|
24
|
+
const gateway = braintree_common_1.getGateway(args, options);
|
|
21
25
|
try {
|
|
22
26
|
const response = await gateway.transaction.sale({
|
|
23
27
|
amount: (amount / 100).toString(10),
|
|
@@ -60,7 +64,7 @@ exports.braintreePaymentMethodHandler = new core_1.PaymentMethodHandler({
|
|
|
60
64
|
};
|
|
61
65
|
},
|
|
62
66
|
async createRefund(ctx, input, total, order, payment, args) {
|
|
63
|
-
const gateway = braintree_common_1.getGateway(args);
|
|
67
|
+
const gateway = braintree_common_1.getGateway(args, options);
|
|
64
68
|
const response = await gateway.transaction.refund(payment.transactionId, (total / 100).toString(10));
|
|
65
69
|
if (!response.success) {
|
|
66
70
|
return {
|
|
@@ -76,4 +80,4 @@ exports.braintreePaymentMethodHandler = new core_1.PaymentMethodHandler({
|
|
|
76
80
|
};
|
|
77
81
|
},
|
|
78
82
|
});
|
|
79
|
-
//# sourceMappingURL=braintree
|
|
83
|
+
//# sourceMappingURL=braintree.handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"braintree.handler.js","sourceRoot":"","sources":["../../src/braintree/braintree.handler.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { BraintreePluginOptions } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* @description
|
|
4
|
+
* This plugin enables payments to be processed by [Braintree](https://www.braintreepayments.com/), a popular payment provider.
|
|
5
|
+
*
|
|
6
|
+
* ## Requirements
|
|
7
|
+
*
|
|
8
|
+
* 1. You will need to create a Braintree sandbox account as outlined in https://developers.braintreepayments.com/start/overview.
|
|
9
|
+
* 2. Then install `braintree` and `@types/braintree` from npm. This plugin was written with `v3.x` of the Braintree lib.
|
|
10
|
+
* ```shell
|
|
11
|
+
* yarn add \@vendure/payments-plugin braintree
|
|
12
|
+
* yarn add -D \@types/braintree
|
|
13
|
+
* ```
|
|
14
|
+
* or
|
|
15
|
+
* ```shell
|
|
16
|
+
* npm install \@vendure/payments-plugin braintree
|
|
17
|
+
* npm install -D \@types/braintree
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* ## Setup
|
|
21
|
+
*
|
|
22
|
+
* 1. Add the plugin to your VendureConfig `plugins` array:
|
|
23
|
+
* ```TypeScript
|
|
24
|
+
* import { BraintreePlugin } from '\@vendure/payments-plugin/package/braintree';
|
|
25
|
+
* import { Environment } from 'braintree';
|
|
26
|
+
*
|
|
27
|
+
* // ...
|
|
28
|
+
*
|
|
29
|
+
* plugins: [
|
|
30
|
+
* BraintreePlugin.init({ environment: Environment.Sandbox }),
|
|
31
|
+
* ]
|
|
32
|
+
* ```
|
|
33
|
+
* 2. Create a new PaymentMethod in the Admin UI, and select "Braintree payments" as the handler.
|
|
34
|
+
* 2. Fill in the `Merchant ID`, `Public Key` & `Private Key` from your Braintree sandbox account.
|
|
35
|
+
*
|
|
36
|
+
* ## Storefront usage
|
|
37
|
+
*
|
|
38
|
+
* The plugin is designed to work with the [Braintree drop-in UI](https://developers.braintreepayments.com/guides/drop-in/overview/javascript/v3).
|
|
39
|
+
* This is a library provided by Braintree which will handle the payment UI for you. You can install it in your storefront project
|
|
40
|
+
* with:
|
|
41
|
+
*
|
|
42
|
+
* ```shell
|
|
43
|
+
* yarn add braintree-web-drop-in
|
|
44
|
+
* # or
|
|
45
|
+
* npm install braintree-web-drop-in
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* The high-level workflow is:
|
|
49
|
+
* 1. Generate a "client token" on the server by executing the `generateBraintreeClientToken` mutation which is exposed by this plugin.
|
|
50
|
+
* 2. Use this client token to instantiate the Braintree Dropin UI.
|
|
51
|
+
* 3. Listen for the `"paymentMethodRequestable"` event which emitted by the Dropin.
|
|
52
|
+
* 4. Use the Dropin's `requestPaymentMethod()` method to get the required payment metadata.
|
|
53
|
+
* 5. Pass that metadata to the `addPaymentToOrder` mutation.
|
|
54
|
+
*
|
|
55
|
+
* Here is an example of how your storefront code will look. Note that this example is attempting to
|
|
56
|
+
* be framework-agnostic, so you'll need to adapt it to fit to your framework of choice.
|
|
57
|
+
*
|
|
58
|
+
* ```TypeScript
|
|
59
|
+
* // The Braintree Dropin instance
|
|
60
|
+
* let dropin: import('braintree-web-drop-in').Dropin;
|
|
61
|
+
*
|
|
62
|
+
* // Used to show/hide a "submit" button, which would be bound to the
|
|
63
|
+
* // `submitPayment()` method below.
|
|
64
|
+
* let showSubmitButton = false;
|
|
65
|
+
*
|
|
66
|
+
* // Used to display a "processing..." spinner
|
|
67
|
+
* let processing = false;
|
|
68
|
+
*
|
|
69
|
+
* //
|
|
70
|
+
* // This method would be invoked when the payment screen is mounted/created.
|
|
71
|
+
* //
|
|
72
|
+
* async function renderDropin(order: Order, clientToken: string) {
|
|
73
|
+
* // Lazy load braintree dropin because it has a reference
|
|
74
|
+
* // to `window` which breaks SSR
|
|
75
|
+
* dropin = await import('braintree-web-drop-in').then((module) =>
|
|
76
|
+
* module.default.create({
|
|
77
|
+
* authorization: clientToken,
|
|
78
|
+
* // This assumes a div in your view with the corresponding ID
|
|
79
|
+
* container: '#dropin-container',
|
|
80
|
+
* card: {
|
|
81
|
+
* cardholderName: {
|
|
82
|
+
* required: true,
|
|
83
|
+
* },
|
|
84
|
+
* overrides: {},
|
|
85
|
+
* },
|
|
86
|
+
* // Additional config is passed here depending on
|
|
87
|
+
* // which payment methods you have enabled in your
|
|
88
|
+
* // Braintree account.
|
|
89
|
+
* paypal: {
|
|
90
|
+
* flow: 'checkout',
|
|
91
|
+
* amount: order.totalWithTax,
|
|
92
|
+
* currency: 'GBP',
|
|
93
|
+
* },
|
|
94
|
+
* }),
|
|
95
|
+
* );
|
|
96
|
+
*
|
|
97
|
+
* dropin.on('paymentMethodRequestable', (payload) => {
|
|
98
|
+
* if (payload.type === 'CreditCard') {
|
|
99
|
+
* showSubmitButton = true;
|
|
100
|
+
* }
|
|
101
|
+
* if (payload.type === 'PayPalAccount') {
|
|
102
|
+
* this.submitPayment();
|
|
103
|
+
* }
|
|
104
|
+
* });
|
|
105
|
+
*
|
|
106
|
+
* dropin.on('noPaymentMethodRequestable', () => {
|
|
107
|
+
* // Display an error
|
|
108
|
+
* });
|
|
109
|
+
* }
|
|
110
|
+
*
|
|
111
|
+
* async function generateClientToken(orderId: string) {
|
|
112
|
+
* const { generateBraintreeClientToken } = await graphQlClient.query(gql`
|
|
113
|
+
* query GenerateBraintreeClientToken($orderId: ID!) {
|
|
114
|
+
* generateBraintreeClientToken(orderId: $orderId)
|
|
115
|
+
* }
|
|
116
|
+
* `, { orderId });
|
|
117
|
+
* return generateBraintreeClientToken;
|
|
118
|
+
* }
|
|
119
|
+
*
|
|
120
|
+
* async submitPayment() {
|
|
121
|
+
* if (!dropin.isPaymentMethodRequestable()) {
|
|
122
|
+
* return;
|
|
123
|
+
* }
|
|
124
|
+
* showSubmitButton = false;
|
|
125
|
+
* processing = true;
|
|
126
|
+
*
|
|
127
|
+
* const paymentResult = await dropin.requestPaymentMethod();
|
|
128
|
+
*
|
|
129
|
+
* const { addPaymentToOrder } = await graphQlClient.query(gql`
|
|
130
|
+
* mutation AddPayment($input: PaymentInput!) {
|
|
131
|
+
* addPaymentToOrder(input: $input) {
|
|
132
|
+
* ... on Order {
|
|
133
|
+
* id
|
|
134
|
+
* payments {
|
|
135
|
+
* id
|
|
136
|
+
* amount
|
|
137
|
+
* errorMessage
|
|
138
|
+
* method
|
|
139
|
+
* state
|
|
140
|
+
* transactionId
|
|
141
|
+
* createdAt
|
|
142
|
+
* }
|
|
143
|
+
* }
|
|
144
|
+
* ... on ErrorResult {
|
|
145
|
+
* errorCode
|
|
146
|
+
* message
|
|
147
|
+
* }
|
|
148
|
+
* }
|
|
149
|
+
* }`, {
|
|
150
|
+
* input: {
|
|
151
|
+
* method: 'braintree', // The code of you Braintree PaymentMethod
|
|
152
|
+
* metadata: paymentResult,
|
|
153
|
+
* },
|
|
154
|
+
* },
|
|
155
|
+
* );
|
|
156
|
+
*
|
|
157
|
+
* switch (addPaymentToOrder?.__typename) {
|
|
158
|
+
* case 'Order':
|
|
159
|
+
* // Adding payment succeeded!
|
|
160
|
+
* break;
|
|
161
|
+
* case 'OrderStateTransitionError':
|
|
162
|
+
* case 'OrderPaymentStateError':
|
|
163
|
+
* case 'PaymentDeclinedError':
|
|
164
|
+
* case 'PaymentFailedError':
|
|
165
|
+
* // Display an error to the customer
|
|
166
|
+
* dropin.clearSelectedPaymentMethod();
|
|
167
|
+
* }
|
|
168
|
+
* }
|
|
169
|
+
* ```
|
|
170
|
+
* @docsCategory payments-plugin
|
|
171
|
+
* @docsPage BraintreePlugin
|
|
172
|
+
*/
|
|
173
|
+
export declare class BraintreePlugin {
|
|
174
|
+
static options: BraintreePluginOptions;
|
|
175
|
+
static init(options: BraintreePluginOptions): BraintreePlugin;
|
|
176
|
+
}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var BraintreePlugin_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.BraintreePlugin = void 0;
|
|
11
|
+
const core_1 = require("@vendure/core");
|
|
12
|
+
const apollo_server_core_1 = require("apollo-server-core");
|
|
13
|
+
const braintree_handler_1 = require("./braintree.handler");
|
|
14
|
+
const braintree_resolver_1 = require("./braintree.resolver");
|
|
15
|
+
const constants_1 = require("./constants");
|
|
16
|
+
/**
|
|
17
|
+
* @description
|
|
18
|
+
* This plugin enables payments to be processed by [Braintree](https://www.braintreepayments.com/), a popular payment provider.
|
|
19
|
+
*
|
|
20
|
+
* ## Requirements
|
|
21
|
+
*
|
|
22
|
+
* 1. You will need to create a Braintree sandbox account as outlined in https://developers.braintreepayments.com/start/overview.
|
|
23
|
+
* 2. Then install `braintree` and `@types/braintree` from npm. This plugin was written with `v3.x` of the Braintree lib.
|
|
24
|
+
* ```shell
|
|
25
|
+
* yarn add \@vendure/payments-plugin braintree
|
|
26
|
+
* yarn add -D \@types/braintree
|
|
27
|
+
* ```
|
|
28
|
+
* or
|
|
29
|
+
* ```shell
|
|
30
|
+
* npm install \@vendure/payments-plugin braintree
|
|
31
|
+
* npm install -D \@types/braintree
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* ## Setup
|
|
35
|
+
*
|
|
36
|
+
* 1. Add the plugin to your VendureConfig `plugins` array:
|
|
37
|
+
* ```TypeScript
|
|
38
|
+
* import { BraintreePlugin } from '\@vendure/payments-plugin/package/braintree';
|
|
39
|
+
* import { Environment } from 'braintree';
|
|
40
|
+
*
|
|
41
|
+
* // ...
|
|
42
|
+
*
|
|
43
|
+
* plugins: [
|
|
44
|
+
* BraintreePlugin.init({ environment: Environment.Sandbox }),
|
|
45
|
+
* ]
|
|
46
|
+
* ```
|
|
47
|
+
* 2. Create a new PaymentMethod in the Admin UI, and select "Braintree payments" as the handler.
|
|
48
|
+
* 2. Fill in the `Merchant ID`, `Public Key` & `Private Key` from your Braintree sandbox account.
|
|
49
|
+
*
|
|
50
|
+
* ## Storefront usage
|
|
51
|
+
*
|
|
52
|
+
* The plugin is designed to work with the [Braintree drop-in UI](https://developers.braintreepayments.com/guides/drop-in/overview/javascript/v3).
|
|
53
|
+
* This is a library provided by Braintree which will handle the payment UI for you. You can install it in your storefront project
|
|
54
|
+
* with:
|
|
55
|
+
*
|
|
56
|
+
* ```shell
|
|
57
|
+
* yarn add braintree-web-drop-in
|
|
58
|
+
* # or
|
|
59
|
+
* npm install braintree-web-drop-in
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* The high-level workflow is:
|
|
63
|
+
* 1. Generate a "client token" on the server by executing the `generateBraintreeClientToken` mutation which is exposed by this plugin.
|
|
64
|
+
* 2. Use this client token to instantiate the Braintree Dropin UI.
|
|
65
|
+
* 3. Listen for the `"paymentMethodRequestable"` event which emitted by the Dropin.
|
|
66
|
+
* 4. Use the Dropin's `requestPaymentMethod()` method to get the required payment metadata.
|
|
67
|
+
* 5. Pass that metadata to the `addPaymentToOrder` mutation.
|
|
68
|
+
*
|
|
69
|
+
* Here is an example of how your storefront code will look. Note that this example is attempting to
|
|
70
|
+
* be framework-agnostic, so you'll need to adapt it to fit to your framework of choice.
|
|
71
|
+
*
|
|
72
|
+
* ```TypeScript
|
|
73
|
+
* // The Braintree Dropin instance
|
|
74
|
+
* let dropin: import('braintree-web-drop-in').Dropin;
|
|
75
|
+
*
|
|
76
|
+
* // Used to show/hide a "submit" button, which would be bound to the
|
|
77
|
+
* // `submitPayment()` method below.
|
|
78
|
+
* let showSubmitButton = false;
|
|
79
|
+
*
|
|
80
|
+
* // Used to display a "processing..." spinner
|
|
81
|
+
* let processing = false;
|
|
82
|
+
*
|
|
83
|
+
* //
|
|
84
|
+
* // This method would be invoked when the payment screen is mounted/created.
|
|
85
|
+
* //
|
|
86
|
+
* async function renderDropin(order: Order, clientToken: string) {
|
|
87
|
+
* // Lazy load braintree dropin because it has a reference
|
|
88
|
+
* // to `window` which breaks SSR
|
|
89
|
+
* dropin = await import('braintree-web-drop-in').then((module) =>
|
|
90
|
+
* module.default.create({
|
|
91
|
+
* authorization: clientToken,
|
|
92
|
+
* // This assumes a div in your view with the corresponding ID
|
|
93
|
+
* container: '#dropin-container',
|
|
94
|
+
* card: {
|
|
95
|
+
* cardholderName: {
|
|
96
|
+
* required: true,
|
|
97
|
+
* },
|
|
98
|
+
* overrides: {},
|
|
99
|
+
* },
|
|
100
|
+
* // Additional config is passed here depending on
|
|
101
|
+
* // which payment methods you have enabled in your
|
|
102
|
+
* // Braintree account.
|
|
103
|
+
* paypal: {
|
|
104
|
+
* flow: 'checkout',
|
|
105
|
+
* amount: order.totalWithTax,
|
|
106
|
+
* currency: 'GBP',
|
|
107
|
+
* },
|
|
108
|
+
* }),
|
|
109
|
+
* );
|
|
110
|
+
*
|
|
111
|
+
* dropin.on('paymentMethodRequestable', (payload) => {
|
|
112
|
+
* if (payload.type === 'CreditCard') {
|
|
113
|
+
* showSubmitButton = true;
|
|
114
|
+
* }
|
|
115
|
+
* if (payload.type === 'PayPalAccount') {
|
|
116
|
+
* this.submitPayment();
|
|
117
|
+
* }
|
|
118
|
+
* });
|
|
119
|
+
*
|
|
120
|
+
* dropin.on('noPaymentMethodRequestable', () => {
|
|
121
|
+
* // Display an error
|
|
122
|
+
* });
|
|
123
|
+
* }
|
|
124
|
+
*
|
|
125
|
+
* async function generateClientToken(orderId: string) {
|
|
126
|
+
* const { generateBraintreeClientToken } = await graphQlClient.query(gql`
|
|
127
|
+
* query GenerateBraintreeClientToken($orderId: ID!) {
|
|
128
|
+
* generateBraintreeClientToken(orderId: $orderId)
|
|
129
|
+
* }
|
|
130
|
+
* `, { orderId });
|
|
131
|
+
* return generateBraintreeClientToken;
|
|
132
|
+
* }
|
|
133
|
+
*
|
|
134
|
+
* async submitPayment() {
|
|
135
|
+
* if (!dropin.isPaymentMethodRequestable()) {
|
|
136
|
+
* return;
|
|
137
|
+
* }
|
|
138
|
+
* showSubmitButton = false;
|
|
139
|
+
* processing = true;
|
|
140
|
+
*
|
|
141
|
+
* const paymentResult = await dropin.requestPaymentMethod();
|
|
142
|
+
*
|
|
143
|
+
* const { addPaymentToOrder } = await graphQlClient.query(gql`
|
|
144
|
+
* mutation AddPayment($input: PaymentInput!) {
|
|
145
|
+
* addPaymentToOrder(input: $input) {
|
|
146
|
+
* ... on Order {
|
|
147
|
+
* id
|
|
148
|
+
* payments {
|
|
149
|
+
* id
|
|
150
|
+
* amount
|
|
151
|
+
* errorMessage
|
|
152
|
+
* method
|
|
153
|
+
* state
|
|
154
|
+
* transactionId
|
|
155
|
+
* createdAt
|
|
156
|
+
* }
|
|
157
|
+
* }
|
|
158
|
+
* ... on ErrorResult {
|
|
159
|
+
* errorCode
|
|
160
|
+
* message
|
|
161
|
+
* }
|
|
162
|
+
* }
|
|
163
|
+
* }`, {
|
|
164
|
+
* input: {
|
|
165
|
+
* method: 'braintree', // The code of you Braintree PaymentMethod
|
|
166
|
+
* metadata: paymentResult,
|
|
167
|
+
* },
|
|
168
|
+
* },
|
|
169
|
+
* );
|
|
170
|
+
*
|
|
171
|
+
* switch (addPaymentToOrder?.__typename) {
|
|
172
|
+
* case 'Order':
|
|
173
|
+
* // Adding payment succeeded!
|
|
174
|
+
* break;
|
|
175
|
+
* case 'OrderStateTransitionError':
|
|
176
|
+
* case 'OrderPaymentStateError':
|
|
177
|
+
* case 'PaymentDeclinedError':
|
|
178
|
+
* case 'PaymentFailedError':
|
|
179
|
+
* // Display an error to the customer
|
|
180
|
+
* dropin.clearSelectedPaymentMethod();
|
|
181
|
+
* }
|
|
182
|
+
* }
|
|
183
|
+
* ```
|
|
184
|
+
* @docsCategory payments-plugin
|
|
185
|
+
* @docsPage BraintreePlugin
|
|
186
|
+
*/
|
|
187
|
+
let BraintreePlugin = BraintreePlugin_1 = class BraintreePlugin {
|
|
188
|
+
static init(options) {
|
|
189
|
+
this.options = options;
|
|
190
|
+
return BraintreePlugin_1;
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
BraintreePlugin.options = {};
|
|
194
|
+
BraintreePlugin = BraintreePlugin_1 = __decorate([
|
|
195
|
+
core_1.VendurePlugin({
|
|
196
|
+
imports: [core_1.PluginCommonModule],
|
|
197
|
+
providers: [
|
|
198
|
+
{
|
|
199
|
+
provide: constants_1.BRAINTREE_PLUGIN_OPTIONS,
|
|
200
|
+
useFactory: () => BraintreePlugin_1.options,
|
|
201
|
+
},
|
|
202
|
+
],
|
|
203
|
+
configuration: config => {
|
|
204
|
+
config.paymentOptions.paymentMethodHandlers.push(braintree_handler_1.braintreePaymentMethodHandler);
|
|
205
|
+
return config;
|
|
206
|
+
},
|
|
207
|
+
shopApiExtensions: {
|
|
208
|
+
schema: apollo_server_core_1.gql `
|
|
209
|
+
extend type Query {
|
|
210
|
+
generateBraintreeClientToken(orderId: ID!): String!
|
|
211
|
+
}
|
|
212
|
+
`,
|
|
213
|
+
resolvers: [braintree_resolver_1.BraintreeResolver],
|
|
214
|
+
},
|
|
215
|
+
})
|
|
216
|
+
], BraintreePlugin);
|
|
217
|
+
exports.BraintreePlugin = BraintreePlugin;
|
|
218
|
+
//# sourceMappingURL=braintree.plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"braintree.plugin.js","sourceRoot":"","sources":["../../src/braintree/braintree.plugin.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,wCAAkE;AAClE,2DAAyC;AAEzC,2DAAoE;AACpE,6DAAyD;AACzD,2CAAuD;AAGvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0KG;AAsBH,IAAa,eAAe,uBAA5B,MAAa,eAAe;IAExB,MAAM,CAAC,IAAI,CAAC,OAA+B;QACvC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,OAAO,iBAAe,CAAC;IAC3B,CAAC;CACJ,CAAA;AALU,uBAAO,GAA2B,EAAE,CAAC;AADnC,eAAe;IArB3B,oBAAa,CAAC;QACX,OAAO,EAAE,CAAC,yBAAkB,CAAC;QAC7B,SAAS,EAAE;YACP;gBACI,OAAO,EAAE,oCAAwB;gBACjC,UAAU,EAAE,GAAG,EAAE,CAAC,iBAAe,CAAC,OAAO;aAC5C;SACJ;QACD,aAAa,EAAE,MAAM,CAAC,EAAE;YACpB,MAAM,CAAC,cAAc,CAAC,qBAAqB,CAAC,IAAI,CAAC,iDAA6B,CAAC,CAAC;YAChF,OAAO,MAAM,CAAC;QAClB,CAAC;QACD,iBAAiB,EAAE;YACf,MAAM,EAAE,wBAAG,CAAA;;;;SAIV;YACD,SAAS,EAAE,CAAC,sCAAiB,CAAC;SACjC;KACJ,CAAC;GACW,eAAe,CAM3B;AANY,0CAAe"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { ID, OrderService, RequestContext, TransactionalConnection } from '@vendure/core';
|
|
2
|
+
import { BraintreePluginOptions } from './types';
|
|
2
3
|
export declare class BraintreeResolver {
|
|
3
4
|
private connection;
|
|
4
5
|
private orderService;
|
|
5
|
-
|
|
6
|
+
private options;
|
|
7
|
+
constructor(connection: TransactionalConnection, orderService: OrderService, options: BraintreePluginOptions);
|
|
6
8
|
generateBraintreeClientToken(ctx: RequestContext, { orderId }: {
|
|
7
9
|
orderId: ID;
|
|
8
|
-
}): Promise<string
|
|
10
|
+
}): Promise<string>;
|
|
9
11
|
private getPaymentMethodArgs;
|
|
10
12
|
}
|
|
@@ -13,30 +13,31 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.BraintreeResolver = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
16
17
|
const graphql_1 = require("@nestjs/graphql");
|
|
17
18
|
const core_1 = require("@vendure/core");
|
|
18
19
|
const braintree_common_1 = require("./braintree-common");
|
|
19
|
-
const
|
|
20
|
+
const braintree_handler_1 = require("./braintree.handler");
|
|
20
21
|
const constants_1 = require("./constants");
|
|
21
22
|
let BraintreeResolver = class BraintreeResolver {
|
|
22
|
-
constructor(connection, orderService) {
|
|
23
|
+
constructor(connection, orderService, options) {
|
|
23
24
|
this.connection = connection;
|
|
24
25
|
this.orderService = orderService;
|
|
26
|
+
this.options = options;
|
|
25
27
|
}
|
|
26
28
|
async generateBraintreeClientToken(ctx, { orderId }) {
|
|
27
29
|
const order = await this.orderService.findOne(ctx, orderId);
|
|
28
30
|
if (order && order.customer) {
|
|
29
31
|
const customerId = order.customer.id.toString();
|
|
30
32
|
const args = await this.getPaymentMethodArgs(ctx);
|
|
31
|
-
const gateway = braintree_common_1.getGateway(args);
|
|
33
|
+
const gateway = braintree_common_1.getGateway(args, this.options);
|
|
32
34
|
try {
|
|
33
|
-
const result = await gateway.clientToken.generate({
|
|
34
|
-
customerId,
|
|
35
|
-
});
|
|
35
|
+
const result = await gateway.clientToken.generate({});
|
|
36
36
|
return result.clientToken;
|
|
37
37
|
}
|
|
38
38
|
catch (e) {
|
|
39
|
-
core_1.Logger.error(
|
|
39
|
+
core_1.Logger.error(`Could not generate Braintree clientToken. Check the configured credentials.`, constants_1.loggerCtx);
|
|
40
|
+
throw e;
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
else {
|
|
@@ -46,7 +47,7 @@ let BraintreeResolver = class BraintreeResolver {
|
|
|
46
47
|
async getPaymentMethodArgs(ctx) {
|
|
47
48
|
const method = await this.connection.getRepository(ctx, core_1.PaymentMethod).findOne({
|
|
48
49
|
where: {
|
|
49
|
-
code:
|
|
50
|
+
code: braintree_handler_1.braintreePaymentMethodHandler.code,
|
|
50
51
|
},
|
|
51
52
|
});
|
|
52
53
|
if (!method) {
|
|
@@ -67,7 +68,9 @@ __decorate([
|
|
|
67
68
|
], BraintreeResolver.prototype, "generateBraintreeClientToken", null);
|
|
68
69
|
BraintreeResolver = __decorate([
|
|
69
70
|
graphql_1.Resolver(),
|
|
70
|
-
|
|
71
|
+
__param(2, common_1.Inject(constants_1.BRAINTREE_PLUGIN_OPTIONS)),
|
|
72
|
+
__metadata("design:paramtypes", [core_1.TransactionalConnection,
|
|
73
|
+
core_1.OrderService, Object])
|
|
71
74
|
], BraintreeResolver);
|
|
72
75
|
exports.BraintreeResolver = BraintreeResolver;
|
|
73
76
|
//# sourceMappingURL=braintree.resolver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"braintree.resolver.js","sourceRoot":"","sources":["../../src/braintree/braintree.resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAAwD;AACxD,wCASuB;AAEvB,yDAAgD;AAChD,
|
|
1
|
+
{"version":3,"file":"braintree.resolver.js","sourceRoot":"","sources":["../../src/braintree/braintree.resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAwC;AACxC,6CAAwD;AACxD,wCASuB;AAEvB,yDAAgD;AAChD,2DAAoE;AACpE,2CAAkE;AAIlE,IAAa,iBAAiB,GAA9B,MAAa,iBAAiB;IAC1B,YACY,UAAmC,EACnC,YAA0B,EACQ,OAA+B;QAFjE,eAAU,GAAV,UAAU,CAAyB;QACnC,iBAAY,GAAZ,YAAY,CAAc;QACQ,YAAO,GAAP,OAAO,CAAwB;IAC1E,CAAC;IAGJ,KAAK,CAAC,4BAA4B,CAAQ,GAAmB,EAAU,EAAE,OAAO,EAAmB;QAC/F,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAC5D,IAAI,KAAK,IAAI,KAAK,CAAC,QAAQ,EAAE;YACzB,MAAM,UAAU,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC;YAChD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC;YAClD,MAAM,OAAO,GAAG,6BAAU,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;YAC/C,IAAI;gBACA,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;gBACtD,OAAO,MAAM,CAAC,WAAW,CAAC;aAC7B;YAAC,OAAO,CAAC,EAAE;gBACR,aAAM,CAAC,KAAK,CACR,6EAA6E,EAC7E,qBAAS,CACZ,CAAC;gBACF,MAAM,CAAC,CAAC;aACX;SACJ;aAAM;YACH,MAAM,IAAI,0BAAmB,CAAC,IAAI,qBAAS,iDAAiD,CAAC,CAAC;SACjG;IACL,CAAC;IAEO,KAAK,CAAC,oBAAoB,CAAC,GAAmB;QAClD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,GAAG,EAAE,oBAAa,CAAC,CAAC,OAAO,CAAC;YAC3E,KAAK,EAAE;gBACH,IAAI,EAAE,iDAA6B,CAAC,IAAI;aAC3C;SACJ,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,EAAE;YACT,MAAM,IAAI,0BAAmB,CAAC,IAAI,qBAAS,0CAA0C,CAAC,CAAC;SAC1F;QACD,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;YAC5C,uCACO,IAAI,KACP,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,KAAK,IACvB;QACN,CAAC,EAAE,EAA2B,CAAC,CAAC;IACpC,CAAC;CACJ,CAAA;AArCG;IADC,eAAK,EAAE;IAC4B,WAAA,UAAG,EAAE,CAAA;IAAuB,WAAA,cAAI,EAAE,CAAA;;qCAAvB,qBAAc;;qEAmB5D;AA3BQ,iBAAiB;IAD7B,kBAAQ,EAAE;IAKF,WAAA,eAAM,CAAC,oCAAwB,CAAC,CAAA;qCAFb,8BAAuB;QACrB,mBAAY;GAH7B,iBAAiB,CA6C7B;AA7CY,8CAAiB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.loggerCtx = void 0;
|
|
3
|
+
exports.BRAINTREE_PLUGIN_OPTIONS = exports.loggerCtx = void 0;
|
|
4
4
|
exports.loggerCtx = 'BraintreePlugin';
|
|
5
|
+
exports.BRAINTREE_PLUGIN_OPTIONS = Symbol('BRAINTREE_PLUGIN_OPTIONS');
|
|
5
6
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/braintree/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/braintree/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG,iBAAiB,CAAC;AAC9B,QAAA,wBAAwB,GAAG,MAAM,CAAC,0BAA0B,CAAC,CAAC"}
|
|
@@ -10,8 +10,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./braintree
|
|
14
|
-
__exportStar(require("./braintree
|
|
13
|
+
__exportStar(require("./braintree.plugin"), exports);
|
|
14
|
+
__exportStar(require("./braintree.handler"), exports);
|
|
15
15
|
__exportStar(require("./braintree.resolver"), exports);
|
|
16
16
|
__exportStar(require("./braintree-common"), exports);
|
|
17
|
+
__exportStar(require("./types"), exports);
|
|
17
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/braintree/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAmC;AACnC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/braintree/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAmC;AACnC,sDAAoC;AACpC,uDAAqC;AACrC,qDAAmC;AACnC,0CAAwB"}
|