@darraghor/nest-backend-libs 2.17.18 → 2.18.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.
Files changed (44) hide show
  1. package/dist/organisation-subscriptions/entities/organisation-subscription.entity.d.ts +8 -3
  2. package/dist/organisation-subscriptions/entities/organisation-subscription.entity.js +36 -6
  3. package/dist/organisation-subscriptions/entities/organisation-subscription.entity.js.map +1 -1
  4. package/dist/organisation-subscriptions/models/fulfillSubscriptionDto.d.ts +10 -0
  5. package/dist/organisation-subscriptions/models/{saveSubscriptionDto.js → fulfillSubscriptionDto.js} +32 -7
  6. package/dist/organisation-subscriptions/models/fulfillSubscriptionDto.js.map +1 -0
  7. package/dist/organisation-subscriptions/organisation-subscriptions.controller.d.ts +2 -3
  8. package/dist/organisation-subscriptions/organisation-subscriptions.controller.js +2 -17
  9. package/dist/organisation-subscriptions/organisation-subscriptions.controller.js.map +1 -1
  10. package/dist/organisation-subscriptions/organisation-subscriptions.service.d.ts +8 -4
  11. package/dist/organisation-subscriptions/organisation-subscriptions.service.js +55 -36
  12. package/dist/organisation-subscriptions/organisation-subscriptions.service.js.map +1 -1
  13. package/dist/payment-sessions/payment-session.entity.d.ts +7 -0
  14. package/dist/payment-sessions/payment-session.entity.js +54 -0
  15. package/dist/payment-sessions/payment-session.entity.js.map +1 -0
  16. package/dist/payment-sessions/payment-session.module.d.ts +2 -0
  17. package/dist/payment-sessions/payment-session.module.js +26 -0
  18. package/dist/payment-sessions/payment-session.module.js.map +1 -0
  19. package/dist/payment-sessions/payment-session.service.d.ts +11 -0
  20. package/dist/payment-sessions/payment-session.service.js +51 -0
  21. package/dist/payment-sessions/payment-session.service.js.map +1 -0
  22. package/dist/stripe-client/entities/stripe-checkout-event.entity.d.ts +1 -1
  23. package/dist/stripe-client/entities/stripe-checkout-event.entity.js +2 -2
  24. package/dist/stripe-client/entities/stripe-checkout-event.entity.js.map +1 -1
  25. package/dist/stripe-client/index.d.ts +0 -1
  26. package/dist/stripe-client/index.js +1 -3
  27. package/dist/stripe-client/index.js.map +1 -1
  28. package/dist/stripe-client/models/StripeCheckoutSessionRequestDto.d.ts +1 -1
  29. package/dist/stripe-client/models/StripeCheckoutSessionRequestDto.js +2 -2
  30. package/dist/stripe-client/models/StripeCheckoutSessionRequestDto.js.map +1 -1
  31. package/dist/stripe-client/services/queued-payment-event.handler.d.ts +18 -0
  32. package/dist/stripe-client/services/queued-payment-event.handler.js +333 -0
  33. package/dist/stripe-client/services/queued-payment-event.handler.js.map +1 -0
  34. package/dist/stripe-client/services/stripe-checkout.service.d.ts +4 -5
  35. package/dist/stripe-client/services/stripe-checkout.service.js +23 -20
  36. package/dist/stripe-client/services/stripe-checkout.service.js.map +1 -1
  37. package/dist/stripe-client/stripe-account.module.js +2 -0
  38. package/dist/stripe-client/stripe-account.module.js.map +1 -1
  39. package/package.json +1 -1
  40. package/dist/organisation-subscriptions/models/saveSubscriptionDto.d.ts +0 -6
  41. package/dist/organisation-subscriptions/models/saveSubscriptionDto.js.map +0 -1
  42. package/dist/stripe-client/services/stripe-event-handler.d.ts +0 -11
  43. package/dist/stripe-client/services/stripe-event-handler.js +0 -190
  44. package/dist/stripe-client/services/stripe-event-handler.js.map +0 -1
@@ -2,11 +2,16 @@ import { Organisation } from "../../organisation/entities/organisation.entity";
2
2
  export declare class OrganisationSubscriptionRecord {
3
3
  id: number;
4
4
  uuid: string;
5
- stripeSubscriptionId: string;
6
- stripeCustomerId: string;
7
- stripePriceId: string;
5
+ productDisplayName: string;
6
+ paymentSystemTransactionId: string;
7
+ paymentSystemProductId: string;
8
+ paymentSystemCustomerId: string;
9
+ paymentSystemMode: string;
10
+ paymentSystemName: string;
8
11
  validUntil: Date;
9
12
  organisation: Organisation;
10
13
  organisationId: number;
11
14
  createdDate: Date;
15
+ updatedDate: Date;
16
+ deletedDate: Date;
12
17
  }
@@ -17,13 +17,18 @@ const organisation_entity_1 = require("../../organisation/entities/organisation.
17
17
  let OrganisationSubscriptionRecord = class OrganisationSubscriptionRecord {
18
18
  id;
19
19
  uuid;
20
- stripeSubscriptionId;
21
- stripeCustomerId;
22
- stripePriceId;
20
+ productDisplayName;
21
+ paymentSystemTransactionId;
22
+ paymentSystemProductId;
23
+ paymentSystemCustomerId;
24
+ paymentSystemMode;
25
+ paymentSystemName;
23
26
  validUntil;
24
27
  organisation;
25
28
  organisationId;
26
29
  createdDate;
30
+ updatedDate;
31
+ deletedDate;
27
32
  };
28
33
  __decorate([
29
34
  (0, typeorm_1.PrimaryGeneratedColumn)(),
@@ -44,17 +49,32 @@ __decorate([
44
49
  (0, typeorm_1.Column)(),
45
50
  (0, swagger_1.ApiProperty)(),
46
51
  __metadata("design:type", String)
47
- ], OrganisationSubscriptionRecord.prototype, "stripeSubscriptionId", void 0);
52
+ ], OrganisationSubscriptionRecord.prototype, "productDisplayName", void 0);
48
53
  __decorate([
49
54
  (0, typeorm_1.Column)(),
50
55
  (0, swagger_1.ApiProperty)(),
51
56
  __metadata("design:type", String)
52
- ], OrganisationSubscriptionRecord.prototype, "stripeCustomerId", void 0);
57
+ ], OrganisationSubscriptionRecord.prototype, "paymentSystemTransactionId", void 0);
53
58
  __decorate([
54
59
  (0, typeorm_1.Column)(),
55
60
  (0, swagger_1.ApiProperty)(),
56
61
  __metadata("design:type", String)
57
- ], OrganisationSubscriptionRecord.prototype, "stripePriceId", void 0);
62
+ ], OrganisationSubscriptionRecord.prototype, "paymentSystemProductId", void 0);
63
+ __decorate([
64
+ (0, typeorm_1.Column)(),
65
+ (0, swagger_1.ApiProperty)(),
66
+ __metadata("design:type", String)
67
+ ], OrganisationSubscriptionRecord.prototype, "paymentSystemCustomerId", void 0);
68
+ __decorate([
69
+ (0, typeorm_1.Column)(),
70
+ (0, swagger_1.ApiProperty)(),
71
+ __metadata("design:type", String)
72
+ ], OrganisationSubscriptionRecord.prototype, "paymentSystemMode", void 0);
73
+ __decorate([
74
+ (0, typeorm_1.Column)(),
75
+ (0, swagger_1.ApiProperty)(),
76
+ __metadata("design:type", String)
77
+ ], OrganisationSubscriptionRecord.prototype, "paymentSystemName", void 0);
58
78
  __decorate([
59
79
  (0, typeorm_1.Column)(),
60
80
  (0, swagger_1.ApiProperty)(),
@@ -76,6 +96,16 @@ __decorate([
76
96
  (0, swagger_1.ApiProperty)(),
77
97
  __metadata("design:type", Date)
78
98
  ], OrganisationSubscriptionRecord.prototype, "createdDate", void 0);
99
+ __decorate([
100
+ (0, typeorm_1.UpdateDateColumn)(),
101
+ (0, swagger_1.ApiProperty)(),
102
+ __metadata("design:type", Date)
103
+ ], OrganisationSubscriptionRecord.prototype, "updatedDate", void 0);
104
+ __decorate([
105
+ (0, typeorm_1.DeleteDateColumn)(),
106
+ (0, swagger_1.ApiProperty)(),
107
+ __metadata("design:type", Date)
108
+ ], OrganisationSubscriptionRecord.prototype, "deletedDate", void 0);
79
109
  OrganisationSubscriptionRecord = __decorate([
80
110
  (0, typeorm_1.Entity)()
81
111
  ], OrganisationSubscriptionRecord);
@@ -1 +1 @@
1
- {"version":3,"file":"organisation-subscription.entity.js","sourceRoot":"","sources":["../../../src/organisation-subscriptions/entities/organisation-subscription.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA4C;AAC5C,yDAAuC;AAEvC,qCASiB;AACjB,yFAA6E;AAGtE,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IAGvC,EAAE,CAAU;IASL,IAAI,CAAU;IAIrB,oBAAoB,CAAU;IAI9B,gBAAgB,CAAU;IAI1B,aAAa,CAAU;IAKvB,UAAU,CAAQ;IAGlB,YAAY,CAAgB;IAKrB,cAAc,CAAU;IAI/B,WAAW,CAAQ;CACtB,CAAA;AAzCG;IAAC,IAAA,gCAAsB,GAAE;IACxB,IAAA,qBAAW,GAAE;;0DACF;AAEZ;IAAC,IAAA,gBAAM,EAAC,MAAM,EAAE;QACZ,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,GAAG,EAAE,CAAC,oBAAoB;KACtC,CAAC;IACD,IAAA,mBAAS,EAAC,MAAM,CAAC;IACjB,IAAA,qBAAW,GAAE;IACb,IAAA,eAAK,GAAE;;4DACa;AAErB;IAAC,IAAA,gBAAM,GAAE;IACR,IAAA,qBAAW,GAAE;;4EACgB;AAE9B;IAAC,IAAA,gBAAM,GAAE;IACR,IAAA,qBAAW,GAAE;;wEACY;AAE1B;IAAC,IAAA,gBAAM,GAAE;IACR,IAAA,qBAAW,GAAE;;qEACS;AAEvB;IAAC,IAAA,gBAAM,GAAE;IACR,IAAA,qBAAW,GAAE;IACb,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,IAAI,CAAC;8BACJ,IAAI;kEAAC;AAElB;IAAC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,kCAAY,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,mBAAmB,EAAE,EAAE,CAAC;8BACrD,kCAAY;oEAAC;AAE5B;IAAC,IAAA,qBAAW,GAAE;IACb,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAU,EAAC,CAAC,GAAmC,EAAE,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC;;sEACvC;AAE/B;IAAC,IAAA,0BAAgB,GAAE;IAClB,IAAA,qBAAW,GAAE;8BACA,IAAI;mEAAC;AAzCV,8BAA8B;IAD1C,IAAA,gBAAM,GAAE;GACI,8BAA8B,CA0C1C;AA1CY,wEAA8B"}
1
+ {"version":3,"file":"organisation-subscription.entity.js","sourceRoot":"","sources":["../../../src/organisation-subscriptions/entities/organisation-subscription.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA4C;AAC5C,yDAAuC;AAEvC,qCAWiB;AACjB,yFAA6E;AAGtE,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IAGvC,EAAE,CAAU;IASL,IAAI,CAAU;IAIrB,kBAAkB,CAAU;IAI5B,0BAA0B,CAAU;IAIpC,sBAAsB,CAAU;IAIhC,uBAAuB,CAAU;IAIjC,iBAAiB,CAAU;IA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CAAC;;sEACvC;AAE/B;IAAC,IAAA,0BAAgB,GAAE;IAClB,IAAA,qBAAW,GAAE;8BACA,IAAI;mEAAC;AAEnB;IAAC,IAAA,0BAAgB,GAAE;IAClB,IAAA,qBAAW,GAAE;8BACA,IAAI;mEAAC;AAEnB;IAAC,IAAA,0BAAgB,GAAE;IAClB,IAAA,qBAAW,GAAE;8BACA,IAAI;mEAAC;AA7DV,8BAA8B;IAD1C,IAAA,gBAAM,GAAE;GACI,8BAA8B,CA8D1C;AA9DY,wEAA8B"}
@@ -0,0 +1,10 @@
1
+ export declare class SaveOrganisationSubscriptionRecordDto {
2
+ productDisplayName: string;
3
+ paymentSystemTransactionId: string;
4
+ paymentSystemProductId: string;
5
+ millerPaymentReferenceUuid?: string;
6
+ paymentSystemCustomerId: string;
7
+ paymentSystemMode: string;
8
+ paymentSystemName: string;
9
+ validUntil: Date;
10
+ }
@@ -14,26 +14,51 @@ const swagger_1 = require("@nestjs/swagger");
14
14
  const class_transformer_1 = require("class-transformer");
15
15
  const class_validator_1 = require("class-validator");
16
16
  class SaveOrganisationSubscriptionRecordDto {
17
- stripeSubscriptionId;
18
- stripeCustomerId;
19
- stripePriceId;
17
+ productDisplayName;
18
+ paymentSystemTransactionId;
19
+ paymentSystemProductId;
20
+ millerPaymentReferenceUuid;
21
+ paymentSystemCustomerId;
22
+ paymentSystemMode;
23
+ paymentSystemName;
20
24
  validUntil;
21
25
  }
22
26
  __decorate([
23
27
  (0, swagger_1.ApiProperty)(),
24
28
  (0, class_validator_1.IsString)(),
25
29
  __metadata("design:type", String)
26
- ], SaveOrganisationSubscriptionRecordDto.prototype, "stripeSubscriptionId", void 0);
30
+ ], SaveOrganisationSubscriptionRecordDto.prototype, "productDisplayName", void 0);
27
31
  __decorate([
32
+ (0, class_validator_1.IsString)(),
33
+ (0, swagger_1.ApiProperty)(),
34
+ __metadata("design:type", String)
35
+ ], SaveOrganisationSubscriptionRecordDto.prototype, "paymentSystemTransactionId", void 0);
36
+ __decorate([
37
+ (0, class_validator_1.IsString)(),
28
38
  (0, swagger_1.ApiProperty)(),
39
+ __metadata("design:type", String)
40
+ ], SaveOrganisationSubscriptionRecordDto.prototype, "paymentSystemProductId", void 0);
41
+ __decorate([
29
42
  (0, class_validator_1.IsString)(),
43
+ (0, class_validator_1.IsOptional)(),
44
+ (0, swagger_1.ApiPropertyOptional)(),
30
45
  __metadata("design:type", String)
31
- ], SaveOrganisationSubscriptionRecordDto.prototype, "stripeCustomerId", void 0);
46
+ ], SaveOrganisationSubscriptionRecordDto.prototype, "millerPaymentReferenceUuid", void 0);
32
47
  __decorate([
48
+ (0, class_validator_1.IsString)(),
33
49
  (0, swagger_1.ApiProperty)(),
50
+ __metadata("design:type", String)
51
+ ], SaveOrganisationSubscriptionRecordDto.prototype, "paymentSystemCustomerId", void 0);
52
+ __decorate([
34
53
  (0, class_validator_1.IsString)(),
54
+ (0, swagger_1.ApiProperty)(),
55
+ __metadata("design:type", String)
56
+ ], SaveOrganisationSubscriptionRecordDto.prototype, "paymentSystemMode", void 0);
57
+ __decorate([
58
+ (0, class_validator_1.IsString)(),
59
+ (0, swagger_1.ApiProperty)(),
35
60
  __metadata("design:type", String)
36
- ], SaveOrganisationSubscriptionRecordDto.prototype, "stripePriceId", void 0);
61
+ ], SaveOrganisationSubscriptionRecordDto.prototype, "paymentSystemName", void 0);
37
62
  __decorate([
38
63
  (0, class_transformer_1.Transform)(({ value }) => new Date(value)),
39
64
  (0, class_transformer_1.Type)(() => Date),
@@ -42,4 +67,4 @@ __decorate([
42
67
  __metadata("design:type", Date)
43
68
  ], SaveOrganisationSubscriptionRecordDto.prototype, "validUntil", void 0);
44
69
  exports.SaveOrganisationSubscriptionRecordDto = SaveOrganisationSubscriptionRecordDto;
45
- //# sourceMappingURL=saveSubscriptionDto.js.map
70
+ //# sourceMappingURL=fulfillSubscriptionDto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fulfillSubscriptionDto.js","sourceRoot":"","sources":["../../../src/organisation-subscriptions/models/fulfillSubscriptionDto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAiE;AACjE,yDAAkD;AAClD,qDAA6D;AAE7D,MAAa,qCAAqC;IAG9C,kBAAkB,CAAU;IAI5B,0BAA0B,CAAU;IAIpC,sBAAsB,CAAU;IAKhC,0BAA0B,CAAU;IAIpC,uBAAuB,CAAU;IAIjC,iBAAiB,CAAU;IAI3B,iBAAiB,CAAU;IAM3B,UAAU,CAAQ;CACrB;AAlCG;IAAC,IAAA,qBAAW,GAAE;IACb,IAAA,0BAAQ,GAAE;;iFACiB;AAE5B;IAAC,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;yFACsB;AAEpC;IAAC,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;qFACkB;AAEhC;IAAC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,6BAAmB,GAAE;;yFACc;AAEpC;IAAC,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;sFACmB;AAEjC;IAAC,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;gFACa;AAE3B;IAAC,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;gFACa;AAE3B;IAAC,IAAA,6BAAS,EAAC,CAAC,EAAC,KAAK,EAAC,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,KAAe,CAAC,CAAC;IACjD,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,IAAI,CAAC;IAChB,IAAA,wBAAM,GAAE;IACR,IAAA,qBAAW,EAAC,EAAC,IAAI,EAAE,IAAI,EAAC,CAAC;8BACb,IAAI;yEAAC;AAlCtB,sFAmCC"}
@@ -1,12 +1,11 @@
1
1
  import { RequestWithUser } from "../authz/RequestWithUser";
2
2
  import { OrganisationSubscriptionRecord } from "./entities/organisation-subscription.entity";
3
3
  import { OrganisationSubscriptionService } from "./organisation-subscriptions.service";
4
- import { SaveOrganisationSubscriptionRecordDto } from "./models/saveSubscriptionDto";
4
+ import { SaveOrganisationSubscriptionRecordDto } from "./models/fulfillSubscriptionDto";
5
5
  export declare class OrganisationSubscriptionsController {
6
6
  private readonly osrService;
7
7
  constructor(osrService: OrganisationSubscriptionService);
8
8
  findAll(orgUuid: string, request: RequestWithUser): Promise<OrganisationSubscriptionRecord[]>;
9
- addSubscription(orgUuid: string, body: SaveOrganisationSubscriptionRecordDto): Promise<OrganisationSubscriptionRecord>;
10
- updateSubscription(subUuid: string, orgUuid: string, body: SaveOrganisationSubscriptionRecordDto): Promise<OrganisationSubscriptionRecord>;
9
+ addSubscription(orgUuid: string, body: SaveOrganisationSubscriptionRecordDto[]): Promise<OrganisationSubscriptionRecord[]>;
11
10
  deleteSubscription(orgUuid: string, uuid: string): Promise<boolean>;
12
11
  }
@@ -20,7 +20,6 @@ const passport_1 = require("@nestjs/passport");
20
20
  const organisation_subscription_entity_1 = require("./entities/organisation-subscription.entity");
21
21
  const organisation_subscriptions_service_1 = require("./organisation-subscriptions.service");
22
22
  const authz_1 = require("../authz");
23
- const saveSubscriptionDto_1 = require("./models/saveSubscriptionDto");
24
23
  let OrganisationSubscriptionsController = class OrganisationSubscriptionsController {
25
24
  osrService;
26
25
  constructor(osrService) {
@@ -30,10 +29,7 @@ let OrganisationSubscriptionsController = class OrganisationSubscriptionsControl
30
29
  return this.osrService.findAllForOwnerOfOrg(orgUuid, request.user.id);
31
30
  }
32
31
  async addSubscription(orgUuid, body) {
33
- return this.osrService.create(body, orgUuid);
34
- }
35
- async updateSubscription(subUuid, orgUuid, body) {
36
- return this.osrService.update(subUuid, body, orgUuid);
32
+ return this.osrService.save(body);
37
33
  }
38
34
  async deleteSubscription(orgUuid, uuid) {
39
35
  return this.osrService.delete(uuid);
@@ -55,20 +51,9 @@ __decorate([
55
51
  __param(0, (0, common_1.Param)("orgUuid")),
56
52
  __param(1, (0, common_1.Body)()),
57
53
  __metadata("design:type", Function),
58
- __metadata("design:paramtypes", [String, saveSubscriptionDto_1.SaveOrganisationSubscriptionRecordDto]),
54
+ __metadata("design:paramtypes", [String, Array]),
59
55
  __metadata("design:returntype", Promise)
60
56
  ], OrganisationSubscriptionsController.prototype, "addSubscription", null);
61
- __decorate([
62
- (0, authz_1.MandatoryUserClaims)("modify:all"),
63
- (0, common_1.Put)(":uuid"),
64
- (0, swagger_1.ApiOkResponse)({ type: organisation_subscription_entity_1.OrganisationSubscriptionRecord }),
65
- __param(0, (0, common_1.Param)("uuid")),
66
- __param(1, (0, common_1.Param)("orgUuid")),
67
- __param(2, (0, common_1.Body)()),
68
- __metadata("design:type", Function),
69
- __metadata("design:paramtypes", [String, String, saveSubscriptionDto_1.SaveOrganisationSubscriptionRecordDto]),
70
- __metadata("design:returntype", Promise)
71
- ], OrganisationSubscriptionsController.prototype, "updateSubscription", null);
72
57
  __decorate([
73
58
  (0, authz_1.MandatoryUserClaims)("modify:all"),
74
59
  (0, common_1.Delete)(":uuid"),
@@ -1 +1 @@
1
- {"version":3,"file":"organisation-subscriptions.controller.js","sourceRoot":"","sources":["../../src/organisation-subscriptions/organisation-subscriptions.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAAgD;AAChD,2CAUwB;AACxB,6CAAsE;AACtE,+CAA2C;AAE3C,kGAA2F;AAC3F,6FAAqF;AACrF,oCAAuE;AACvE,sEAAmF;AAM5E,IAAM,mCAAmC,GAAzC,MAAM,mCAAmC;IACf;IAA7B,YAA6B,UAA2C;QAA3C,eAAU,GAAV,UAAU,CAAiC;IAAG,CAAC;IAItE,AAAN,KAAK,CAAC,OAAO,CACS,OAAe,EACtB,OAAwB;QAEnC,OAAO,IAAI,CAAC,UAAU,CAAC,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1E,CAAC;IAKK,AAAN,KAAK,CAAC,eAAe,CACC,OAAe,EACzB,IAA2C;QAEnD,OAAO,IAAI,CAAC,UAAU,CAAC,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,IAAI,EAAE,OAAO,EAAC,CAAC;IAE1B,WAAA,IAAA,cAAK,EAAC,SAAS,CAAC,CAAA;IAChB,WAAA,IAAA,cAAK,EAAC,MAAM,CAAC,CAAA;;;;6EAGjB;AAxCQ,mCAAmC;IAJ/C,IAAA,kBAAS,EAAC,IAAA,oBAAS,EAAC,KAAK,CAAC,EAAE,gCAAwB,CAAC;IACrD,IAAA,uBAAa,GAAE;IACf,IAAA,mBAAU,EAAC,qCAAqC,CAAC;IACjD,IAAA,iBAAO,EAAC,4BAA4B,CAAC;qCAEO,oEAA+B;GAD/D,mCAAmC,CAyC/C;AAzCY,kFAAmC"}
1
+ {"version":3,"file":"organisation-subscriptions.controller.js","sourceRoot":"","sources":["../../src/organisation-subscriptions/organisation-subscriptions.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAAgD;AAChD,2CASwB;AACxB,6CAAsE;AACtE,+CAA2C;AAE3C,kGAA2F;AAC3F,6FAAqF;AACrF,oCAAuE;AAOhE,IAAM,mCAAmC,GAAzC,MAAM,mCAAmC;IACf;IAA7B,YAA6B,UAA2C;QAA3C,eAAU,GAAV,UAAU,CAAiC;IAAG,CAAC;IAItE,AAAN,KAAK,CAAC,OAAO,CACS,OAAe,EACtB,OAAwB;QAEnC,OAAO,IAAI,CAAC,UAAU,CAAC,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1E,CAAC;IAKK,AAAN,KAAK,CAAC,eAAe,CACC,OAAe,EACzB,IAA6C;QAErD,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAKK,AAAN,KAAK,CAAC,kBAAkB,CACF,OAAe,EAClB,IAAY;QAE3B,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;CACJ,CAAA;AA1BS;IAFL,IAAA,YAAG,GAAE;IACL,IAAA,uBAAa,EAAC,EAAC,IAAI,EAAE,CAAC,iEAA8B,CAAC,EAAC,CAAC;IAEnD,WAAA,IAAA,cAAK,EAAC,SAAS,CAAC,CAAA;IAChB,WAAA,IAAA,gBAAO,GAAE,CAAA;;;;kEAGb;AAKK;IAHL,IAAA,2BAAmB,EAAC,YAAY,CAAC;IACjC,IAAA,aAAI,GAAE;IACN,IAAA,uBAAa,EAAC,EAAC,IAAI,EAAE,iEAA8B,EAAC,CAAC;IAEjD,WAAA,IAAA,cAAK,EAAC,SAAS,CAAC,CAAA;IAChB,WAAA,IAAA,aAAI,GAAE,CAAA;;;;0EAGV;AAKK;IAHL,IAAA,2BAAmB,EAAC,YAAY,CAAC;IACjC,IAAA,eAAM,EAAC,OAAO,CAAC;IACf,IAAA,uBAAa,EAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;IAE1B,WAAA,IAAA,cAAK,EAAC,SAAS,CAAC,CAAA;IAChB,WAAA,IAAA,cAAK,EAAC,MAAM,CAAC,CAAA;;;;6EAGjB;AA9BQ,mCAAmC;IAJ/C,IAAA,kBAAS,EAAC,IAAA,oBAAS,EAAC,KAAK,CAAC,EAAE,gCAAwB,CAAC;IACrD,IAAA,uBAAa,GAAE;IACf,IAAA,mBAAU,EAAC,qCAAqC,CAAC;IACjD,IAAA,iBAAO,EAAC,4BAA4B,CAAC;qCAEO,oEAA+B;GAD/D,mCAAmC,CA+B/C;AA/BY,kFAAmC"}
@@ -1,14 +1,18 @@
1
1
  import { Repository } from "typeorm";
2
+ import CoreLoggerService from "../logger/CoreLoggerService";
2
3
  import { Organisation } from "../organisation/entities/organisation.entity";
4
+ import { PaymentSessionService } from "../payment-sessions/payment-session.service";
3
5
  import { OrganisationSubscriptionRecord } from "./entities/organisation-subscription.entity";
4
- import { SaveOrganisationSubscriptionRecordDto } from "./models/saveSubscriptionDto";
6
+ import { SaveOrganisationSubscriptionRecordDto } from "./models/fulfillSubscriptionDto";
5
7
  export declare class OrganisationSubscriptionService {
8
+ private readonly logger;
6
9
  private orgRepo;
7
10
  private orgSubRepository;
8
- constructor(orgRepo: Repository<Organisation>, orgSubRepository: Repository<OrganisationSubscriptionRecord>);
11
+ private readonly paymentSessionService;
12
+ constructor(logger: CoreLoggerService, orgRepo: Repository<Organisation>, orgSubRepository: Repository<OrganisationSubscriptionRecord>, paymentSessionService: PaymentSessionService);
9
13
  private notFoundMessage;
10
14
  findAllForOwnerOfOrg(orgUuid: string, currentUserId: number): Promise<OrganisationSubscriptionRecord[]>;
11
- create(subRecord: SaveOrganisationSubscriptionRecordDto, orgUuid: string): Promise<OrganisationSubscriptionRecord>;
12
- update(subUuid: string, subRecord: SaveOrganisationSubscriptionRecordDto, orgUuid: string): Promise<OrganisationSubscriptionRecord>;
15
+ findAllForOrg(orgUuid: string): Promise<OrganisationSubscriptionRecord[]>;
16
+ save(subRecordDtoCollection: SaveOrganisationSubscriptionRecordDto[]): Promise<OrganisationSubscriptionRecord[]>;
13
17
  delete(subUuid: string): Promise<boolean>;
14
18
  }
@@ -11,20 +11,29 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
+ var __importDefault = (this && this.__importDefault) || function (mod) {
15
+ return (mod && mod.__esModule) ? mod : { "default": mod };
16
+ };
14
17
  Object.defineProperty(exports, "__esModule", { value: true });
15
18
  exports.OrganisationSubscriptionService = void 0;
16
19
  const common_1 = require("@nestjs/common");
17
20
  const typeorm_1 = require("@nestjs/typeorm");
18
21
  const typeorm_2 = require("typeorm");
22
+ const CoreLoggerService_1 = __importDefault(require("../logger/CoreLoggerService"));
19
23
  const RolesEnum_1 = require("../organisation/dto/RolesEnum");
20
24
  const organisation_entity_1 = require("../organisation/entities/organisation.entity");
25
+ const payment_session_service_1 = require("../payment-sessions/payment-session.service");
21
26
  const organisation_subscription_entity_1 = require("./entities/organisation-subscription.entity");
22
27
  let OrganisationSubscriptionService = class OrganisationSubscriptionService {
28
+ logger;
23
29
  orgRepo;
24
30
  orgSubRepository;
25
- constructor(orgRepo, orgSubRepository) {
31
+ paymentSessionService;
32
+ constructor(logger, orgRepo, orgSubRepository, paymentSessionService) {
33
+ this.logger = logger;
26
34
  this.orgRepo = orgRepo;
27
35
  this.orgSubRepository = orgSubRepository;
36
+ this.paymentSessionService = paymentSessionService;
28
37
  }
29
38
  notFoundMessage = "Organisation not found or you are not owner of it";
30
39
  async findAllForOwnerOfOrg(orgUuid, currentUserId) {
@@ -48,47 +57,55 @@ let OrganisationSubscriptionService = class OrganisationSubscriptionService {
48
57
  }
49
58
  return org.subscriptionRecords;
50
59
  }
51
- async create(subRecord, orgUuid) {
52
- // find the org
60
+ async findAllForOrg(orgUuid) {
61
+ // find the org if the user is owner
53
62
  const org = await this.orgRepo.findOne({
54
63
  where: {
55
64
  uuid: orgUuid,
56
65
  },
57
- });
58
- if (!org) {
59
- throw new common_1.NotFoundException(this.notFoundMessage);
60
- }
61
- const sub = this.orgSubRepository.create();
62
- sub.organisationId = org.id;
63
- sub.stripeCustomerId = subRecord.stripeCustomerId;
64
- sub.stripePriceId = subRecord.stripePriceId;
65
- sub.stripeSubscriptionId = subRecord.stripeSubscriptionId;
66
- sub.validUntil = subRecord.validUntil;
67
- return this.orgSubRepository.save(sub);
68
- }
69
- async update(subUuid, subRecord, orgUuid) {
70
- const org = await this.orgRepo.findOne({
71
- where: {
72
- uuid: orgUuid,
66
+ relations: {
67
+ subscriptionRecords: true,
73
68
  },
74
69
  });
75
70
  if (!org) {
76
71
  throw new common_1.NotFoundException(this.notFoundMessage);
77
72
  }
78
- const sub = await this.orgSubRepository.findOne({
79
- where: {
80
- uuid: subUuid,
81
- },
82
- });
83
- if (!sub) {
84
- throw new common_1.NotFoundException(this.notFoundMessage);
73
+ return org.subscriptionRecords;
74
+ }
75
+ async save(subRecordDtoCollection) {
76
+ const results = [];
77
+ for (const subRecord of subRecordDtoCollection) {
78
+ let sub = await this.orgSubRepository.findOne({
79
+ where: {
80
+ paymentSystemTransactionId: subRecord.paymentSystemTransactionId,
81
+ },
82
+ });
83
+ if (!sub) {
84
+ if (!subRecord.millerPaymentReferenceUuid) {
85
+ this.logger.error("Payment reference uuid not found. Cannot match this payment to a customer", subRecord);
86
+ throw new common_1.NotFoundException("Payment reference uuid not found. Cannot match this payment to a customer");
87
+ }
88
+ const paymentReference = await this.paymentSessionService.findSessionByUuid(subRecord.millerPaymentReferenceUuid);
89
+ const org = await this.orgRepo.findOne({
90
+ where: {
91
+ uuid: paymentReference?.organisationUuid,
92
+ },
93
+ });
94
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
95
+ sub = this.orgSubRepository.create({ organisation: org });
96
+ }
97
+ sub.paymentSystemMode = subRecord.paymentSystemMode;
98
+ sub.paymentSystemCustomerId = subRecord.paymentSystemCustomerId;
99
+ sub.paymentSystemName = subRecord.paymentSystemName;
100
+ sub.paymentSystemProductId = subRecord.paymentSystemProductId;
101
+ sub.paymentSystemTransactionId =
102
+ subRecord.paymentSystemTransactionId;
103
+ sub.validUntil = subRecord.validUntil;
104
+ sub.productDisplayName = subRecord.productDisplayName;
105
+ const result = await this.orgSubRepository.save(sub);
106
+ results.push(result);
85
107
  }
86
- sub.organisationId = org.id;
87
- sub.stripeCustomerId = subRecord.stripeCustomerId;
88
- sub.stripePriceId = subRecord.stripePriceId;
89
- sub.stripeSubscriptionId = subRecord.stripeSubscriptionId;
90
- sub.validUntil = subRecord.validUntil;
91
- return this.orgSubRepository.save(sub);
108
+ return results;
92
109
  }
93
110
  async delete(subUuid) {
94
111
  const result = await this.orgSubRepository.delete({
@@ -101,10 +118,12 @@ let OrganisationSubscriptionService = class OrganisationSubscriptionService {
101
118
  };
102
119
  OrganisationSubscriptionService = __decorate([
103
120
  (0, common_1.Injectable)(),
104
- __param(0, (0, typeorm_1.InjectRepository)(organisation_entity_1.Organisation)),
105
- __param(1, (0, typeorm_1.InjectRepository)(organisation_subscription_entity_1.OrganisationSubscriptionRecord)),
106
- __metadata("design:paramtypes", [typeorm_2.Repository,
107
- typeorm_2.Repository])
121
+ __param(1, (0, typeorm_1.InjectRepository)(organisation_entity_1.Organisation)),
122
+ __param(2, (0, typeorm_1.InjectRepository)(organisation_subscription_entity_1.OrganisationSubscriptionRecord)),
123
+ __metadata("design:paramtypes", [CoreLoggerService_1.default,
124
+ typeorm_2.Repository,
125
+ typeorm_2.Repository,
126
+ payment_session_service_1.PaymentSessionService])
108
127
  ], OrganisationSubscriptionService);
109
128
  exports.OrganisationSubscriptionService = OrganisationSubscriptionService;
110
129
  //# sourceMappingURL=organisation-subscriptions.service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"organisation-subscriptions.service.js","sourceRoot":"","sources":["../../src/organisation-subscriptions/organisation-subscriptions.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA6D;AAC7D,6CAAiD;AACjD,qCAAmC;AACnC,6DAAoD;AACpD,sFAA0E;AAC1E,kGAA2F;AAIpF,IAAM,+BAA+B,GAArC,MAAM,+BAA+B;IAG5B;IAEA;IAJZ,YAEY,OAAiC,EAEjC,gBAA4D;QAF5D,YAAO,GAAP,OAAO,CAA0B;QAEjC,qBAAgB,GAAhB,gBAAgB,CAA4C;IACrE,CAAC;IACI,eAAe,GACnB,mDAAmD,CAAC;IACxD,KAAK,CAAC,oBAAoB,CACtB,OAAe,EACf,aAAqB;QAErB,oCAAoC;QACpC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;YACnC,KAAK,EAAE;gBACH,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE;oBACT,QAAQ,EAAE,aAAa;oBACvB,KAAK,EAAE;wBACH,IAAI,EAAE,iBAAK,CAAC,KAAK;qBACpB;iBACJ;aACJ;YACD,SAAS,EAAE;gBACP,mBAAmB,EAAE,IAAI;aAC5B;SACJ,CAAC,CAAC;QACH,IAAI,CAAC,GAAG,EAAE;YACN,MAAM,IAAI,0BAAiB,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C;QACH,IAAI,CAAC,GAAG,EAAE;YACN,MAAM,IAAI,0BAAiB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;SACrD;QACD,GAAG,CAAC,cAAc,GAAG,GAAG,CAAC,EAAE,CAAC;QAC5B,GAAG,CAAC,gBAAgB,GAAG,SAAS,CAAC,gBAAgB,CAAC;QAClD,GAAG,CAAC,aAAa,GAAG,SAAS,CAAC,aAAa,CAAC;QAC5C,GAAG,CAAC,oBAAoB,GAAG,SAAS,CAAC,oBAAoB,CAAC;QAC1D,GAAG,CAAC,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC;QAEtC,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,OAAe;QACxB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC;YAC9C,IAAI,EAAE,OAAO;SAChB,CAAC,CAAC;QAEH,OAAO,CACH,MAAM,CAAC,QAAQ,KAAK,SAAS;YAC7B,MAAM,CAAC,QAAQ,KAAK,IAAI;YACxB,MAAM,CAAC,QAAQ,GAAG,CAAC,CACtB,CAAC;IACN,CAAC;CACJ,CAAA;AApGY,+BAA+B;IAD3C,IAAA,mBAAU,GAAE;IAGJ,WAAA,IAAA,0BAAgB,EAAC,kCAAY,CAAC,CAAA;IAE9B,WAAA,IAAA,0BAAgB,EAAC,iEAA8B,CAAC,CAAA;qCADhC,oBAAU;QAED,oBAAU;GAL/B,+BAA+B,CAoG3C;AApGY,0EAA+B"}
1
+ {"version":3,"file":"organisation-subscriptions.service.js","sourceRoot":"","sources":["../../src/organisation-subscriptions/organisation-subscriptions.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAA6D;AAC7D,6CAAiD;AACjD,qCAAmC;AACnC,oFAA4D;AAC5D,6DAAoD;AACpD,sFAA0E;AAC1E,yFAAkF;AAClF,kGAA2F;AAIpF,I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AC;YAEtD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACrD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SACxB;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,OAAe;QACxB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC;YAC9C,IAAI,EAAE,OAAO;SAChB,CAAC,CAAC;QAEH,OAAO,CACH,MAAM,CAAC,QAAQ,KAAK,SAAS;YAC7B,MAAM,CAAC,QAAQ,KAAK,IAAI;YACxB,MAAM,CAAC,QAAQ,GAAG,CAAC,CACtB,CAAC;IACN,CAAC;CACJ,CAAA;AAtHY,+BAA+B;IAD3C,IAAA,mBAAU,GAAE;IAIJ,WAAA,IAAA,0BAAgB,EAAC,kCAAY,CAAC,CAAA;IAE9B,WAAA,IAAA,0BAAgB,EAAC,iEAA8B,CAAC,CAAA;qCAHxB,2BAAiB;QAEzB,oBAAU;QAED,oBAAU;QACI,+CAAqB;GAPxD,+BAA+B,CAsH3C;AAtHY,0EAA+B"}
@@ -0,0 +1,7 @@
1
+ export declare class PaymentSessionReference {
2
+ id: number;
3
+ uuid: string;
4
+ createdDate: Date;
5
+ organisationUuid?: string;
6
+ personUuid: string;
7
+ }
@@ -0,0 +1,54 @@
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 __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.PaymentSessionReference = void 0;
13
+ const swagger_1 = require("@nestjs/swagger");
14
+ const typeorm_1 = require("typeorm");
15
+ let PaymentSessionReference = class PaymentSessionReference {
16
+ id;
17
+ uuid;
18
+ createdDate;
19
+ organisationUuid;
20
+ personUuid;
21
+ };
22
+ __decorate([
23
+ (0, typeorm_1.PrimaryGeneratedColumn)(),
24
+ (0, swagger_1.ApiProperty)(),
25
+ __metadata("design:type", Number)
26
+ ], PaymentSessionReference.prototype, "id", void 0);
27
+ __decorate([
28
+ (0, typeorm_1.Column)("uuid", {
29
+ name: "uuid",
30
+ default: () => "uuid_generate_v4()",
31
+ }),
32
+ (0, typeorm_1.Generated)("uuid"),
33
+ (0, swagger_1.ApiProperty)(),
34
+ (0, typeorm_1.Index)(),
35
+ __metadata("design:type", String)
36
+ ], PaymentSessionReference.prototype, "uuid", void 0);
37
+ __decorate([
38
+ (0, typeorm_1.CreateDateColumn)(),
39
+ (0, swagger_1.ApiProperty)(),
40
+ __metadata("design:type", Date)
41
+ ], PaymentSessionReference.prototype, "createdDate", void 0);
42
+ __decorate([
43
+ (0, typeorm_1.Column)({ nullable: true }),
44
+ __metadata("design:type", String)
45
+ ], PaymentSessionReference.prototype, "organisationUuid", void 0);
46
+ __decorate([
47
+ (0, typeorm_1.Column)(),
48
+ __metadata("design:type", String)
49
+ ], PaymentSessionReference.prototype, "personUuid", void 0);
50
+ PaymentSessionReference = __decorate([
51
+ (0, typeorm_1.Entity)()
52
+ ], PaymentSessionReference);
53
+ exports.PaymentSessionReference = PaymentSessionReference;
54
+ //# sourceMappingURL=payment-session.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payment-session.entity.js","sourceRoot":"","sources":["../../src/payment-sessions/payment-session.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA4C;AAC5C,qCAOiB;AAGV,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAGhC,EAAE,CAAU;IASL,IAAI,CAAU;IAIrB,WAAW,CAAQ;IAGnB,gBAAgB,CAAU;IAG1B,UAAU,CAAU;CACvB,CAAA;AAtBG;IAAC,IAAA,gCAAsB,GAAE;IACxB,IAAA,qBAAW,GAAE;;mDACF;AAEZ;IAAC,IAAA,gBAAM,EAAC,MAAM,EAAE;QACZ,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,GAAG,EAAE,CAAC,oBAAoB;KACtC,CAAC;IACD,IAAA,mBAAS,EAAC,MAAM,CAAC;IACjB,IAAA,qBAAW,GAAE;IACb,IAAA,eAAK,GAAE;;qDACa;AAErB;IAAC,IAAA,0BAAgB,GAAE;IAClB,IAAA,qBAAW,GAAE;8BACA,IAAI;4DAAC;AAEnB;IAAC,IAAA,gBAAM,EAAC,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;;iEACC;AAE1B;IAAC,IAAA,gBAAM,GAAE;;2DACW;AAtBX,uBAAuB;IADnC,IAAA,gBAAM,GAAE;GACI,uBAAuB,CAuBnC;AAvBY,0DAAuB"}
@@ -0,0 +1,2 @@
1
+ export declare class PaymentSessionModule {
2
+ }
@@ -0,0 +1,26 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.PaymentSessionModule = void 0;
10
+ const common_1 = require("@nestjs/common");
11
+ const core_app_module_1 = require("../root-app/core-app.module");
12
+ const typeorm_1 = require("@nestjs/typeorm");
13
+ const payment_session_entity_1 = require("./payment-session.entity");
14
+ const payment_session_service_1 = require("./payment-session.service");
15
+ let PaymentSessionModule = class PaymentSessionModule {
16
+ };
17
+ PaymentSessionModule = __decorate([
18
+ (0, common_1.Module)({
19
+ imports: [typeorm_1.TypeOrmModule.forFeature([payment_session_entity_1.PaymentSessionReference]), core_app_module_1.CoreModule],
20
+ providers: [payment_session_service_1.PaymentSessionService],
21
+ exports: [payment_session_service_1.PaymentSessionService],
22
+ controllers: [],
23
+ })
24
+ ], PaymentSessionModule);
25
+ exports.PaymentSessionModule = PaymentSessionModule;
26
+ //# sourceMappingURL=payment-session.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payment-session.module.js","sourceRoot":"","sources":["../../src/payment-sessions/payment-session.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAsC;AACtC,iEAAuD;AACvD,6CAA8C;AAC9C,qEAAiE;AACjE,uEAAgE;AAQzD,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;CAAG,CAAA;AAAvB,oBAAoB;IANhC,IAAA,eAAM,EAAC;QACJ,OAAO,EAAE,CAAC,uBAAa,CAAC,UAAU,CAAC,CAAC,gDAAuB,CAAC,CAAC,EAAE,4BAAU,CAAC;QAC1E,SAAS,EAAE,CAAC,+CAAqB,CAAC;QAClC,OAAO,EAAE,CAAC,+CAAqB,CAAC;QAChC,WAAW,EAAE,EAAE;KAClB,CAAC;GACW,oBAAoB,CAAG;AAAvB,oDAAoB"}
@@ -0,0 +1,11 @@
1
+ import { Repository } from "typeorm";
2
+ import { PaymentSessionReference } from "./payment-session.entity";
3
+ export declare class PaymentSessionService {
4
+ private paymentReferenceRepository;
5
+ constructor(paymentReferenceRepository: Repository<PaymentSessionReference>);
6
+ findSessionByUuid(uuid: string): Promise<PaymentSessionReference | undefined>;
7
+ createSession(parameters: {
8
+ organisationUuid?: string;
9
+ personUuid?: string;
10
+ }): Promise<PaymentSessionReference>;
11
+ }
@@ -0,0 +1,51 @@
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 __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.PaymentSessionService = void 0;
16
+ /* eslint-disable @typescript-eslint/naming-convention */
17
+ const common_1 = require("@nestjs/common");
18
+ const typeorm_1 = require("@nestjs/typeorm");
19
+ const typeorm_2 = require("typeorm");
20
+ const payment_session_entity_1 = require("./payment-session.entity");
21
+ let PaymentSessionService = class PaymentSessionService {
22
+ paymentReferenceRepository;
23
+ constructor(paymentReferenceRepository) {
24
+ this.paymentReferenceRepository = paymentReferenceRepository;
25
+ }
26
+ async findSessionByUuid(uuid) {
27
+ const result = await this.paymentReferenceRepository.findOne({
28
+ where: {
29
+ uuid,
30
+ },
31
+ });
32
+ if (!result) {
33
+ return undefined;
34
+ }
35
+ return result;
36
+ }
37
+ async createSession(parameters) {
38
+ const paymentReference = this.paymentReferenceRepository.create({
39
+ organisationUuid: parameters.organisationUuid,
40
+ personUuid: parameters.personUuid,
41
+ });
42
+ return await this.paymentReferenceRepository.save(paymentReference);
43
+ }
44
+ };
45
+ PaymentSessionService = __decorate([
46
+ (0, common_1.Injectable)(),
47
+ __param(0, (0, typeorm_1.InjectRepository)(payment_session_entity_1.PaymentSessionReference)),
48
+ __metadata("design:paramtypes", [typeorm_2.Repository])
49
+ ], PaymentSessionService);
50
+ exports.PaymentSessionService = PaymentSessionService;
51
+ //# sourceMappingURL=payment-session.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payment-session.service.js","sourceRoot":"","sources":["../../src/payment-sessions/payment-session.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yDAAyD;AACzD,2CAA0C;AAC1C,6CAAiD;AACjD,qCAAmC;AACnC,qEAAiE;AAG1D,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAGlB;IAFZ,YAEY,0BAA+D;QAA/D,+BAA0B,GAA1B,0BAA0B,CAAqC;IACxE,CAAC;IAEJ,KAAK,CAAC,iBAAiB,CACnB,IAAY;QAEZ,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,0BAA0B,CAAC,OAAO,CAAC;YACzD,KAAK,EAAE;gBACH,IAAI;aACP;SACJ,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,EAAE;YACT,OAAO,SAAS,CAAC;SACpB;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IACD,KAAK,CAAC,aAAa,CAAC,UAGnB;QACG,MAAM,gBAAgB,GAAG,IAAI,CAAC,0BAA0B,CAAC,MAAM,CAAC;YAC5D,gBAAgB,EAAE,UAAU,CAAC,gBAAgB;YAC7C,UAAU,EAAE,UAAU,CAAC,UAAU;SACpC,CAAC,CAAC;QAEH,OAAO,MAAM,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACxE,CAAC;CACJ,CAAA;AAhCY,qBAAqB;IADjC,IAAA,mBAAU,GAAE;IAGJ,WAAA,IAAA,0BAAgB,EAAC,gDAAuB,CAAC,CAAA;qCACN,oBAAU;GAHzC,qBAAqB,CAgCjC;AAhCY,sDAAqB"}
@@ -1,7 +1,7 @@
1
1
  export declare class StripeCheckoutEvent {
2
2
  id: number;
3
3
  createdDate: Date;
4
- userUuid?: string;
4
+ clientReferenceId?: string;
5
5
  stripeSessionId: string;
6
6
  stripeObjectType: string;
7
7
  stripeData: any;