@vendure/payments-plugin 2.0.4 → 2.0.5
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.
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { OrderService,
|
|
1
|
+
import { OrderService, PaymentMethodService, RequestContextService } from '@vendure/core';
|
|
2
2
|
import { Response } from 'express';
|
|
3
3
|
import { StripeService } from './stripe.service';
|
|
4
4
|
import { RequestWithRawBody } from './types';
|
|
5
5
|
export declare class StripeController {
|
|
6
|
-
private
|
|
6
|
+
private paymentMethodService;
|
|
7
7
|
private orderService;
|
|
8
8
|
private stripeService;
|
|
9
9
|
private requestContextService;
|
|
10
|
-
constructor(
|
|
10
|
+
constructor(paymentMethodService: PaymentMethodService, orderService: OrderService, stripeService: StripeService, requestContextService: RequestContextService);
|
|
11
11
|
webhook(signature: string | undefined, request: RequestWithRawBody, response: Response): Promise<void>;
|
|
12
12
|
private createContext;
|
|
13
13
|
private getPaymentMethod;
|
|
@@ -23,8 +23,8 @@ const missingHeaderErrorMessage = 'Missing stripe-signature header';
|
|
|
23
23
|
const signatureErrorMessage = 'Error verifying Stripe webhook signature';
|
|
24
24
|
const noPaymentIntentErrorMessage = 'No payment intent in the event payload';
|
|
25
25
|
let StripeController = class StripeController {
|
|
26
|
-
constructor(
|
|
27
|
-
this.
|
|
26
|
+
constructor(paymentMethodService, orderService, stripeService, requestContextService) {
|
|
27
|
+
this.paymentMethodService = paymentMethodService;
|
|
28
28
|
this.orderService = orderService;
|
|
29
29
|
this.stripeService = stripeService;
|
|
30
30
|
this.requestContextService = requestContextService;
|
|
@@ -101,7 +101,7 @@ let StripeController = class StripeController {
|
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
async getPaymentMethod(ctx) {
|
|
104
|
-
const method = (await this.
|
|
104
|
+
const method = (await this.paymentMethodService.findAll(ctx)).items.find(m => m.handler.code === stripe_handler_1.stripePaymentMethodHandler.code);
|
|
105
105
|
if (!method) {
|
|
106
106
|
throw new core_1.InternalServerError(`[${constants_1.loggerCtx}] Could not find Stripe PaymentMethod`);
|
|
107
107
|
}
|
|
@@ -119,7 +119,7 @@ __decorate([
|
|
|
119
119
|
], StripeController.prototype, "webhook", null);
|
|
120
120
|
StripeController = __decorate([
|
|
121
121
|
(0, common_1.Controller)('payments'),
|
|
122
|
-
__metadata("design:paramtypes", [core_1.
|
|
122
|
+
__metadata("design:paramtypes", [core_1.PaymentMethodService,
|
|
123
123
|
core_1.OrderService,
|
|
124
124
|
stripe_service_1.StripeService,
|
|
125
125
|
core_1.RequestContextService])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stripe.controller.js","sourceRoot":"","sources":["../../src/stripe/stripe.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAiF;AACjF,wCAUuB;AACvB,iHAA0G;AAI1G,2CAAwC;AACxC,qDAA8D;AAC9D,qDAAiD;AAGjD,MAAM,yBAAyB,GAAG,iCAAiC,CAAC;AACpE,MAAM,qBAAqB,GAAG,0CAA0C,CAAC;AACzE,MAAM,2BAA2B,GAAG,wCAAwC,CAAC;AAGtE,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IACzB,YACY,
|
|
1
|
+
{"version":3,"file":"stripe.controller.js","sourceRoot":"","sources":["../../src/stripe/stripe.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAiF;AACjF,wCAUuB;AACvB,iHAA0G;AAI1G,2CAAwC;AACxC,qDAA8D;AAC9D,qDAAiD;AAGjD,MAAM,yBAAyB,GAAG,iCAAiC,CAAC;AACpE,MAAM,qBAAqB,GAAG,0CAA0C,CAAC;AACzE,MAAM,2BAA2B,GAAG,wCAAwC,CAAC;AAGtE,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IACzB,YACY,oBAA0C,EAC1C,YAA0B,EAC1B,aAA4B,EAC5B,qBAA4C;QAH5C,yBAAoB,GAApB,oBAAoB,CAAsB;QAC1C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F;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ,CAAA;AApGS;IADL,IAAA,aAAI,EAAC,QAAQ,CAAC;IAEV,WAAA,IAAA,gBAAO,EAAC,kBAAkB,CAAC,CAAA;IAC3B,WAAA,IAAA,YAAG,GAAE,CAAA;IACL,WAAA,IAAA,YAAG,GAAE,CAAA;;;;+CA4ET;AAxFQ,gBAAgB;IAD5B,IAAA,mBAAU,EAAC,UAAU,CAAC;qCAGe,2BAAoB;QAC5B,mBAAY;QACX,8BAAa;QACL,4BAAqB;GAL/C,gBAAgB,CA6G5B;AA7GY,4CAAgB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vendure/payments-plugin",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "package/index.js",
|
|
6
6
|
"types": "package/index.d.ts",
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"@mollie/api-client": "^3.6.0",
|
|
47
47
|
"@types/braintree": "^2.22.15",
|
|
48
48
|
"@types/localtunnel": "2.0.1",
|
|
49
|
-
"@vendure/common": "^2.0.
|
|
50
|
-
"@vendure/core": "^2.0.
|
|
51
|
-
"@vendure/testing": "^2.0.
|
|
49
|
+
"@vendure/common": "^2.0.5",
|
|
50
|
+
"@vendure/core": "^2.0.5",
|
|
51
|
+
"@vendure/testing": "^2.0.5",
|
|
52
52
|
"braintree": "^3.0.0",
|
|
53
53
|
"localtunnel": "2.0.1",
|
|
54
54
|
"nock": "^13.1.4",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"stripe": "^8.197.0",
|
|
57
57
|
"typescript": "4.9.5"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "2fb595caf6460d6159fe3c62f8975b62e5c3c3d7"
|
|
60
60
|
}
|