@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.
- package/dist/enums/payment/PaymentStatusTypes.enum.d.ts +0 -2
- package/dist/enums/payment/PaymentStatusTypes.enum.js +0 -2
- package/dist/firebase/firestore/enums/FirestoreCollections.enum.d.ts +1 -0
- package/dist/firebase/firestore/enums/FirestoreCollections.enum.js +1 -0
- package/dist/firebase/firestore/enums/index.d.ts +1 -0
- package/dist/firebase/firestore/enums/index.js +1 -0
- package/dist/firebase/firestore/enums/orders/OrderPaymentRefundReasonTypes.enum.d.ts +6 -0
- package/dist/firebase/firestore/enums/orders/OrderPaymentRefundReasonTypes.enum.js +10 -0
- package/dist/firebase/firestore/enums/orders/OrderPaymentRefundSourceTypes.enum.d.ts +4 -0
- package/dist/firebase/firestore/enums/orders/OrderPaymentRefundSourceTypes.enum.js +8 -0
- package/dist/firebase/firestore/enums/orders/OrderPaymentRefundStatusTypes.enum.d.ts +7 -0
- package/dist/firebase/firestore/enums/orders/OrderPaymentRefundStatusTypes.enum.js +11 -0
- package/dist/firebase/firestore/enums/orders/OrderStatusTypes.enum.d.ts +2 -1
- package/dist/firebase/firestore/enums/orders/OrderStatusTypes.enum.js +1 -0
- package/dist/firebase/firestore/enums/ordersRefundIntents/OrderRefundIntentReasonTypes.enum.d.ts +6 -0
- package/dist/firebase/firestore/enums/ordersRefundIntents/OrderRefundIntentReasonTypes.enum.js +10 -0
- package/dist/firebase/firestore/enums/ordersRefundIntents/OrderRefundIntentStatusTypes.enum.d.ts +7 -0
- package/dist/firebase/firestore/enums/ordersRefundIntents/OrderRefundIntentStatusTypes.enum.js +11 -0
- package/dist/firebase/firestore/enums/ordersRefundIntents/OrderRefundIntentStepStatusTypes.enum.d.ts +7 -0
- package/dist/firebase/firestore/enums/ordersRefundIntents/OrderRefundIntentStepStatusTypes.enum.js +11 -0
- package/dist/firebase/firestore/enums/ordersRefundIntents/index.d.ts +3 -0
- package/dist/firebase/firestore/enums/ordersRefundIntents/index.js +19 -0
- package/dist/firebase/firestore/maps/FirestoreCollectionDocumentTypeMap.d.ts +2 -1
- package/dist/firebase/firestore/types/bookedSlot/FirestoreBookedSlotDocument.type.d.ts +2 -2
- package/dist/firebase/firestore/types/index.d.ts +1 -0
- package/dist/firebase/firestore/types/index.js +1 -0
- package/dist/firebase/firestore/types/marketplaceFinancialReports/FirestoreMarketplaceFinancialReportsDocument.type.d.ts +3 -3
- package/dist/firebase/firestore/types/order/FirestoreBookedSlotCancellationDetails.type.d.ts +6 -0
- package/dist/firebase/firestore/types/order/FirestoreBookedSlotCancellationDetails.type.js +2 -0
- package/dist/firebase/firestore/types/order/FirestoreOrderDocument.type.d.ts +5 -55
- package/dist/firebase/firestore/types/order/FirestoreOrderPaymentBreakdown.type.d.ts +42 -0
- package/dist/firebase/firestore/types/order/FirestoreOrderPaymentBreakdown.type.js +2 -0
- package/dist/firebase/firestore/types/order/FirestoreOrderPricingDetails.type.d.ts +48 -0
- package/dist/firebase/firestore/types/order/FirestoreOrderPricingDetails.type.js +2 -0
- package/dist/firebase/firestore/types/order/OrderExternalPaymentRefund.type.d.ts +13 -0
- package/dist/firebase/firestore/types/order/OrderExternalPaymentRefund.type.js +2 -0
- package/dist/firebase/firestore/types/order/OrderPaymentBreakdownRefund.type.d.ts +24 -0
- package/dist/firebase/firestore/types/order/OrderPaymentBreakdownRefund.type.js +2 -0
- package/dist/firebase/firestore/types/order/OrderPaymentRefund.type.d.ts +12 -0
- package/dist/firebase/firestore/types/order/OrderPaymentRefund.type.js +2 -0
- package/dist/firebase/firestore/types/order/OrderPlatformBalancePaymentRefund.type.d.ts +8 -0
- package/dist/firebase/firestore/types/order/OrderPlatformBalancePaymentRefund.type.js +2 -0
- package/dist/firebase/firestore/types/order/index.d.ts +3 -0
- package/dist/firebase/firestore/types/order/index.js +3 -0
- package/dist/firebase/firestore/types/ordersRefundIntents/FirestoreOrderRefundIntent.type.d.ts +27 -0
- package/dist/firebase/firestore/types/ordersRefundIntents/FirestoreOrderRefundIntent.type.js +2 -0
- package/dist/firebase/firestore/types/ordersRefundIntents/FirestoreOrderRefundIntentDocument.type.d.ts +35 -0
- package/dist/firebase/firestore/types/ordersRefundIntents/FirestoreOrderRefundIntentDocument.type.js +2 -0
- package/dist/firebase/firestore/types/ordersRefundIntents/index.d.ts +1 -0
- package/dist/firebase/firestore/types/ordersRefundIntents/index.js +17 -0
- package/dist/firebase/firestore/utils/order/buildFirestoreOrderPricingDetailsFromInvoiceTotals.util.d.ts +8 -0
- package/dist/firebase/firestore/utils/order/buildFirestoreOrderPricingDetailsFromInvoiceTotals.util.js +37 -0
- package/dist/firebase/firestore/utils/stubs/index.d.ts +1 -0
- package/dist/firebase/firestore/utils/stubs/index.js +1 -0
- package/dist/firebase/firestore/utils/stubs/marketplaceFinancialReports/firestoreMarketplaceFinancialReportsDocumentStub.js +3 -3
- package/dist/firebase/firestore/utils/stubs/order/firestoreOrderDocumentPricingDetailStub.js +36 -10
- package/dist/firebase/firestore/utils/stubs/order/firestoreOrderDocumentStub.js +24 -4
- package/dist/firebase/firestore/utils/stubs/ordersRefundIntents/firestoreOrderRefundIntentDocumentStub.d.ts +2 -0
- package/dist/firebase/firestore/utils/stubs/ordersRefundIntents/firestoreOrderRefundIntentDocumentStub.js +29 -0
- package/dist/firebase/firestore/utils/stubs/ordersRefundIntents/firestoreOrderRefundIntentStub.d.ts +2 -0
- package/dist/firebase/firestore/utils/stubs/ordersRefundIntents/firestoreOrderRefundIntentStub.js +19 -0
- package/dist/firebase/firestore/utils/stubs/ordersRefundIntents/index.d.ts +1 -0
- package/dist/firebase/firestore/utils/stubs/ordersRefundIntents/index.js +17 -0
- package/dist/gcp/pubsub/enums/PubSubTopics.enum.d.ts +6 -2
- package/dist/gcp/pubsub/enums/PubSubTopics.enum.js +5 -1
- package/dist/gcp/pubsub/maps/PubSubTopicMessageMap.map.d.ts +6 -2
- package/dist/gcp/pubsub/types/orders/PubSubOrderExternalRefundFailedMessage.type.d.ts +5 -0
- package/dist/gcp/pubsub/types/orders/PubSubOrderExternalRefundFailedMessage.type.js +2 -0
- package/dist/gcp/pubsub/types/orders/PubSubOrderExternalRefundSucceededMessage.type.d.ts +5 -0
- package/dist/gcp/pubsub/types/orders/PubSubOrderExternalRefundSucceededMessage.type.js +2 -0
- package/dist/gcp/pubsub/types/orders/PubSubOrderOperationalStateRecomputeRequestedMessage.type.d.ts +3 -0
- package/dist/gcp/pubsub/types/orders/PubSubOrderOperationalStateRecomputeRequestedMessage.type.js +2 -0
- package/dist/gcp/pubsub/types/orders/PubSubOrderRefundRequestedMessage.type.d.ts +3 -0
- package/dist/gcp/pubsub/types/orders/PubSubOrderRefundRequestedMessage.type.js +2 -0
- package/dist/gcp/pubsub/types/orders/PubSubProcessOrderRefundIntentMessage.type.d.ts +4 -0
- package/dist/gcp/pubsub/types/orders/PubSubProcessOrderRefundIntentMessage.type.js +2 -0
- package/dist/gcp/pubsub/types/orders/index.d.ts +4 -1
- package/dist/gcp/pubsub/types/orders/index.js +4 -1
- package/dist/gcp/pubsub/types/serviceProvider/PubSubServiceProviderBookedSlotReleaseRequestedMessage.type.d.ts +10 -0
- package/dist/gcp/pubsub/types/serviceProvider/PubSubServiceProviderBookedSlotReleaseRequestedMessage.type.js +2 -0
- package/dist/gcp/pubsub/types/serviceProvider/index.d.ts +1 -0
- package/dist/gcp/pubsub/types/serviceProvider/index.js +1 -0
- package/dist/gcp/pubsub/utils/stubs/index.d.ts +4 -0
- package/dist/gcp/pubsub/utils/stubs/index.js +4 -0
- package/dist/gcp/pubsub/utils/stubs/pubSubOrderExternalRefundFailedMessageStub.d.ts +2 -0
- package/dist/gcp/pubsub/utils/stubs/pubSubOrderExternalRefundFailedMessageStub.js +11 -0
- package/dist/gcp/pubsub/utils/stubs/pubSubOrderExternalRefundSucceededMessageStub.d.ts +2 -0
- package/dist/gcp/pubsub/utils/stubs/pubSubOrderExternalRefundSucceededMessageStub.js +11 -0
- package/dist/gcp/pubsub/utils/stubs/pubSubOrderOperationalStateRecomputeRequestedMessageStub.d.ts +2 -0
- package/dist/gcp/pubsub/utils/stubs/pubSubOrderOperationalStateRecomputeRequestedMessageStub.js +9 -0
- package/dist/gcp/pubsub/utils/stubs/pubSubOrderRefundRequestedMessageStub.d.ts +2 -0
- package/dist/gcp/pubsub/utils/stubs/pubSubOrderRefundRequestedMessageStub.js +9 -0
- package/dist/gcp/pubsub/utils/stubs/pubSubProcessOrderRefundIntentMessageStub.d.ts +2 -0
- package/dist/gcp/pubsub/utils/stubs/pubSubProcessOrderRefundIntentMessageStub.js +10 -0
- package/dist/gcp/pubsub/utils/stubs/serviceProvider/index.d.ts +1 -0
- package/dist/gcp/pubsub/utils/stubs/serviceProvider/index.js +1 -0
- package/dist/gcp/pubsub/utils/stubs/serviceProvider/pubSubServiceProviderBookedSlotReleaseRequestedMessageStub.d.ts +2 -0
- package/dist/gcp/pubsub/utils/stubs/serviceProvider/pubSubServiceProviderBookedSlotReleaseRequestedMessageStub.js +15 -0
- package/dist/pricing/__tests__/calculateInvoiceTotalWithTax.test.d.ts +1 -0
- package/dist/pricing/__tests__/calculateInvoiceTotalWithTax.test.js +955 -0
- package/dist/pricing/__tests__/computeOrderPaymentBreakdownWithPlatformBalance.test.d.ts +1 -0
- package/dist/pricing/__tests__/computeOrderPaymentBreakdownWithPlatformBalance.test.js +58 -0
- package/dist/pricing/__tests__/computeOrderPaymentBreakdownWithPlatformBalance.util.test.d.ts +1 -0
- package/dist/pricing/__tests__/computeOrderPaymentBreakdownWithPlatformBalance.util.test.js +58 -0
- package/dist/pricing/computeOrderPaymentBreakdownWithPlatformBalance.d.ts +6 -0
- package/dist/pricing/computeOrderPaymentBreakdownWithPlatformBalance.js +22 -0
- package/dist/pricing/index.d.ts +1 -0
- package/dist/pricing/index.js +1 -0
- package/dist/pricing/types/ComputeOrderPaymentBreakdownWithPlatformBalanceParams.type.d.ts +5 -0
- package/dist/pricing/types/ComputeOrderPaymentBreakdownWithPlatformBalanceParams.type.js +2 -0
- package/dist/pricing/types/ComputeOrderPaymentBreakdownWithPlatformBalanceResult.type.d.ts +6 -0
- package/dist/pricing/types/ComputeOrderPaymentBreakdownWithPlatformBalanceResult.type.js +2 -0
- package/dist/pricing/types/index.d.ts +2 -0
- package/dist/pricing/types/index.js +2 -0
- package/dist/pricing/utils/applyBasisPointsRateHalfUp.util.js +1 -1
- package/dist/pricing/utils/stubs/computeOrderPaymentBreakdownWithPlatformBalanceStub.d.ts +2 -0
- package/dist/pricing/utils/stubs/computeOrderPaymentBreakdownWithPlatformBalanceStub.js +12 -0
- package/dist/pricing/utils/stubs/index.d.ts +1 -0
- package/dist/pricing/utils/stubs/index.js +1 -0
- package/dist/stripe/types/StripeCustomRefundMetadata.type.d.ts +8 -0
- package/dist/stripe/types/StripeCustomRefundMetadata.type.js +2 -0
- package/dist/stripe/types/index.d.ts +1 -0
- package/dist/stripe/types/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
|
+
}
|
package/dist/pricing/index.d.ts
CHANGED
package/dist/pricing/index.js
CHANGED
|
@@ -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
|
+
};
|
|
@@ -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.
|
|
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
|
+
}
|
|
@@ -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
|
+
};
|
|
@@ -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);
|