@doctocar/tooling 0.3.1-32 → 0.3.1-33

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 (124) hide show
  1. package/dist/enums/payment/PaymentStatusTypes.enum.d.ts +0 -2
  2. package/dist/enums/payment/PaymentStatusTypes.enum.js +0 -2
  3. package/dist/firebase/firestore/enums/FirestoreCollections.enum.d.ts +1 -0
  4. package/dist/firebase/firestore/enums/FirestoreCollections.enum.js +1 -0
  5. package/dist/firebase/firestore/enums/index.d.ts +1 -0
  6. package/dist/firebase/firestore/enums/index.js +1 -0
  7. package/dist/firebase/firestore/enums/orders/OrderPaymentRefundReasonTypes.enum.d.ts +6 -0
  8. package/dist/firebase/firestore/enums/orders/OrderPaymentRefundReasonTypes.enum.js +10 -0
  9. package/dist/firebase/firestore/enums/orders/OrderPaymentRefundSourceTypes.enum.d.ts +4 -0
  10. package/dist/firebase/firestore/enums/orders/OrderPaymentRefundSourceTypes.enum.js +8 -0
  11. package/dist/firebase/firestore/enums/orders/OrderPaymentRefundStatusTypes.enum.d.ts +7 -0
  12. package/dist/firebase/firestore/enums/orders/OrderPaymentRefundStatusTypes.enum.js +11 -0
  13. package/dist/firebase/firestore/enums/orders/OrderStatusTypes.enum.d.ts +2 -1
  14. package/dist/firebase/firestore/enums/orders/OrderStatusTypes.enum.js +1 -0
  15. package/dist/firebase/firestore/enums/ordersRefundIntents/OrderRefundIntentReasonTypes.enum.d.ts +6 -0
  16. package/dist/firebase/firestore/enums/ordersRefundIntents/OrderRefundIntentReasonTypes.enum.js +10 -0
  17. package/dist/firebase/firestore/enums/ordersRefundIntents/OrderRefundIntentStatusTypes.enum.d.ts +7 -0
  18. package/dist/firebase/firestore/enums/ordersRefundIntents/OrderRefundIntentStatusTypes.enum.js +11 -0
  19. package/dist/firebase/firestore/enums/ordersRefundIntents/OrderRefundIntentStepStatusTypes.enum.d.ts +7 -0
  20. package/dist/firebase/firestore/enums/ordersRefundIntents/OrderRefundIntentStepStatusTypes.enum.js +11 -0
  21. package/dist/firebase/firestore/enums/ordersRefundIntents/index.d.ts +3 -0
  22. package/dist/firebase/firestore/enums/ordersRefundIntents/index.js +19 -0
  23. package/dist/firebase/firestore/maps/FirestoreCollectionDocumentTypeMap.d.ts +2 -1
  24. package/dist/firebase/firestore/types/bookedSlot/FirestoreBookedSlotDocument.type.d.ts +2 -2
  25. package/dist/firebase/firestore/types/index.d.ts +1 -0
  26. package/dist/firebase/firestore/types/index.js +1 -0
  27. package/dist/firebase/firestore/types/marketplaceFinancialReports/FirestoreMarketplaceFinancialReportsDocument.type.d.ts +3 -3
  28. package/dist/firebase/firestore/types/order/FirestoreBookedSlotCancellationDetails.type.d.ts +6 -0
  29. package/dist/firebase/firestore/types/order/FirestoreBookedSlotCancellationDetails.type.js +2 -0
  30. package/dist/firebase/firestore/types/order/FirestoreOrderDocument.type.d.ts +5 -55
  31. package/dist/firebase/firestore/types/order/FirestoreOrderPaymentBreakdown.type.d.ts +42 -0
  32. package/dist/firebase/firestore/types/order/FirestoreOrderPaymentBreakdown.type.js +2 -0
  33. package/dist/firebase/firestore/types/order/FirestoreOrderPricingDetails.type.d.ts +48 -0
  34. package/dist/firebase/firestore/types/order/FirestoreOrderPricingDetails.type.js +2 -0
  35. package/dist/firebase/firestore/types/order/OrderExternalPaymentRefund.type.d.ts +13 -0
  36. package/dist/firebase/firestore/types/order/OrderExternalPaymentRefund.type.js +2 -0
  37. package/dist/firebase/firestore/types/order/OrderPaymentBreakdownRefund.type.d.ts +24 -0
  38. package/dist/firebase/firestore/types/order/OrderPaymentBreakdownRefund.type.js +2 -0
  39. package/dist/firebase/firestore/types/order/OrderPaymentRefund.type.d.ts +12 -0
  40. package/dist/firebase/firestore/types/order/OrderPaymentRefund.type.js +2 -0
  41. package/dist/firebase/firestore/types/order/OrderPlatformBalancePaymentRefund.type.d.ts +8 -0
  42. package/dist/firebase/firestore/types/order/OrderPlatformBalancePaymentRefund.type.js +2 -0
  43. package/dist/firebase/firestore/types/order/index.d.ts +3 -0
  44. package/dist/firebase/firestore/types/order/index.js +3 -0
  45. package/dist/firebase/firestore/types/ordersRefundIntents/FirestoreOrderRefundIntent.type.d.ts +27 -0
  46. package/dist/firebase/firestore/types/ordersRefundIntents/FirestoreOrderRefundIntent.type.js +2 -0
  47. package/dist/firebase/firestore/types/ordersRefundIntents/FirestoreOrderRefundIntentDocument.type.d.ts +35 -0
  48. package/dist/firebase/firestore/types/ordersRefundIntents/FirestoreOrderRefundIntentDocument.type.js +2 -0
  49. package/dist/firebase/firestore/types/ordersRefundIntents/index.d.ts +1 -0
  50. package/dist/firebase/firestore/types/ordersRefundIntents/index.js +17 -0
  51. package/dist/firebase/firestore/utils/order/buildFirestoreOrderPricingDetailsFromInvoiceTotals.util.d.ts +8 -0
  52. package/dist/firebase/firestore/utils/order/buildFirestoreOrderPricingDetailsFromInvoiceTotals.util.js +37 -0
  53. package/dist/firebase/firestore/utils/stubs/index.d.ts +1 -0
  54. package/dist/firebase/firestore/utils/stubs/index.js +1 -0
  55. package/dist/firebase/firestore/utils/stubs/marketplaceFinancialReports/firestoreMarketplaceFinancialReportsDocumentStub.js +3 -3
  56. package/dist/firebase/firestore/utils/stubs/order/firestoreOrderDocumentPricingDetailStub.js +36 -10
  57. package/dist/firebase/firestore/utils/stubs/order/firestoreOrderDocumentStub.js +24 -4
  58. package/dist/firebase/firestore/utils/stubs/ordersRefundIntents/firestoreOrderRefundIntentDocumentStub.d.ts +2 -0
  59. package/dist/firebase/firestore/utils/stubs/ordersRefundIntents/firestoreOrderRefundIntentDocumentStub.js +29 -0
  60. package/dist/firebase/firestore/utils/stubs/ordersRefundIntents/firestoreOrderRefundIntentStub.d.ts +2 -0
  61. package/dist/firebase/firestore/utils/stubs/ordersRefundIntents/firestoreOrderRefundIntentStub.js +19 -0
  62. package/dist/firebase/firestore/utils/stubs/ordersRefundIntents/index.d.ts +1 -0
  63. package/dist/firebase/firestore/utils/stubs/ordersRefundIntents/index.js +17 -0
  64. package/dist/gcp/pubsub/enums/PubSubTopics.enum.d.ts +6 -2
  65. package/dist/gcp/pubsub/enums/PubSubTopics.enum.js +5 -1
  66. package/dist/gcp/pubsub/maps/PubSubTopicMessageMap.map.d.ts +6 -2
  67. package/dist/gcp/pubsub/types/orders/PubSubOrderExternalRefundFailedMessage.type.d.ts +5 -0
  68. package/dist/gcp/pubsub/types/orders/PubSubOrderExternalRefundFailedMessage.type.js +2 -0
  69. package/dist/gcp/pubsub/types/orders/PubSubOrderExternalRefundSucceededMessage.type.d.ts +5 -0
  70. package/dist/gcp/pubsub/types/orders/PubSubOrderExternalRefundSucceededMessage.type.js +2 -0
  71. package/dist/gcp/pubsub/types/orders/PubSubOrderOperationalStateRecomputeRequestedMessage.type.d.ts +3 -0
  72. package/dist/gcp/pubsub/types/orders/PubSubOrderOperationalStateRecomputeRequestedMessage.type.js +2 -0
  73. package/dist/gcp/pubsub/types/orders/PubSubOrderRefundRequestedMessage.type.d.ts +3 -0
  74. package/dist/gcp/pubsub/types/orders/PubSubOrderRefundRequestedMessage.type.js +2 -0
  75. package/dist/gcp/pubsub/types/orders/PubSubProcessOrderRefundIntentMessage.type.d.ts +4 -0
  76. package/dist/gcp/pubsub/types/orders/PubSubProcessOrderRefundIntentMessage.type.js +2 -0
  77. package/dist/gcp/pubsub/types/orders/index.d.ts +4 -1
  78. package/dist/gcp/pubsub/types/orders/index.js +4 -1
  79. package/dist/gcp/pubsub/types/serviceProvider/PubSubServiceProviderBookedSlotReleaseRequestedMessage.type.d.ts +10 -0
  80. package/dist/gcp/pubsub/types/serviceProvider/PubSubServiceProviderBookedSlotReleaseRequestedMessage.type.js +2 -0
  81. package/dist/gcp/pubsub/types/serviceProvider/index.d.ts +1 -0
  82. package/dist/gcp/pubsub/types/serviceProvider/index.js +1 -0
  83. package/dist/gcp/pubsub/utils/stubs/index.d.ts +4 -0
  84. package/dist/gcp/pubsub/utils/stubs/index.js +4 -0
  85. package/dist/gcp/pubsub/utils/stubs/pubSubOrderExternalRefundFailedMessageStub.d.ts +2 -0
  86. package/dist/gcp/pubsub/utils/stubs/pubSubOrderExternalRefundFailedMessageStub.js +11 -0
  87. package/dist/gcp/pubsub/utils/stubs/pubSubOrderExternalRefundSucceededMessageStub.d.ts +2 -0
  88. package/dist/gcp/pubsub/utils/stubs/pubSubOrderExternalRefundSucceededMessageStub.js +11 -0
  89. package/dist/gcp/pubsub/utils/stubs/pubSubOrderOperationalStateRecomputeRequestedMessageStub.d.ts +2 -0
  90. package/dist/gcp/pubsub/utils/stubs/pubSubOrderOperationalStateRecomputeRequestedMessageStub.js +9 -0
  91. package/dist/gcp/pubsub/utils/stubs/pubSubOrderRefundRequestedMessageStub.d.ts +2 -0
  92. package/dist/gcp/pubsub/utils/stubs/pubSubOrderRefundRequestedMessageStub.js +9 -0
  93. package/dist/gcp/pubsub/utils/stubs/pubSubProcessOrderRefundIntentMessageStub.d.ts +2 -0
  94. package/dist/gcp/pubsub/utils/stubs/pubSubProcessOrderRefundIntentMessageStub.js +10 -0
  95. package/dist/gcp/pubsub/utils/stubs/serviceProvider/index.d.ts +1 -0
  96. package/dist/gcp/pubsub/utils/stubs/serviceProvider/index.js +1 -0
  97. package/dist/gcp/pubsub/utils/stubs/serviceProvider/pubSubServiceProviderBookedSlotReleaseRequestedMessageStub.d.ts +2 -0
  98. package/dist/gcp/pubsub/utils/stubs/serviceProvider/pubSubServiceProviderBookedSlotReleaseRequestedMessageStub.js +15 -0
  99. package/dist/pricing/__tests__/calculateInvoiceTotalWithTax.test.d.ts +1 -0
  100. package/dist/pricing/__tests__/calculateInvoiceTotalWithTax.test.js +955 -0
  101. package/dist/pricing/__tests__/computeOrderPaymentBreakdownWithPlatformBalance.test.d.ts +1 -0
  102. package/dist/pricing/__tests__/computeOrderPaymentBreakdownWithPlatformBalance.test.js +58 -0
  103. package/dist/pricing/__tests__/computeOrderPaymentBreakdownWithPlatformBalance.util.test.d.ts +1 -0
  104. package/dist/pricing/__tests__/computeOrderPaymentBreakdownWithPlatformBalance.util.test.js +58 -0
  105. package/dist/pricing/computeOrderPaymentBreakdownWithPlatformBalance.d.ts +6 -0
  106. package/dist/pricing/computeOrderPaymentBreakdownWithPlatformBalance.js +22 -0
  107. package/dist/pricing/index.d.ts +1 -0
  108. package/dist/pricing/index.js +1 -0
  109. package/dist/pricing/types/ComputeOrderPaymentBreakdownWithPlatformBalanceParams.type.d.ts +5 -0
  110. package/dist/pricing/types/ComputeOrderPaymentBreakdownWithPlatformBalanceParams.type.js +2 -0
  111. package/dist/pricing/types/ComputeOrderPaymentBreakdownWithPlatformBalanceResult.type.d.ts +6 -0
  112. package/dist/pricing/types/ComputeOrderPaymentBreakdownWithPlatformBalanceResult.type.js +2 -0
  113. package/dist/pricing/types/index.d.ts +2 -0
  114. package/dist/pricing/types/index.js +2 -0
  115. package/dist/pricing/utils/applyBasisPointsRateHalfUp.util.js +1 -1
  116. package/dist/pricing/utils/stubs/computeOrderPaymentBreakdownWithPlatformBalanceStub.d.ts +2 -0
  117. package/dist/pricing/utils/stubs/computeOrderPaymentBreakdownWithPlatformBalanceStub.js +12 -0
  118. package/dist/pricing/utils/stubs/index.d.ts +1 -0
  119. package/dist/pricing/utils/stubs/index.js +1 -0
  120. package/dist/stripe/types/StripeCustomRefundMetadata.type.d.ts +8 -0
  121. package/dist/stripe/types/StripeCustomRefundMetadata.type.js +2 -0
  122. package/dist/stripe/types/index.d.ts +1 -0
  123. package/dist/stripe/types/index.js +1 -0
  124. package/package.json +1 -1
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const stubs_1 = require("../utils/stubs");
4
+ const computeOrderPaymentBreakdownWithPlatformBalance_1 = require("../computeOrderPaymentBreakdownWithPlatformBalance");
5
+ describe("computeOrderPaymentBreakdownWithPlatformBalance", () => {
6
+ const invoiceTotals = (0, stubs_1.calculateInvoiceTotalWithTaxStub)({
7
+ totalPostTaxInCents: 1_800,
8
+ totalMarketplaceFeePostTaxInCents: 600,
9
+ });
10
+ it("should not apply balance when available balance is zero", () => {
11
+ expect((0, computeOrderPaymentBreakdownWithPlatformBalance_1.computeOrderPaymentBreakdownWithPlatformBalance)({
12
+ availablePlatformBalanceInCents: 0,
13
+ invoiceTotals,
14
+ })).toEqual({
15
+ totalAmountToPayInCents: 1_800,
16
+ remainingAmountToPayInCents: 1_800,
17
+ remainingMarketplaceFeeAmountInCents: 600,
18
+ platformBalanceAppliedInCents: 0,
19
+ });
20
+ });
21
+ it("should apply partial balance when available balance is below marketplace fee", () => {
22
+ expect((0, computeOrderPaymentBreakdownWithPlatformBalance_1.computeOrderPaymentBreakdownWithPlatformBalance)({
23
+ availablePlatformBalanceInCents: 200,
24
+ invoiceTotals,
25
+ })).toEqual({
26
+ totalAmountToPayInCents: 1_800,
27
+ remainingAmountToPayInCents: 1_600,
28
+ remainingMarketplaceFeeAmountInCents: 400,
29
+ platformBalanceAppliedInCents: 200,
30
+ });
31
+ });
32
+ it("should cap applied balance at marketplace fee post tax", () => {
33
+ expect((0, computeOrderPaymentBreakdownWithPlatformBalance_1.computeOrderPaymentBreakdownWithPlatformBalance)({
34
+ availablePlatformBalanceInCents: 5_000,
35
+ invoiceTotals,
36
+ })).toEqual({
37
+ totalAmountToPayInCents: 1_800,
38
+ remainingAmountToPayInCents: 1_200,
39
+ remainingMarketplaceFeeAmountInCents: 0,
40
+ platformBalanceAppliedInCents: 600,
41
+ });
42
+ });
43
+ it("should not apply balance when marketplace fee post tax is zero", () => {
44
+ const zeroFeeInvoiceTotals = (0, stubs_1.calculateInvoiceTotalWithTaxStub)({
45
+ totalPostTaxInCents: 1_200,
46
+ totalMarketplaceFeePostTaxInCents: 0,
47
+ });
48
+ expect((0, computeOrderPaymentBreakdownWithPlatformBalance_1.computeOrderPaymentBreakdownWithPlatformBalance)({
49
+ availablePlatformBalanceInCents: 500,
50
+ invoiceTotals: zeroFeeInvoiceTotals,
51
+ })).toEqual({
52
+ totalAmountToPayInCents: 1_200,
53
+ remainingAmountToPayInCents: 1_200,
54
+ remainingMarketplaceFeeAmountInCents: 0,
55
+ platformBalanceAppliedInCents: 0,
56
+ });
57
+ });
58
+ });
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const stubs_1 = require("../utils/stubs");
4
+ const computeOrderPaymentBreakdownWithPlatformBalance_1 = require("../computeOrderPaymentBreakdownWithPlatformBalance");
5
+ describe("computeOrderPaymentBreakdownWithPlatformBalance", () => {
6
+ const invoiceTotals = (0, stubs_1.calculateInvoiceTotalWithTaxStub)({
7
+ totalPostTaxInCents: 1_800,
8
+ totalMarketplaceFeePostTaxInCents: 600,
9
+ });
10
+ it("should not apply balance when available balance is zero", () => {
11
+ expect((0, computeOrderPaymentBreakdownWithPlatformBalance_1.computeOrderPaymentBreakdownWithPlatformBalance)({
12
+ availablePlatformBalanceInCents: 0,
13
+ invoiceTotals,
14
+ })).toEqual({
15
+ totalAmountToPayInCents: 1_800,
16
+ remainingAmountToPayInCents: 1_800,
17
+ remainingMarketplaceFeeAmountInCents: 600,
18
+ platformBalanceAppliedInCents: 0,
19
+ });
20
+ });
21
+ it("should apply partial balance when available balance is below marketplace fee", () => {
22
+ expect((0, computeOrderPaymentBreakdownWithPlatformBalance_1.computeOrderPaymentBreakdownWithPlatformBalance)({
23
+ availablePlatformBalanceInCents: 200,
24
+ invoiceTotals,
25
+ })).toEqual({
26
+ totalAmountToPayInCents: 1_800,
27
+ remainingAmountToPayInCents: 1_600,
28
+ remainingMarketplaceFeeAmountInCents: 400,
29
+ platformBalanceAppliedInCents: 200,
30
+ });
31
+ });
32
+ it("should cap applied balance at marketplace fee post tax", () => {
33
+ expect((0, computeOrderPaymentBreakdownWithPlatformBalance_1.computeOrderPaymentBreakdownWithPlatformBalance)({
34
+ availablePlatformBalanceInCents: 5_000,
35
+ invoiceTotals,
36
+ })).toEqual({
37
+ totalAmountToPayInCents: 1_800,
38
+ remainingAmountToPayInCents: 1_200,
39
+ remainingMarketplaceFeeAmountInCents: 0,
40
+ platformBalanceAppliedInCents: 600,
41
+ });
42
+ });
43
+ it("should not apply balance when marketplace fee post tax is zero", () => {
44
+ const zeroFeeInvoiceTotals = (0, stubs_1.calculateInvoiceTotalWithTaxStub)({
45
+ totalPostTaxInCents: 1_200,
46
+ totalMarketplaceFeePostTaxInCents: 0,
47
+ });
48
+ expect((0, computeOrderPaymentBreakdownWithPlatformBalance_1.computeOrderPaymentBreakdownWithPlatformBalance)({
49
+ availablePlatformBalanceInCents: 500,
50
+ invoiceTotals: zeroFeeInvoiceTotals,
51
+ })).toEqual({
52
+ totalAmountToPayInCents: 1_200,
53
+ remainingAmountToPayInCents: 1_200,
54
+ remainingMarketplaceFeeAmountInCents: 0,
55
+ platformBalanceAppliedInCents: 0,
56
+ });
57
+ });
58
+ });
@@ -0,0 +1,6 @@
1
+ import type { ComputeOrderPaymentBreakdownWithPlatformBalanceParams, ComputeOrderPaymentBreakdownWithPlatformBalanceResult } from "./types";
2
+ /**
3
+ * Allocates customer platform balance against the marketplace fee portion of an order.
4
+ * Credits never reduce the service provider payout slice; unused balance stays on the entity.
5
+ */
6
+ export declare function computeOrderPaymentBreakdownWithPlatformBalance({ availablePlatformBalanceInCents, invoiceTotals, }: ComputeOrderPaymentBreakdownWithPlatformBalanceParams): ComputeOrderPaymentBreakdownWithPlatformBalanceResult;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.computeOrderPaymentBreakdownWithPlatformBalance = computeOrderPaymentBreakdownWithPlatformBalance;
4
+ /**
5
+ * Allocates customer platform balance against the marketplace fee portion of an order.
6
+ * Credits never reduce the service provider payout slice; unused balance stays on the entity.
7
+ */
8
+ function computeOrderPaymentBreakdownWithPlatformBalance({ availablePlatformBalanceInCents, invoiceTotals, }) {
9
+ const totalAmountToPayInCents = invoiceTotals.totalPostTaxInCents;
10
+ const platformBalanceAppliedInCents = availablePlatformBalanceInCents > 0
11
+ ? Math.min(availablePlatformBalanceInCents, invoiceTotals.totalMarketplaceFeePostTaxInCents)
12
+ : 0;
13
+ const remainingAmountToPayInCents = totalAmountToPayInCents - platformBalanceAppliedInCents;
14
+ const remainingMarketplaceFeeAmountInCents = invoiceTotals.totalMarketplaceFeePostTaxInCents -
15
+ platformBalanceAppliedInCents;
16
+ return {
17
+ totalAmountToPayInCents,
18
+ remainingAmountToPayInCents,
19
+ remainingMarketplaceFeeAmountInCents,
20
+ platformBalanceAppliedInCents,
21
+ };
22
+ }
@@ -1,5 +1,6 @@
1
1
  export * from "./types";
2
2
  export * from "./utils";
3
3
  export * from "./calculateInvoiceTotalWithTax";
4
+ export * from "./computeOrderPaymentBreakdownWithPlatformBalance";
4
5
  export * from "./constants";
5
6
  export * from "./enums";
@@ -17,5 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./types"), exports);
18
18
  __exportStar(require("./utils"), exports);
19
19
  __exportStar(require("./calculateInvoiceTotalWithTax"), exports);
20
+ __exportStar(require("./computeOrderPaymentBreakdownWithPlatformBalance"), exports);
20
21
  __exportStar(require("./constants"), exports);
21
22
  __exportStar(require("./enums"), exports);
@@ -0,0 +1,5 @@
1
+ import type { CalculateInvoiceTotalsWithTaxResult } from "./CalculateInvoiceTotalsWithTaxResult.type";
2
+ export type ComputeOrderPaymentBreakdownWithPlatformBalanceParams = {
3
+ availablePlatformBalanceInCents: number;
4
+ invoiceTotals: Pick<CalculateInvoiceTotalsWithTaxResult, "totalPostTaxInCents" | "totalMarketplaceFeePostTaxInCents">;
5
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ export type ComputeOrderPaymentBreakdownWithPlatformBalanceResult = {
2
+ totalAmountToPayInCents: number;
3
+ remainingAmountToPayInCents: number;
4
+ remainingMarketplaceFeeAmountInCents: number;
5
+ platformBalanceAppliedInCents: number;
6
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,6 @@
1
1
  export * from "./CalculateInvoiceTotalsWithTaxParams.type";
2
2
  export * from "./CalculateInvoiceTotalsWithTaxResult.type";
3
+ export * from "./ComputeOrderPaymentBreakdownWithPlatformBalanceParams.type";
4
+ export * from "./ComputeOrderPaymentBreakdownWithPlatformBalanceResult.type";
3
5
  export * from "./PricingPostTaxLine.type";
4
6
  export * from "./PricingPreTaxLine.type";
@@ -16,5 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./CalculateInvoiceTotalsWithTaxParams.type"), exports);
18
18
  __exportStar(require("./CalculateInvoiceTotalsWithTaxResult.type"), exports);
19
+ __exportStar(require("./ComputeOrderPaymentBreakdownWithPlatformBalanceParams.type"), exports);
20
+ __exportStar(require("./ComputeOrderPaymentBreakdownWithPlatformBalanceResult.type"), exports);
19
21
  __exportStar(require("./PricingPostTaxLine.type"), exports);
20
22
  __exportStar(require("./PricingPreTaxLine.type"), exports);
@@ -8,5 +8,5 @@ function applyBasisPointsRateHalfUp({ amountInCents, rateBasisPoints, }) {
8
8
  if (rateBasisPoints < 0 || rateBasisPoints > 10_000) {
9
9
  throw new Error("rateBasisPoints must be between 0 and 10000");
10
10
  }
11
- return Math.floor((amountInCents * rateBasisPoints + 5_000) / 10_000);
11
+ return Math.round((amountInCents * rateBasisPoints) / 10_000);
12
12
  }
@@ -0,0 +1,2 @@
1
+ import type { ComputeOrderPaymentBreakdownWithPlatformBalanceResult } from "../../types";
2
+ export declare function computeOrderPaymentBreakdownWithPlatformBalanceStub(overwrite?: Partial<ComputeOrderPaymentBreakdownWithPlatformBalanceResult>): ComputeOrderPaymentBreakdownWithPlatformBalanceResult;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.computeOrderPaymentBreakdownWithPlatformBalanceStub = computeOrderPaymentBreakdownWithPlatformBalanceStub;
4
+ function computeOrderPaymentBreakdownWithPlatformBalanceStub(overwrite = {}) {
5
+ return {
6
+ totalAmountToPayInCents: 0,
7
+ remainingAmountToPayInCents: 0,
8
+ remainingMarketplaceFeeAmountInCents: 0,
9
+ platformBalanceAppliedInCents: 0,
10
+ ...overwrite,
11
+ };
12
+ }
@@ -1,3 +1,4 @@
1
1
  export * from "./calculateInvoiceTotalWithTaxStub";
2
+ export * from "./computeOrderPaymentBreakdownWithPlatformBalanceStub";
2
3
  export * from "./pricingPostTaxLineStub";
3
4
  export * from "./pricingPreTaxLineStub";
@@ -15,5 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./calculateInvoiceTotalWithTaxStub"), exports);
18
+ __exportStar(require("./computeOrderPaymentBreakdownWithPlatformBalanceStub"), exports);
18
19
  __exportStar(require("./pricingPostTaxLineStub"), exports);
19
20
  __exportStar(require("./pricingPreTaxLineStub"), exports);
@@ -0,0 +1,8 @@
1
+ export type StripeCustomRefundMetadata = {
2
+ orderDocumentId: string;
3
+ orderRefundIntentDocumentId: string;
4
+ firestoreCustomerUserDocumentId: string;
5
+ firestoreCustomerEntityDocumentId: string;
6
+ firestoreServiceProviderUserDocumentId: string;
7
+ firestoreServiceProviderEntityDocumentId: string;
8
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +1,3 @@
1
1
  export * from "./StripeCustomPaymentIntentMetadata.type";
2
+ export * from "./StripeCustomRefundMetadata.type";
2
3
  export * from "./StripeCustomServiceProviderPayoutMetadata.type";
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./StripeCustomPaymentIntentMetadata.type"), exports);
18
+ __exportStar(require("./StripeCustomRefundMetadata.type"), exports);
18
19
  __exportStar(require("./StripeCustomServiceProviderPayoutMetadata.type"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doctocar/tooling",
3
- "version": "0.3.1-32",
3
+ "version": "0.3.1-33",
4
4
  "description": "A set of tools for DoctoCar projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",