@darraghor/nest-backend-libs 2.12.8 → 2.12.10

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/README.md CHANGED
@@ -31,3 +31,20 @@ STRIPE_REDIRECTS_BASE_URL
31
31
  Why: To securely redirect the user to the correct website after checkout we don't use a full url
32
32
  in the request object, only a path which is combined with this base url
33
33
  Where: your frontend configuration
34
+
35
+ ### Testing
36
+
37
+ https://stripe.com/docs/webhooks/test
38
+
39
+ ```bash
40
+ brew install stripe/stripe-cli/stripe
41
+ stripe login
42
+ # setup webhook forwarding - change port to your BACKEND port
43
+ stripe listen --forward-to localhost:34522/payments/stripe/webhook-receiver
44
+
45
+ # now you can test webhooks
46
+
47
+ # if you like you can trigger a test webhook
48
+ stripe trigger checkout.session.completed
49
+ stripe trigger payment_intent.succeeded
50
+ ```
@@ -11,16 +11,19 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.StripeCheckoutLineItem = void 0;
13
13
  const swagger_1 = require("@nestjs/swagger");
14
+ const class_validator_1 = require("class-validator");
14
15
  class StripeCheckoutLineItem {
15
16
  price;
16
17
  quantity;
17
18
  }
18
19
  __decorate([
19
20
  (0, swagger_1.ApiProperty)(),
21
+ (0, class_validator_1.IsString)(),
20
22
  __metadata("design:type", String)
21
23
  ], StripeCheckoutLineItem.prototype, "price", void 0);
22
24
  __decorate([
23
25
  (0, swagger_1.ApiProperty)(),
26
+ (0, class_validator_1.IsInt)(),
24
27
  __metadata("design:type", Number)
25
28
  ], StripeCheckoutLineItem.prototype, "quantity", void 0);
26
29
  exports.StripeCheckoutLineItem = StripeCheckoutLineItem;
@@ -1 +1 @@
1
- {"version":3,"file":"StripeCheckoutLineItem.js","sourceRoot":"","sources":["../../../src/stripe-client/models/StripeCheckoutLineItem.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA4C;AAE5C,MAAa,sBAAsB;IAE/B,KAAK,CAAU;IAEf,QAAQ,CAAU;CACrB;AAJG;IAAC,IAAA,qBAAW,GAAE;;qDACC;AACf;IAAC,IAAA,qBAAW,GAAE;;wDACI;AAJtB,wDAKC"}
1
+ {"version":3,"file":"StripeCheckoutLineItem.js","sourceRoot":"","sources":["../../../src/stripe-client/models/StripeCheckoutLineItem.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA4C;AAC5C,qDAAgD;AAEhD,MAAa,sBAAsB;IAG/B,KAAK,CAAU;IAIf,QAAQ,CAAU;CACrB;AAPG;IAAC,IAAA,qBAAW,GAAE;IACb,IAAA,0BAAQ,GAAE;;qDACI;AAEf;IAAC,IAAA,qBAAW,GAAE;IACb,IAAA,uBAAK,GAAE;;wDACU;AAPtB,wDAQC"}
@@ -38,7 +38,7 @@ let StripeWebhookHandler = class StripeWebhookHandler {
38
38
  throw new Error("No stripe signature found in webhook request");
39
39
  }
40
40
  try {
41
- const event = this.clientInstance.webhooks.constructEvent(request.body, // is a buffer according to nest docs
41
+ const event = this.clientInstance.webhooks.constructEvent(request.rawBody, // is a buffer according to nest docs
42
42
  signature, this.config.webhookVerificationKey);
43
43
  await this.queue.add(event);
44
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"stripe-webhook-handler.service.js","sourceRoot":"","sources":["../../../src/stripe-client/services/stripe-webhook-handler.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uCAAyC;AACzC,2CAKwB;AAGxB,oDAA4B;AAC5B,uFAA+D;AAC/D,0FAAqF;AAG9E,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAER;IACA;IAEA;IAET;IANZ,YACqB,MAAwC,EACxC,MAAyB,EAEzB,cAAsB,EAE/B,KAAY;QALH,WAAM,GAAN,MAAM,CAAkC;QACxC,WAAM,GAAN,MAAM,CAAmB;QAEzB,mBAAc,GAAd,cAAc,CAAQ;QAE/B,UAAK,GAAL,KAAK,CAAO;IACrB,CAAC;IAEG,KAAK,CAAC,aAAa,CACtB,OAAgC;QAEhC,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAEtD,IAAI,CAAC,SAAS,EAAE;YACZ,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;SACnE;QAED,IAAI;YACA,MAAM,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,cAAc,CACrD,OAAO,CAAC,IAAc,EAAE,qCAAqC;YAC7D,SAAS,EACT,IAAI,CAAC,MAAM,CAAC,sBAAsB,CACrC,CAAC;YAEF,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SAC/B;QAAC,OAAO,KAAK,EAAE;YACZ,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,wCAAwC,EAAE,KAAK,CAAC,CAAC;YACnE,MAAM,IAAI,4BAAmB,CACzB,wCAAwC,CAC3C,CAAC;SACL;IACL,CAAC;CACJ,CAAA;AAlCY,oBAAoB;IADhC,IAAA,mBAAU,GAAE;IAKJ,WAAA,IAAA,eAAM,EAAC,cAAc,CAAC,CAAA;IAEtB,WAAA,IAAA,kBAAW,EAAC,eAAe,CAAC,CAAA;qCAJJ,mEAAgC;QAChC,2BAAiB;QAET,gBAAM;GALlC,oBAAoB,CAkChC;AAlCY,oDAAoB"}
1
+ {"version":3,"file":"stripe-webhook-handler.service.js","sourceRoot":"","sources":["../../../src/stripe-client/services/stripe-webhook-handler.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uCAAyC;AACzC,2CAKwB;AAGxB,oDAA4B;AAC5B,uFAA+D;AAC/D,0FAAqF;AAG9E,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAER;IACA;IAEA;IAET;IANZ,YACqB,MAAwC,EACxC,MAAyB,EAEzB,cAAsB,EAE/B,KAAY;QALH,WAAM,GAAN,MAAM,CAAkC;QACxC,WAAM,GAAN,MAAM,CAAmB;QAEzB,mBAAc,GAAd,cAAc,CAAQ;QAE/B,UAAK,GAAL,KAAK,CAAO;IACrB,CAAC;IAEG,KAAK,CAAC,aAAa,CACtB,OAAgC;QAEhC,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAEtD,IAAI,CAAC,SAAS,EAAE;YACZ,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;SACnE;QAED,IAAI;YACA,MAAM,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,cAAc,CACrD,OAAO,CAAC,OAAiB,EAAE,qCAAqC;YAChE,SAAS,EACT,IAAI,CAAC,MAAM,CAAC,sBAAsB,CACrC,CAAC;YAEF,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SAC/B;QAAC,OAAO,KAAK,EAAE;YACZ,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,wCAAwC,EAAE,KAAK,CAAC,CAAC;YACnE,MAAM,IAAI,4BAAmB,CACzB,wCAAwC,CAC3C,CAAC;SACL;IACL,CAAC;CACJ,CAAA;AAlCY,oBAAoB;IADhC,IAAA,mBAAU,GAAE;IAKJ,WAAA,IAAA,eAAM,EAAC,cAAc,CAAC,CAAA;IAEtB,WAAA,IAAA,kBAAW,EAAC,eAAe,CAAC,CAAA;qCAJJ,mEAAgC;QAChC,2BAAiB;QAET,gBAAM;GALlC,oBAAoB,CAkChC;AAlCY,oDAAoB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@darraghor/nest-backend-libs",
3
- "version": "2.12.8",
3
+ "version": "2.12.10",
4
4
  "license": "SEE LICENSE IN LICENSE.md",
5
5
  "description": "Some helpers for personal projects in nestjs",
6
6
  "homepage": "https://github.com/darraghoriordan/nest-backend-libs",