@puzzlin/models 3.0.0 → 3.1.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.
@@ -1,4 +1,5 @@
1
1
  export * from './order-line-item.object';
2
2
  export * from './order.object';
3
+ export * from './transaction-amounts.object';
3
4
  export * from './transaction.object';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/models/orders/objects/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/models/orders/objects/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC"}
@@ -16,5 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./order-line-item.object"), exports);
18
18
  __exportStar(require("./order.object"), exports);
19
+ __exportStar(require("./transaction-amounts.object"), exports);
19
20
  __exportStar(require("./transaction.object"), exports);
20
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/orders/objects/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC;AACzC,iDAA+B;AAC/B,uDAAqC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/orders/objects/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC;AACzC,iDAA+B;AAC/B,+DAA6C;AAC7C,uDAAqC"}
@@ -0,0 +1,11 @@
1
+ export declare class TransactionAmounts {
2
+ discount?: number;
3
+ platformFee?: number;
4
+ providerFee?: number;
5
+ refund?: number;
6
+ shipping?: number;
7
+ subtotal: number;
8
+ tax?: number;
9
+ total?: number;
10
+ }
11
+ //# sourceMappingURL=transaction-amounts.object.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction-amounts.object.d.ts","sourceRoot":"","sources":["../../../../src/models/orders/objects/transaction-amounts.object.ts"],"names":[],"mappings":"AAGA,qBACa,kBAAkB;IAK7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAMlB,WAAW,CAAC,EAAE,MAAM,CAAC;IAMrB,WAAW,CAAC,EAAE,MAAM,CAAC;IAMrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAKhB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAKlB,QAAQ,EAAE,MAAM,CAAC;IAKjB,GAAG,CAAC,EAAE,MAAM,CAAC;IAMb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
@@ -0,0 +1,74 @@
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.TransactionAmounts = void 0;
13
+ const graphql_1 = require("@nestjs/graphql");
14
+ const graphql_scalars_1 = require("graphql-scalars");
15
+ let TransactionAmounts = class TransactionAmounts {
16
+ };
17
+ exports.TransactionAmounts = TransactionAmounts;
18
+ __decorate([
19
+ (0, graphql_1.Field)(() => graphql_scalars_1.PositiveIntResolver, {
20
+ description: 'Total discount applied to subtotal.',
21
+ nullable: true,
22
+ }),
23
+ __metadata("design:type", Number)
24
+ ], TransactionAmounts.prototype, "discount", void 0);
25
+ __decorate([
26
+ (0, graphql_1.Field)(() => graphql_scalars_1.PositiveIntResolver, {
27
+ description: 'The total platform fee including payment fee and product fee.',
28
+ nullable: true,
29
+ }),
30
+ __metadata("design:type", Number)
31
+ ], TransactionAmounts.prototype, "platformFee", void 0);
32
+ __decorate([
33
+ (0, graphql_1.Field)(() => graphql_scalars_1.PositiveIntResolver, {
34
+ description: 'Total payment provider fee amount for a transaction. Known only after payment succeeds.',
35
+ nullable: true,
36
+ }),
37
+ __metadata("design:type", Number)
38
+ ], TransactionAmounts.prototype, "providerFee", void 0);
39
+ __decorate([
40
+ (0, graphql_1.Field)(() => graphql_scalars_1.PositiveIntResolver, {
41
+ description: 'The total amount refunded.',
42
+ nullable: true,
43
+ }),
44
+ __metadata("design:type", Number)
45
+ ], TransactionAmounts.prototype, "refund", void 0);
46
+ __decorate([
47
+ (0, graphql_1.Field)(() => graphql_scalars_1.PositiveIntResolver, {
48
+ nullable: true,
49
+ }),
50
+ __metadata("design:type", Number)
51
+ ], TransactionAmounts.prototype, "shipping", void 0);
52
+ __decorate([
53
+ (0, graphql_1.Field)(() => graphql_scalars_1.PositiveIntResolver, {
54
+ description: 'The total of all items or services before taxes or discounts.',
55
+ }),
56
+ __metadata("design:type", Number)
57
+ ], TransactionAmounts.prototype, "subtotal", void 0);
58
+ __decorate([
59
+ (0, graphql_1.Field)(() => graphql_scalars_1.PositiveIntResolver, {
60
+ nullable: true,
61
+ }),
62
+ __metadata("design:type", Number)
63
+ ], TransactionAmounts.prototype, "tax", void 0);
64
+ __decorate([
65
+ (0, graphql_1.Field)(() => graphql_scalars_1.PositiveIntResolver, {
66
+ description: 'The final amount to be paid. Total = subtotal - discount + tax + shipping.',
67
+ nullable: true,
68
+ }),
69
+ __metadata("design:type", Number)
70
+ ], TransactionAmounts.prototype, "total", void 0);
71
+ exports.TransactionAmounts = TransactionAmounts = __decorate([
72
+ (0, graphql_1.ObjectType)()
73
+ ], TransactionAmounts);
74
+ //# sourceMappingURL=transaction-amounts.object.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction-amounts.object.js","sourceRoot":"","sources":["../../../../src/models/orders/objects/transaction-amounts.object.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAoD;AACpD,qDAAsD;AAG/C,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;CA6C9B,CAAA;AA7CY,gDAAkB;AAK7B;IAJC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,qCAAmB,EAAE;QAChC,WAAW,EAAE,qCAAqC;QAClD,QAAQ,EAAE,IAAI;KACf,CAAC;;oDACgB;AAMlB;IAJC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,qCAAmB,EAAE;QAChC,WAAW,EAAE,+DAA+D;QAC5E,QAAQ,EAAE,IAAI;KACf,CAAC;;uDACmB;AAMrB;IAJC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,qCAAmB,EAAE;QAChC,WAAW,EAAE,yFAAyF;QACtG,QAAQ,EAAE,IAAI;KACf,CAAC;;uDACmB;AAMrB;IAJC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,qCAAmB,EAAE;QAChC,WAAW,EAAE,4BAA4B;QACzC,QAAQ,EAAE,IAAI;KACf,CAAC;;kDACc;AAKhB;IAHC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,qCAAmB,EAAE;QAChC,QAAQ,EAAE,IAAI;KACf,CAAC;;oDACgB;AAKlB;IAHC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,qCAAmB,EAAE;QAChC,WAAW,EAAE,+DAA+D;KAC7E,CAAC;;oDACe;AAKjB;IAHC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,qCAAmB,EAAE;QAChC,QAAQ,EAAE,IAAI;KACf,CAAC;;+CACW;AAMb;IAJC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,qCAAmB,EAAE;QAChC,WAAW,EAAE,4EAA4E;QACzF,QAAQ,EAAE,IAAI;KACf,CAAC;;iDACa;6BA5CJ,kBAAkB;IAD9B,IAAA,oBAAU,GAAE;GACA,kBAAkB,CA6C9B"}
@@ -1,17 +1,15 @@
1
1
  import { Node, Timestamp } from '../../../utils';
2
2
  import { AppCurrencyEnum, PaymentProviderEnum } from '@puzzlin/enums';
3
3
  import { Order } from './order.object';
4
+ import { TransactionAmounts } from './transaction-amounts.object';
4
5
  declare const Transaction_base: import("@nestjs/common").Type<Node & Timestamp>;
5
6
  export declare class Transaction extends Transaction_base {
6
- amount: number;
7
+ amounts: TransactionAmounts;
7
8
  currency: AppCurrencyEnum;
8
- discountAmount?: number;
9
9
  onBehalfOfSellerId?: string;
10
10
  order?: Order;
11
11
  orderId: string;
12
- platformFeeAmount: number;
13
12
  provider: PaymentProviderEnum;
14
- providerFeeAmount?: number;
15
13
  stripeCheckoutSessionId?: string;
16
14
  }
17
15
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.object.d.ts","sourceRoot":"","sources":["../../../../src/models/orders/objects/transaction.object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAE1C,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAEtE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;;AAEvC,qBAGa,WAAY,SAAQ,gBAAiC;IAIhE,MAAM,EAAE,MAAM,CAAC;IAGf,QAAQ,EAAE,eAAe,CAAC;IAM1B,cAAc,CAAC,EAAE,MAAM,CAAC;IAKxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAG5B,KAAK,CAAC,EAAE,KAAK,CAAC;IAGd,OAAO,EAAE,MAAM,CAAC;IAKhB,iBAAiB,EAAE,MAAM,CAAC;IAG1B,QAAQ,EAAE,mBAAmB,CAAC;IAM9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAM3B,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC"}
1
+ {"version":3,"file":"transaction.object.d.ts","sourceRoot":"","sources":["../../../../src/models/orders/objects/transaction.object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAE1C,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAEtE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;;AAElE,qBAGa,WAAY,SAAQ,gBAAiC;IAIhE,OAAO,EAAE,kBAAkB,CAAC;IAG5B,QAAQ,EAAE,eAAe,CAAC;IAK1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAG5B,KAAK,CAAC,EAAE,KAAK,CAAC;IAGd,OAAO,EAAE,MAAM,CAAC;IAGhB,QAAQ,EAAE,mBAAmB,CAAC;IAM9B,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC"}
@@ -13,28 +13,21 @@ exports.Transaction = void 0;
13
13
  const utils_1 = require("../../../utils");
14
14
  const graphql_1 = require("@nestjs/graphql");
15
15
  const enums_1 = require("@puzzlin/enums");
16
- const graphql_scalars_1 = require("graphql-scalars");
17
16
  const order_object_1 = require("./order.object");
17
+ const transaction_amounts_object_1 = require("./transaction-amounts.object");
18
18
  let Transaction = class Transaction extends (0, graphql_1.IntersectionType)(utils_1.Node, utils_1.Timestamp) {
19
19
  };
20
20
  exports.Transaction = Transaction;
21
21
  __decorate([
22
- (0, graphql_1.Field)(() => graphql_scalars_1.PositiveIntResolver, {
23
- description: 'Total amount for a transaction.',
22
+ (0, graphql_1.Field)(() => transaction_amounts_object_1.TransactionAmounts, {
23
+ description: 'Amounts of a transaction.',
24
24
  }),
25
- __metadata("design:type", Number)
26
- ], Transaction.prototype, "amount", void 0);
25
+ __metadata("design:type", transaction_amounts_object_1.TransactionAmounts)
26
+ ], Transaction.prototype, "amounts", void 0);
27
27
  __decorate([
28
28
  (0, graphql_1.Field)(() => enums_1.AppCurrencyEnum),
29
29
  __metadata("design:type", String)
30
30
  ], Transaction.prototype, "currency", void 0);
31
- __decorate([
32
- (0, graphql_1.Field)(() => graphql_scalars_1.PositiveIntResolver, {
33
- description: 'Total discount amount for a transaction.',
34
- nullable: true,
35
- }),
36
- __metadata("design:type", Number)
37
- ], Transaction.prototype, "discountAmount", void 0);
38
31
  __decorate([
39
32
  (0, graphql_1.Field)(() => graphql_1.ID, {
40
33
  nullable: true,
@@ -49,23 +42,10 @@ __decorate([
49
42
  (0, graphql_1.Field)(() => graphql_1.ID),
50
43
  __metadata("design:type", String)
51
44
  ], Transaction.prototype, "orderId", void 0);
52
- __decorate([
53
- (0, graphql_1.Field)(() => graphql_scalars_1.PositiveIntResolver, {
54
- description: 'Total platform fee amount for a transaction.',
55
- }),
56
- __metadata("design:type", Number)
57
- ], Transaction.prototype, "platformFeeAmount", void 0);
58
45
  __decorate([
59
46
  (0, graphql_1.Field)(() => enums_1.PaymentProviderEnum),
60
47
  __metadata("design:type", String)
61
48
  ], Transaction.prototype, "provider", void 0);
62
- __decorate([
63
- (0, graphql_1.Field)(() => graphql_scalars_1.PositiveIntResolver, {
64
- description: 'Total payment provider fee amount for a transaction. Known only after payment succeeds.',
65
- nullable: true,
66
- }),
67
- __metadata("design:type", Number)
68
- ], Transaction.prototype, "providerFeeAmount", void 0);
69
49
  __decorate([
70
50
  (0, graphql_1.Field)(() => String, {
71
51
  description: 'Stripe checkout session ID.',
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.object.js","sourceRoot":"","sources":["../../../../src/models/orders/objects/transaction.object.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAA0C;AAC1C,6CAA0E;AAC1E,0CAAsE;AACtE,qDAAsD;AACtD,iDAAuC;AAKhC,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 {"version":3,"file":"transaction.object.js","sourceRoot":"","sources":["../../../../src/models/orders/objects/transaction.object.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAA0C;AAC1C,6CAA0E;AAC1E,0CAAsE;AAEtE,iDAAuC;AACvC,6EAAkE;AAK3D,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,IAAA,0BAAgB,EAAC,YAAI,EAAE,iBAAS,CAAC;CA4BjE,CAAA;AA5BY,kCAAW;AAItB;IAHC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,+CAAkB,EAAE;QAC/B,WAAW,EAAE,2BAA2B;KACzC,CAAC;8BACO,+CAAkB;4CAAC;AAG5B;IADC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,uBAAe,CAAC;;6CACH;AAK1B;IAHC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,YAAE,EAAE;QACf,QAAQ,EAAE,IAAI;KACf,CAAC;;uDAC0B;AAG5B;IADC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,oBAAK,CAAC;8BACX,oBAAK;0CAAC;AAGd;IADC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,YAAE,CAAC;;4CACA;AAGhB;IADC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,2BAAmB,CAAC;;6CACH;AAM9B;IAJC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE;QACnB,WAAW,EAAE,6BAA6B;QAC1C,QAAQ,EAAE,IAAI;KACf,CAAC;;4DAC+B;sBA3BtB,WAAW;IAHvB,IAAA,oBAAU,EAAC;QACV,UAAU,EAAE,YAAI;KACjB,CAAC;GACW,WAAW,CA4BvB"}