@vendure/payments-plugin 1.9.2 → 1.9.3
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.plugin.d.ts +1 -1
- package/package/braintree/braintree.plugin.js +1 -1
- package/package/braintree/braintree.resolver.js +21 -2
- package/package/braintree/braintree.resolver.js.map +1 -1
- package/package/mollie/mollie.plugin.d.ts +2 -1
- package/package/mollie/mollie.plugin.js +1 -4
- package/package/mollie/mollie.plugin.js.map +1 -1
- package/package/stripe/stripe.handler.js.map +1 -1
- package/package/stripe/stripe.plugin.d.ts +2 -2
- package/package/stripe/stripe.plugin.js +6 -6
- package/package.json +5 -5
|
@@ -41,10 +41,29 @@ let BraintreeResolver = class BraintreeResolver {
|
|
|
41
41
|
const args = await this.getPaymentMethodArgs(ctx);
|
|
42
42
|
const gateway = braintree_common_1.getGateway(args, this.options);
|
|
43
43
|
try {
|
|
44
|
-
|
|
44
|
+
let result = await gateway.clientToken.generate({
|
|
45
45
|
customerId: includeCustomerId === false ? undefined : customerId,
|
|
46
46
|
});
|
|
47
|
-
|
|
47
|
+
if (result.success === true) {
|
|
48
|
+
return result.clientToken;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
if (result.message === 'Customer specified by customer_id does not exist') {
|
|
52
|
+
// For some reason the custom_id is invalid. This could occur e.g. if the ID was created on the Sandbox endpoint and now
|
|
53
|
+
// we switched to Production. In this case, we will remove it and allow a new one
|
|
54
|
+
// to be generated when the payment is created.
|
|
55
|
+
if (this.options.storeCustomersInBraintree) {
|
|
56
|
+
order.customer.customFields.braintreeCustomerId = undefined;
|
|
57
|
+
await this.connection.getRepository(ctx, core_1.Customer).save(order.customer);
|
|
58
|
+
}
|
|
59
|
+
result = await gateway.clientToken.generate({ customerId: undefined });
|
|
60
|
+
if (result.success === true) {
|
|
61
|
+
return result.clientToken;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
core_1.Logger.error(`Could not generate Braintree clientToken: ${result.message}`, constants_1.loggerCtx);
|
|
65
|
+
throw new core_1.InternalServerError(`Could not generate Braintree clientToken: ${result.message}`);
|
|
66
|
+
}
|
|
48
67
|
}
|
|
49
68
|
catch (e) {
|
|
50
69
|
core_1.Logger.error(`Could not generate Braintree clientToken. Check the configured credentials.`, constants_1.loggerCtx);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"braintree.resolver.js","sourceRoot":"","sources":["../../src/braintree/braintree.resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAwC;AACxC,6CAAwD;AACxD,
|
|
1
|
+
{"version":3,"file":"braintree.resolver.js","sourceRoot":"","sources":["../../src/braintree/braintree.resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAwC;AACxC,6CAAwD;AACxD,wCAWuB;AAEvB,yDAAgD;AAChD,2DAAoE;AACpE,2CAAkE;AAIlE,IAAa,iBAAiB,GAA9B,MAAa,iBAAiB;IAC1B,YACY,UAAmC,EACnC,YAA0B,EAC1B,kBAAsC,EACJ,OAA+B;QAHjE,eAAU,GAAV,UAAU,CAAyB;QACnC,iBAAY,GAAZ,YAAY,CAAc;QAC1B,uBAAkB,GAAlB,kBAAkB,CAAoB;QACJ,YAAO,GAAP,OAAO,CAAwB;IAC1E,CAAC;IAGJ,KAAK,CAAC,4BAA4B,CACvB,GAAmB,EAClB,EAAE,OAAO,EAAE,iBAAiB,EAAiD;;QAErF,IAAI,OAAO,EAAE;YACT,aAAM,CAAC,IAAI,CACP,2GAA2G,CAC9G,CAAC;SACL;QACD,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;QAC5E,IAAI,CAAC,YAAY,EAAE;YACf,MAAM,IAAI,0BAAmB,CACzB,oEAAoE,CACvE,CAAC;SACL;QACD,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG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
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
export interface MolliePluginOptions {
|
|
9
9
|
/**
|
|
10
10
|
* @description
|
|
11
|
-
* The host of your
|
|
11
|
+
* The host of your Vendure server, e.g. `'https://my-vendure.io'`.
|
|
12
|
+
* This is used by Mollie to send webhook events to the Vendure server
|
|
12
13
|
*/
|
|
13
14
|
vendureHost: string;
|
|
14
15
|
}
|
|
@@ -130,10 +130,7 @@ MolliePlugin = MolliePlugin_1 = __decorate([
|
|
|
130
130
|
core_1.VendurePlugin({
|
|
131
131
|
imports: [core_1.PluginCommonModule],
|
|
132
132
|
controllers: [mollie_controller_1.MollieController],
|
|
133
|
-
providers: [
|
|
134
|
-
mollie_service_1.MollieService,
|
|
135
|
-
{ provide: constants_1.PLUGIN_INIT_OPTIONS, useFactory: () => MolliePlugin_1.options }
|
|
136
|
-
],
|
|
133
|
+
providers: [mollie_service_1.MollieService, { provide: constants_1.PLUGIN_INIT_OPTIONS, useFactory: () => MolliePlugin_1.options }],
|
|
137
134
|
configuration: (config) => {
|
|
138
135
|
config.paymentOptions.paymentMethodHandlers.push(mollie_handler_1.molliePaymentHandler);
|
|
139
136
|
return config;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mollie.plugin.js","sourceRoot":"","sources":["../../src/mollie/mollie.plugin.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,wCAAwF;AAExF,2CAAkD;AAClD,6DAAkD;AAClD,2DAAuD;AACvD,qDAAwD;AACxD,uDAAmD;AACnD,qDAAiD;
|
|
1
|
+
{"version":3,"file":"mollie.plugin.js","sourceRoot":"","sources":["../../src/mollie/mollie.plugin.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,wCAAwF;AAExF,2CAAkD;AAClD,6DAAkD;AAClD,2DAAuD;AACvD,qDAAwD;AACxD,uDAAmD;AACnD,qDAAiD;AAkBjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmGG;AAcH,IAAa,YAAY,oBAAzB,MAAa,YAAY;IAGrB;;;;OAIG;IACH,MAAM,CAAC,IAAI,CAAC,OAA4B;QACpC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,OAAO,cAAY,CAAC;IACxB,CAAC;CACJ,CAAA;AAZY,YAAY;IAbxB,oBAAa,CAAC;QACX,OAAO,EAAE,CAAC,yBAAkB,CAAC;QAC7B,WAAW,EAAE,CAAC,oCAAgB,CAAC;QAC/B,SAAS,EAAE,CAAC,8BAAa,EAAE,EAAE,OAAO,EAAE,+BAAmB,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,cAAY,CAAC,OAAO,EAAE,CAAC;QACpG,aAAa,EAAE,CAAC,MAA4B,EAAE,EAAE;YAC5C,MAAM,CAAC,cAAc,CAAC,qBAAqB,CAAC,IAAI,CAAC,qCAAoB,CAAC,CAAC;YACvE,OAAO,MAAM,CAAC;QAClB,CAAC;QACD,iBAAiB,EAAE;YACf,MAAM,EAAE,+BAAU;YAClB,SAAS,EAAE,CAAC,gCAAc,CAAC;SAC9B;KACJ,CAAC;GACW,YAAY,CAYxB;AAZY,oCAAY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stripe.handler.js","sourceRoot":"","sources":["../../src/stripe/stripe.handler.ts"],"names":[],"mappings":";;;;;;AAAA,wCAOuB;AACvB,oDAA4B;AAE5B,
|
|
1
|
+
{"version":3,"file":"stripe.handler.js","sourceRoot":"","sources":["../../src/stripe/stripe.handler.ts"],"names":[],"mappings":";;;;;;AAAA,wCAOuB;AACvB,oDAA4B;AAE5B,iDAA+D;AAC/D,qDAAiD;AAEjD,MAAM,EAAE,WAAW,EAAE,GAAG,gBAAM,CAAC,MAAM,CAAC;AAEtC,IAAI,aAA4B,CAAC;AAEjC;;GAEG;AACU,QAAA,0BAA0B,GAAG,IAAI,2BAAoB,CAAC;IAC/D,IAA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OAAO;gBACH,KAAK,EAAE,SAAkB;gBACzB,aAAa,EAAE,OAAO,CAAC,aAAa;aACvC,CAAC;SACL;QAED,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE;YAC7B,OAAO;gBACH,KAAK,EAAE,SAAkB;gBACzB,aAAa,EAAE,OAAO,CAAC,aAAa;aACvC,CAAC;SACL;QAED,OAAO;YACH,KAAK,EAAE,QAAiB;YACxB,aAAa,EAAE,OAAO,CAAC,aAAa;YACpC,QAAQ,EAAE;gBACN,OAAO,EAAE,MAAM,CAAC,cAAc;aACjC;SACJ,CAAC;IACN,CAAC;CACJ,CAAC,CAAC"}
|
|
@@ -8,8 +8,8 @@ import { StripePluginOptions } from './types';
|
|
|
8
8
|
*
|
|
9
9
|
* 1. You will need to create a Stripe account and get your secret key in the dashboard.
|
|
10
10
|
* 2. Create a webhook endpoint in the Stripe dashboard (Developers -> Webhooks, "Add an endpoint") which listens to the `payment_intent.succeeded`
|
|
11
|
-
* and `payment_intent.payment_failed` events. The URL should be `https://my-
|
|
12
|
-
* `my-
|
|
11
|
+
* and `payment_intent.payment_failed` events. The URL should be `https://my-server.com/payments/stripe`, where
|
|
12
|
+
* `my-server.com` is the host of your Vendure server. *Note:* for local development, you'll need to use
|
|
13
13
|
* the Stripe CLI to test your webhook locally. See the _local development_ section below.
|
|
14
14
|
* 3. Get the signing secret for the newly created webhook.
|
|
15
15
|
* 4. Install the Payments plugin and the Stripe Node library:
|
|
@@ -24,8 +24,8 @@ const stripe_service_1 = require("./stripe.service");
|
|
|
24
24
|
*
|
|
25
25
|
* 1. You will need to create a Stripe account and get your secret key in the dashboard.
|
|
26
26
|
* 2. Create a webhook endpoint in the Stripe dashboard (Developers -> Webhooks, "Add an endpoint") which listens to the `payment_intent.succeeded`
|
|
27
|
-
* and `payment_intent.payment_failed` events. The URL should be `https://my-
|
|
28
|
-
* `my-
|
|
27
|
+
* and `payment_intent.payment_failed` events. The URL should be `https://my-server.com/payments/stripe`, where
|
|
28
|
+
* `my-server.com` is the host of your Vendure server. *Note:* for local development, you'll need to use
|
|
29
29
|
* the Stripe CLI to test your webhook locally. See the _local development_ section below.
|
|
30
30
|
* 3. Get the signing secret for the newly created webhook.
|
|
31
31
|
* 4. Install the Payments plugin and the Stripe Node library:
|
|
@@ -205,10 +205,10 @@ StripePlugin = StripePlugin_1 = __decorate([
|
|
|
205
205
|
return config;
|
|
206
206
|
},
|
|
207
207
|
shopApiExtensions: {
|
|
208
|
-
schema: graphql_tag_1.gql `
|
|
209
|
-
extend type Mutation {
|
|
210
|
-
createStripePaymentIntent: String
|
|
211
|
-
}
|
|
208
|
+
schema: graphql_tag_1.gql `
|
|
209
|
+
extend type Mutation {
|
|
210
|
+
createStripePaymentIntent: String
|
|
211
|
+
}
|
|
212
212
|
`,
|
|
213
213
|
resolvers: [stripe_resolver_1.StripeResolver],
|
|
214
214
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vendure/payments-plugin",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "package/index.js",
|
|
6
6
|
"types": "package/index.d.ts",
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@mollie/api-client": "^3.6.0",
|
|
31
31
|
"@types/braintree": "^2.22.15",
|
|
32
|
-
"@vendure/common": "^1.9.
|
|
33
|
-
"@vendure/core": "^1.9.
|
|
34
|
-
"@vendure/testing": "^1.9.
|
|
32
|
+
"@vendure/common": "^1.9.3",
|
|
33
|
+
"@vendure/core": "^1.9.3",
|
|
34
|
+
"@vendure/testing": "^1.9.3",
|
|
35
35
|
"braintree": "^3.0.0",
|
|
36
36
|
"nock": "^13.1.4",
|
|
37
37
|
"rimraf": "^3.0.2",
|
|
38
38
|
"stripe": "^8.197.0",
|
|
39
39
|
"typescript": "4.3.5"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "02513db6da212c870299c5b15b576b4ebf25563e"
|
|
42
42
|
}
|