@stamhoofd/structures 2.106.1 → 2.107.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.
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/src/AppliedRegistrationDiscount.d.ts +1 -1
- package/dist/src/AppliedRegistrationDiscount.d.ts.map +1 -1
- package/dist/src/AppliedRegistrationDiscount.js +3 -1
- package/dist/src/AppliedRegistrationDiscount.js.map +1 -1
- package/dist/src/BalanceItem.d.ts +90 -14
- package/dist/src/BalanceItem.d.ts.map +1 -1
- package/dist/src/BalanceItem.js +173 -24
- package/dist/src/BalanceItem.js.map +1 -1
- package/dist/src/Document.d.ts.map +1 -1
- package/dist/src/Document.js +9 -4
- package/dist/src/Document.js.map +1 -1
- package/dist/src/GenericBalance.d.ts.map +1 -1
- package/dist/src/GenericBalance.js +5 -2
- package/dist/src/GenericBalance.js.map +1 -1
- package/dist/src/GroupPriceDiscount.d.ts +1 -0
- package/dist/src/GroupPriceDiscount.d.ts.map +1 -1
- package/dist/src/GroupPriceDiscount.js +28 -2
- package/dist/src/GroupPriceDiscount.js.map +1 -1
- package/dist/src/OldGroupPrices.d.ts.map +1 -1
- package/dist/src/OldGroupPrices.js +13 -6
- package/dist/src/OldGroupPrices.js.map +1 -1
- package/dist/src/OrganizationPrivateMetaData.d.ts.map +1 -1
- package/dist/src/OrganizationPrivateMetaData.js +3 -1
- package/dist/src/OrganizationPrivateMetaData.js.map +1 -1
- package/dist/src/PaymentConfiguration.d.ts.map +1 -1
- package/dist/src/PaymentConfiguration.js +8 -4
- package/dist/src/PaymentConfiguration.js.map +1 -1
- package/dist/src/PaymentMandate.d.ts +13 -0
- package/dist/src/PaymentMandate.d.ts.map +1 -0
- package/dist/src/PaymentMandate.js +8 -0
- package/dist/src/PaymentMandate.js.map +1 -0
- package/dist/src/PaymentType.d.ts +1 -0
- package/dist/src/PaymentType.d.ts.map +1 -1
- package/dist/src/PaymentType.js +8 -0
- package/dist/src/PaymentType.js.map +1 -1
- package/dist/src/Platform.d.ts.map +1 -1
- package/dist/src/Platform.js +3 -1
- package/dist/src/Platform.js.map +1 -1
- package/dist/src/ReceivableBalance.d.ts.map +1 -1
- package/dist/src/ReceivableBalance.js +9 -4
- package/dist/src/ReceivableBalance.js.map +1 -1
- package/dist/src/ReduceablePrice.d.ts.map +1 -1
- package/dist/src/ReduceablePrice.js +5 -2
- package/dist/src/ReduceablePrice.js.map +1 -1
- package/dist/src/RegisterCodeStatus.d.ts.map +1 -1
- package/dist/src/RegisterCodeStatus.js +9 -4
- package/dist/src/RegisterCodeStatus.js.map +1 -1
- package/dist/src/SeatingPlan.d.ts.map +1 -1
- package/dist/src/SeatingPlan.js +5 -2
- package/dist/src/SeatingPlan.js.map +1 -1
- package/dist/src/UitpasClientCredentialsStatus.d.ts +1 -1
- package/dist/src/Version.d.ts +1 -1
- package/dist/src/Version.js +1 -1
- package/dist/src/billing/Invoice.d.ts +51 -0
- package/dist/src/billing/Invoice.d.ts.map +1 -0
- package/dist/src/billing/Invoice.js +57 -0
- package/dist/src/billing/Invoice.js.map +1 -0
- package/dist/src/billing/InvoicedBalanceItem.d.ts +29 -0
- package/dist/src/billing/InvoicedBalanceItem.d.ts.map +1 -0
- package/dist/src/billing/InvoicedBalanceItem.js +64 -0
- package/dist/src/billing/InvoicedBalanceItem.js.map +1 -0
- package/dist/src/billing/STCredit.d.ts.map +1 -1
- package/dist/src/billing/STCredit.js +3 -1
- package/dist/src/billing/STCredit.js.map +1 -1
- package/dist/src/billing/STInvoice.d.ts +32 -5
- package/dist/src/billing/STInvoice.d.ts.map +1 -1
- package/dist/src/billing/STInvoice.js +70 -21
- package/dist/src/billing/STInvoice.js.map +1 -1
- package/dist/src/billing/STPackage.d.ts.map +1 -1
- package/dist/src/billing/STPackage.js +19 -9
- package/dist/src/billing/STPackage.js.map +1 -1
- package/dist/src/billing/STPackageBundle.js +2 -2
- package/dist/src/billing/STPackageBundle.js.map +1 -1
- package/dist/src/billing/index.d.ts +2 -0
- package/dist/src/billing/index.d.ts.map +1 -1
- package/dist/src/billing/index.js +2 -0
- package/dist/src/billing/index.js.map +1 -1
- package/dist/src/checkout/CheckoutResponse.d.ts +27 -0
- package/dist/src/checkout/CheckoutResponse.d.ts.map +1 -0
- package/dist/src/checkout/CheckoutResponse.js +47 -0
- package/dist/src/checkout/CheckoutResponse.js.map +1 -0
- package/dist/src/checkout/Checkoutable.d.ts +65 -0
- package/dist/src/checkout/Checkoutable.d.ts.map +1 -0
- package/dist/src/checkout/Checkoutable.js +96 -0
- package/dist/src/checkout/Checkoutable.js.map +1 -0
- package/dist/src/checkout/PackageCheckout.d.ts +17 -0
- package/dist/src/checkout/PackageCheckout.d.ts.map +1 -0
- package/dist/src/checkout/PackageCheckout.js +26 -0
- package/dist/src/checkout/PackageCheckout.js.map +1 -0
- package/dist/src/checkout/index.d.ts +3 -0
- package/dist/src/checkout/index.d.ts.map +1 -0
- package/dist/src/checkout/index.js +6 -0
- package/dist/src/checkout/index.js.map +1 -0
- package/dist/src/endpoints/ChargeMembershipsSummary.d.ts.map +1 -1
- package/dist/src/endpoints/ChargeMembershipsSummary.js +5 -2
- package/dist/src/endpoints/ChargeMembershipsSummary.js.map +1 -1
- package/dist/src/endpoints/PayableBalanceCollection.d.ts.map +1 -1
- package/dist/src/endpoints/PayableBalanceCollection.js +7 -3
- package/dist/src/endpoints/PayableBalanceCollection.js.map +1 -1
- package/dist/src/endpoints/UitpasPriceCheckRequest.d.ts.map +1 -1
- package/dist/src/endpoints/UitpasPriceCheckRequest.js +5 -2
- package/dist/src/endpoints/UitpasPriceCheckRequest.js.map +1 -1
- package/dist/src/filters/FilterCompilers.d.ts.map +1 -1
- package/dist/src/filters/FilterCompilers.js +16 -3
- package/dist/src/filters/FilterCompilers.js.map +1 -1
- package/dist/src/filters/convertOldPropertyFilter.d.ts.map +1 -1
- package/dist/src/filters/convertOldPropertyFilter.js +4 -8
- package/dist/src/filters/convertOldPropertyFilter.js.map +1 -1
- package/dist/src/members/MemberPlatformMembership.d.ts.map +1 -1
- package/dist/src/members/MemberPlatformMembership.js +5 -2
- package/dist/src/members/MemberPlatformMembership.js.map +1 -1
- package/dist/src/members/OrganizationRecordsConfiguration.d.ts.map +1 -1
- package/dist/src/members/OrganizationRecordsConfiguration.js +18 -2
- package/dist/src/members/OrganizationRecordsConfiguration.js.map +1 -1
- package/dist/src/members/Payment.d.ts.map +1 -1
- package/dist/src/members/Payment.js +17 -8
- package/dist/src/members/Payment.js.map +1 -1
- package/dist/src/members/PaymentGeneral.d.ts.map +1 -1
- package/dist/src/members/PaymentGeneral.js +9 -4
- package/dist/src/members/PaymentGeneral.js.map +1 -1
- package/dist/src/members/checkout/BalanceItemCartItem.d.ts.map +1 -1
- package/dist/src/members/checkout/BalanceItemCartItem.js +3 -1
- package/dist/src/members/checkout/BalanceItemCartItem.js.map +1 -1
- package/dist/src/members/checkout/RegisterCart.test.js +305 -259
- package/dist/src/members/checkout/RegisterCart.test.js.map +1 -1
- package/dist/src/members/checkout/RegisterCheckout.d.ts.map +1 -1
- package/dist/src/members/checkout/RegisterCheckout.js +28 -23
- package/dist/src/members/checkout/RegisterCheckout.js.map +1 -1
- package/dist/src/members/checkout/RegisterItem.d.ts.map +1 -1
- package/dist/src/members/checkout/RegisterItem.js +3 -1
- package/dist/src/members/checkout/RegisterItem.js.map +1 -1
- package/dist/src/upgradePriceFrom2To4DecimalPlaces.d.ts +9 -0
- package/dist/src/upgradePriceFrom2To4DecimalPlaces.d.ts.map +1 -0
- package/dist/src/upgradePriceFrom2To4DecimalPlaces.js +29 -0
- package/dist/src/upgradePriceFrom2To4DecimalPlaces.js.map +1 -0
- package/dist/src/webshops/CartItem.d.ts.map +1 -1
- package/dist/src/webshops/CartItem.js +8 -4
- package/dist/src/webshops/CartItem.js.map +1 -1
- package/dist/src/webshops/Checkout.d.ts.map +1 -1
- package/dist/src/webshops/Checkout.js +6 -3
- package/dist/src/webshops/Checkout.js.map +1 -1
- package/dist/src/webshops/Discount.d.ts.map +1 -1
- package/dist/src/webshops/Discount.js +6 -3
- package/dist/src/webshops/Discount.js.map +1 -1
- package/dist/src/webshops/Product.d.ts.map +1 -1
- package/dist/src/webshops/Product.js +7 -3
- package/dist/src/webshops/Product.js.map +1 -1
- package/dist/src/webshops/UitpasNumberAndPrice.d.ts.map +1 -1
- package/dist/src/webshops/UitpasNumberAndPrice.js +3 -1
- package/dist/src/webshops/UitpasNumberAndPrice.js.map +1 -1
- package/dist/src/webshops/WebshopMetaData.d.ts.map +1 -1
- package/dist/src/webshops/WebshopMetaData.js +7 -3
- package/dist/src/webshops/WebshopMetaData.js.map +1 -1
- package/esm/dist/index.d.ts +1 -2
- package/esm/dist/index.d.ts.map +1 -1
- package/esm/dist/index.js +2 -2
- package/esm/dist/index.js.map +1 -1
- package/esm/dist/src/AppliedRegistrationDiscount.d.ts +1 -1
- package/esm/dist/src/AppliedRegistrationDiscount.d.ts.map +1 -1
- package/esm/dist/src/AppliedRegistrationDiscount.js +3 -1
- package/esm/dist/src/AppliedRegistrationDiscount.js.map +1 -1
- package/esm/dist/src/BalanceItem.d.ts +90 -14
- package/esm/dist/src/BalanceItem.d.ts.map +1 -1
- package/esm/dist/src/BalanceItem.js +172 -24
- package/esm/dist/src/BalanceItem.js.map +1 -1
- package/esm/dist/src/Document.d.ts.map +1 -1
- package/esm/dist/src/Document.js +9 -4
- package/esm/dist/src/Document.js.map +1 -1
- package/esm/dist/src/GenericBalance.d.ts.map +1 -1
- package/esm/dist/src/GenericBalance.js +5 -2
- package/esm/dist/src/GenericBalance.js.map +1 -1
- package/esm/dist/src/GroupPriceDiscount.d.ts +1 -0
- package/esm/dist/src/GroupPriceDiscount.d.ts.map +1 -1
- package/esm/dist/src/GroupPriceDiscount.js +28 -2
- package/esm/dist/src/GroupPriceDiscount.js.map +1 -1
- package/esm/dist/src/OldGroupPrices.d.ts.map +1 -1
- package/esm/dist/src/OldGroupPrices.js +13 -6
- package/esm/dist/src/OldGroupPrices.js.map +1 -1
- package/esm/dist/src/OrganizationPrivateMetaData.d.ts.map +1 -1
- package/esm/dist/src/OrganizationPrivateMetaData.js +3 -1
- package/esm/dist/src/OrganizationPrivateMetaData.js.map +1 -1
- package/esm/dist/src/PaymentConfiguration.d.ts.map +1 -1
- package/esm/dist/src/PaymentConfiguration.js +8 -4
- package/esm/dist/src/PaymentConfiguration.js.map +1 -1
- package/esm/dist/src/PaymentMandate.d.ts +13 -0
- package/esm/dist/src/PaymentMandate.d.ts.map +1 -0
- package/esm/dist/src/PaymentMandate.js +4 -0
- package/esm/dist/src/PaymentMandate.js.map +1 -0
- package/esm/dist/src/PaymentType.d.ts +1 -0
- package/esm/dist/src/PaymentType.d.ts.map +1 -1
- package/esm/dist/src/PaymentType.js +8 -0
- package/esm/dist/src/PaymentType.js.map +1 -1
- package/esm/dist/src/Platform.d.ts.map +1 -1
- package/esm/dist/src/Platform.js +3 -1
- package/esm/dist/src/Platform.js.map +1 -1
- package/esm/dist/src/ReceivableBalance.d.ts.map +1 -1
- package/esm/dist/src/ReceivableBalance.js +9 -4
- package/esm/dist/src/ReceivableBalance.js.map +1 -1
- package/esm/dist/src/ReduceablePrice.d.ts.map +1 -1
- package/esm/dist/src/ReduceablePrice.js +5 -2
- package/esm/dist/src/ReduceablePrice.js.map +1 -1
- package/esm/dist/src/RegisterCodeStatus.d.ts.map +1 -1
- package/esm/dist/src/RegisterCodeStatus.js +9 -4
- package/esm/dist/src/RegisterCodeStatus.js.map +1 -1
- package/esm/dist/src/SeatingPlan.d.ts.map +1 -1
- package/esm/dist/src/SeatingPlan.js +5 -2
- package/esm/dist/src/SeatingPlan.js.map +1 -1
- package/esm/dist/src/UitpasClientCredentialsStatus.d.ts +1 -1
- package/esm/dist/src/Version.d.ts +1 -1
- package/esm/dist/src/Version.js +1 -1
- package/esm/dist/src/billing/Invoice.d.ts +51 -0
- package/esm/dist/src/billing/Invoice.d.ts.map +1 -0
- package/esm/dist/src/billing/Invoice.js +53 -0
- package/esm/dist/src/billing/Invoice.js.map +1 -0
- package/esm/dist/src/billing/InvoicedBalanceItem.d.ts +29 -0
- package/esm/dist/src/billing/InvoicedBalanceItem.d.ts.map +1 -0
- package/esm/dist/src/billing/InvoicedBalanceItem.js +60 -0
- package/esm/dist/src/billing/InvoicedBalanceItem.js.map +1 -0
- package/esm/dist/src/billing/STCredit.d.ts.map +1 -1
- package/esm/dist/src/billing/STCredit.js +3 -1
- package/esm/dist/src/billing/STCredit.js.map +1 -1
- package/esm/dist/src/billing/STInvoice.d.ts +32 -5
- package/esm/dist/src/billing/STInvoice.d.ts.map +1 -1
- package/esm/dist/src/billing/STInvoice.js +61 -12
- package/esm/dist/src/billing/STInvoice.js.map +1 -1
- package/esm/dist/src/billing/STPackage.d.ts.map +1 -1
- package/esm/dist/src/billing/STPackage.js +19 -9
- package/esm/dist/src/billing/STPackage.js.map +1 -1
- package/esm/dist/src/billing/STPackageBundle.js +2 -2
- package/esm/dist/src/billing/STPackageBundle.js.map +1 -1
- package/esm/dist/src/billing/index.d.ts +2 -0
- package/esm/dist/src/billing/index.d.ts.map +1 -1
- package/esm/dist/src/billing/index.js +2 -0
- package/esm/dist/src/billing/index.js.map +1 -1
- package/esm/dist/src/checkout/Checkoutable.d.ts +65 -0
- package/esm/dist/src/checkout/Checkoutable.d.ts.map +1 -0
- package/esm/dist/src/checkout/Checkoutable.js +92 -0
- package/esm/dist/src/checkout/Checkoutable.js.map +1 -0
- package/esm/dist/src/checkout/PackageCheckout.d.ts +17 -0
- package/esm/dist/src/checkout/PackageCheckout.d.ts.map +1 -0
- package/esm/dist/src/checkout/PackageCheckout.js +21 -0
- package/esm/dist/src/checkout/PackageCheckout.js.map +1 -0
- package/esm/dist/src/checkout/index.d.ts +3 -0
- package/esm/dist/src/checkout/index.d.ts.map +1 -0
- package/esm/dist/src/checkout/index.js +3 -0
- package/esm/dist/src/checkout/index.js.map +1 -0
- package/esm/dist/src/endpoints/ChargeMembershipsSummary.d.ts.map +1 -1
- package/esm/dist/src/endpoints/ChargeMembershipsSummary.js +5 -2
- package/esm/dist/src/endpoints/ChargeMembershipsSummary.js.map +1 -1
- package/esm/dist/src/endpoints/PayableBalanceCollection.d.ts.map +1 -1
- package/esm/dist/src/endpoints/PayableBalanceCollection.js +7 -3
- package/esm/dist/src/endpoints/PayableBalanceCollection.js.map +1 -1
- package/esm/dist/src/endpoints/UitpasPriceCheckRequest.d.ts.map +1 -1
- package/esm/dist/src/endpoints/UitpasPriceCheckRequest.js +5 -2
- package/esm/dist/src/endpoints/UitpasPriceCheckRequest.js.map +1 -1
- package/esm/dist/src/filters/FilterCompilers.d.ts.map +1 -1
- package/esm/dist/src/filters/FilterCompilers.js +16 -3
- package/esm/dist/src/filters/FilterCompilers.js.map +1 -1
- package/esm/dist/src/filters/convertOldPropertyFilter.d.ts.map +1 -1
- package/esm/dist/src/filters/convertOldPropertyFilter.js +4 -8
- package/esm/dist/src/filters/convertOldPropertyFilter.js.map +1 -1
- package/esm/dist/src/members/MemberPlatformMembership.d.ts.map +1 -1
- package/esm/dist/src/members/MemberPlatformMembership.js +5 -2
- package/esm/dist/src/members/MemberPlatformMembership.js.map +1 -1
- package/esm/dist/src/members/OrganizationRecordsConfiguration.d.ts.map +1 -1
- package/esm/dist/src/members/OrganizationRecordsConfiguration.js +18 -2
- package/esm/dist/src/members/OrganizationRecordsConfiguration.js.map +1 -1
- package/esm/dist/src/members/Payment.d.ts.map +1 -1
- package/esm/dist/src/members/Payment.js +17 -8
- package/esm/dist/src/members/Payment.js.map +1 -1
- package/esm/dist/src/members/PaymentGeneral.d.ts.map +1 -1
- package/esm/dist/src/members/PaymentGeneral.js +9 -4
- package/esm/dist/src/members/PaymentGeneral.js.map +1 -1
- package/esm/dist/src/members/checkout/BalanceItemCartItem.d.ts.map +1 -1
- package/esm/dist/src/members/checkout/BalanceItemCartItem.js +3 -1
- package/esm/dist/src/members/checkout/BalanceItemCartItem.js.map +1 -1
- package/esm/dist/src/members/checkout/RegisterCheckout.d.ts.map +1 -1
- package/esm/dist/src/members/checkout/RegisterCheckout.js +28 -23
- package/esm/dist/src/members/checkout/RegisterCheckout.js.map +1 -1
- package/esm/dist/src/members/checkout/RegisterItem.d.ts.map +1 -1
- package/esm/dist/src/members/checkout/RegisterItem.js +3 -1
- package/esm/dist/src/members/checkout/RegisterItem.js.map +1 -1
- package/esm/dist/src/upgradePriceFrom2To4DecimalPlaces.d.ts +9 -0
- package/esm/dist/src/upgradePriceFrom2To4DecimalPlaces.d.ts.map +1 -0
- package/esm/dist/src/upgradePriceFrom2To4DecimalPlaces.js +26 -0
- package/esm/dist/src/upgradePriceFrom2To4DecimalPlaces.js.map +1 -0
- package/esm/dist/src/webshops/CartItem.d.ts.map +1 -1
- package/esm/dist/src/webshops/CartItem.js +8 -4
- package/esm/dist/src/webshops/CartItem.js.map +1 -1
- package/esm/dist/src/webshops/Checkout.d.ts.map +1 -1
- package/esm/dist/src/webshops/Checkout.js +6 -3
- package/esm/dist/src/webshops/Checkout.js.map +1 -1
- package/esm/dist/src/webshops/Discount.d.ts.map +1 -1
- package/esm/dist/src/webshops/Discount.js +6 -3
- package/esm/dist/src/webshops/Discount.js.map +1 -1
- package/esm/dist/src/webshops/Product.d.ts.map +1 -1
- package/esm/dist/src/webshops/Product.js +7 -3
- package/esm/dist/src/webshops/Product.js.map +1 -1
- package/esm/dist/src/webshops/UitpasNumberAndPrice.d.ts.map +1 -1
- package/esm/dist/src/webshops/UitpasNumberAndPrice.js +3 -1
- package/esm/dist/src/webshops/UitpasNumberAndPrice.js.map +1 -1
- package/esm/dist/src/webshops/WebshopMetaData.d.ts.map +1 -1
- package/esm/dist/src/webshops/WebshopMetaData.js +7 -3
- package/esm/dist/src/webshops/WebshopMetaData.js.map +1 -1
- package/package.json +2 -2
- package/dist/src/members/PaymentPatch.d.ts +0 -14
- package/dist/src/members/PaymentPatch.d.ts.map +0 -1
- package/dist/src/members/PaymentPatch.js +0 -33
- package/dist/src/members/PaymentPatch.js.map +0 -1
- package/dist/src/members/RegistrationPatch.d.ts +0 -9
- package/dist/src/members/RegistrationPatch.d.ts.map +0 -1
- package/dist/src/members/RegistrationPatch.js +0 -24
- package/dist/src/members/RegistrationPatch.js.map +0 -1
- package/esm/dist/src/members/PaymentPatch.d.ts +0 -14
- package/esm/dist/src/members/PaymentPatch.d.ts.map +0 -1
- package/esm/dist/src/members/PaymentPatch.js +0 -29
- package/esm/dist/src/members/PaymentPatch.js.map +0 -1
- package/esm/dist/src/members/RegistrationPatch.d.ts +0 -9
- package/esm/dist/src/members/RegistrationPatch.d.ts.map +0 -1
- package/esm/dist/src/members/RegistrationPatch.js +0 -20
- package/esm/dist/src/members/RegistrationPatch.js.map +0 -1
|
@@ -30,7 +30,7 @@ function createTestPeriod() {
|
|
|
30
30
|
});
|
|
31
31
|
return { period, organizationRegistrationPeriod, organization };
|
|
32
32
|
}
|
|
33
|
-
function createTestGroups(organization, period, prices = [
|
|
33
|
+
function createTestGroups(organization, period, prices = [500000, 400000], names) {
|
|
34
34
|
return prices.map((price, index) => {
|
|
35
35
|
return Group_js_1.Group.create({
|
|
36
36
|
organizationId: organization.id,
|
|
@@ -49,8 +49,8 @@ function createTestGroups(organization, period, prices = [5000, 4000], names) {
|
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
function createBundleDiscount({ name = 'Bundle discount', countWholeFamily = true, countPerGroup = false, discounts = [
|
|
52
|
-
{ value:
|
|
53
|
-
{ value:
|
|
52
|
+
{ value: 100000, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Fixed },
|
|
53
|
+
{ value: 150000, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Fixed },
|
|
54
54
|
], } = {}) {
|
|
55
55
|
return BundleDiscount_js_1.BundleDiscount.create({
|
|
56
56
|
name: new TranslatedString_js_1.TranslatedString(name),
|
|
@@ -83,7 +83,7 @@ function createTestFamily(memberCount = 3) {
|
|
|
83
83
|
});
|
|
84
84
|
return PlatformMember_js_1.PlatformFamily.create(blob, { platform: Platform_js_1.Platform.create({}) });
|
|
85
85
|
}
|
|
86
|
-
function setupDiscountTest({ memberCount = 3, groupPrices = [
|
|
86
|
+
function setupDiscountTest({ memberCount = 3, groupPrices = [500000, 400000], groupNames, bundleDiscount, } = {}) {
|
|
87
87
|
const { period, organizationRegistrationPeriod, organization } = createTestPeriod();
|
|
88
88
|
const groups = createTestGroups(organization, period, groupPrices, groupNames);
|
|
89
89
|
organizationRegistrationPeriod.groups = groups;
|
|
@@ -135,8 +135,8 @@ describe('Unit.RegisterCart', () => {
|
|
|
135
135
|
bundleDiscount: createBundleDiscount({
|
|
136
136
|
name: 'Bundle discount',
|
|
137
137
|
discounts: [
|
|
138
|
-
{ value:
|
|
139
|
-
{ value:
|
|
138
|
+
{ value: 100000, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Fixed },
|
|
139
|
+
{ value: 150000, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Fixed },
|
|
140
140
|
],
|
|
141
141
|
}),
|
|
142
142
|
});
|
|
@@ -153,33 +153,33 @@ describe('Unit.RegisterCart', () => {
|
|
|
153
153
|
cart.add(itemC);
|
|
154
154
|
cart.calculatePrices();
|
|
155
155
|
// Check price for item A is 50.00
|
|
156
|
-
expect(itemA.calculatedPrice).toEqual(
|
|
156
|
+
expect(itemA.calculatedPrice).toEqual(500000);
|
|
157
157
|
expect(itemA.calculatedRefund).toEqual(0);
|
|
158
158
|
expect(itemA.calculatedPriceDueLater).toEqual(0);
|
|
159
159
|
// Check price for items B and C
|
|
160
|
-
expect(itemB.calculatedPrice).toEqual(
|
|
160
|
+
expect(itemB.calculatedPrice).toEqual(400000);
|
|
161
161
|
expect(itemB.calculatedRefund).toEqual(0);
|
|
162
162
|
expect(itemB.calculatedPriceDueLater).toEqual(0);
|
|
163
|
-
expect(itemC.calculatedPrice).toEqual(
|
|
163
|
+
expect(itemC.calculatedPrice).toEqual(400000);
|
|
164
164
|
expect(itemC.calculatedRefund).toEqual(0);
|
|
165
165
|
expect(itemC.calculatedPriceDueLater).toEqual(0);
|
|
166
|
-
// Check calculated discount is
|
|
166
|
+
// Check calculated discount is 10_0000 + 15_0000 = 25_0000
|
|
167
167
|
expect(cart.bundleDiscounts).toHaveLength(1);
|
|
168
|
-
expect(cart.bundleDiscounts[0].total).toEqual(
|
|
168
|
+
expect(cart.bundleDiscounts[0].total).toEqual(250000);
|
|
169
169
|
expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(0);
|
|
170
|
-
expect(cart.bundleDiscounts[0].netTotal).toEqual(
|
|
171
|
-
expect(cart.price).toEqual(
|
|
172
|
-
expect(checkout.totalPrice).toEqual(
|
|
170
|
+
expect(cart.bundleDiscounts[0].netTotal).toEqual(250000);
|
|
171
|
+
expect(cart.price).toEqual(500000 + 400000 + 400000);
|
|
172
|
+
expect(checkout.totalPrice).toEqual(500000 + 400000 + 400000 - 250000);
|
|
173
173
|
expect(checkout.priceBreakown).toEqual([
|
|
174
174
|
expect.objectContaining({
|
|
175
|
-
price:
|
|
175
|
+
price: 1300000,
|
|
176
176
|
}),
|
|
177
177
|
{
|
|
178
178
|
name: 'Bundle discount',
|
|
179
|
-
price: -
|
|
179
|
+
price: -250000,
|
|
180
180
|
},
|
|
181
181
|
expect.objectContaining({
|
|
182
|
-
price:
|
|
182
|
+
price: 1300000 - 250000,
|
|
183
183
|
}),
|
|
184
184
|
]);
|
|
185
185
|
});
|
|
@@ -206,26 +206,72 @@ describe('Unit.RegisterCart', () => {
|
|
|
206
206
|
cart.add(itemC);
|
|
207
207
|
cart.calculatePrices();
|
|
208
208
|
// Check price for items
|
|
209
|
-
expect(itemA.calculatedPrice).toEqual(
|
|
210
|
-
expect(itemB.calculatedPrice).toEqual(
|
|
211
|
-
expect(itemC.calculatedPrice).toEqual(
|
|
209
|
+
expect(itemA.calculatedPrice).toEqual(500000);
|
|
210
|
+
expect(itemB.calculatedPrice).toEqual(400000);
|
|
211
|
+
expect(itemC.calculatedPrice).toEqual(400000);
|
|
212
212
|
// 15% will be applied to 50 euro (max), and 10% to one of the 40 euros
|
|
213
|
-
// Check calculated discount is
|
|
213
|
+
// Check calculated discount is 50_0000 * 0.15 + 40_0000 * 0.10 = 7_5000 + 4_0000 = 11_5000
|
|
214
|
+
expect(cart.bundleDiscounts).toHaveLength(1);
|
|
215
|
+
expect(cart.bundleDiscounts[0].total).toEqual(115000);
|
|
216
|
+
expect(cart.bundleDiscounts[0].netTotal).toEqual(115000);
|
|
217
|
+
expect(cart.price).toEqual(500000 + 400000 + 400000);
|
|
218
|
+
expect(checkout.totalPrice).toEqual(500000 + 400000 + 400000 - 115000);
|
|
219
|
+
expect(checkout.priceBreakown).toEqual([
|
|
220
|
+
expect.objectContaining({
|
|
221
|
+
price: 1300000,
|
|
222
|
+
}),
|
|
223
|
+
{
|
|
224
|
+
name: 'Bundle discount',
|
|
225
|
+
price: -115000,
|
|
226
|
+
},
|
|
227
|
+
expect.objectContaining({
|
|
228
|
+
price: 1300000 - 115000,
|
|
229
|
+
}),
|
|
230
|
+
]);
|
|
231
|
+
});
|
|
232
|
+
test('Percentage discounts are rounded to 1 cent', () => {
|
|
233
|
+
const { organization, groups, family } = setupDiscountTest({
|
|
234
|
+
bundleDiscount: createBundleDiscount({
|
|
235
|
+
name: 'Bundle discount',
|
|
236
|
+
discounts: [
|
|
237
|
+
{ value: 111, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Percentage },
|
|
238
|
+
{ value: 152, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Percentage },
|
|
239
|
+
],
|
|
240
|
+
}),
|
|
241
|
+
});
|
|
242
|
+
const [groupA, groupB] = groups;
|
|
243
|
+
const [memberA, memberB, memberC] = family.members;
|
|
244
|
+
const itemA = RegisterItem_js_1.RegisterItem.defaultFor(memberA, groupA, organization);
|
|
245
|
+
const itemB = RegisterItem_js_1.RegisterItem.defaultFor(memberB, groupB, organization);
|
|
246
|
+
const itemC = RegisterItem_js_1.RegisterItem.defaultFor(memberC, groupB, organization);
|
|
247
|
+
// Add to a single cart
|
|
248
|
+
const checkout = family.checkout;
|
|
249
|
+
const cart = checkout.cart;
|
|
250
|
+
cart.add(itemA);
|
|
251
|
+
cart.add(itemB);
|
|
252
|
+
cart.add(itemC);
|
|
253
|
+
cart.calculatePrices();
|
|
254
|
+
// Check price for items
|
|
255
|
+
expect(itemA.calculatedPrice).toEqual(500000);
|
|
256
|
+
expect(itemB.calculatedPrice).toEqual(400000);
|
|
257
|
+
expect(itemC.calculatedPrice).toEqual(400000);
|
|
258
|
+
// 1,5% will be applied to 50 euro (max), and 1% to one of the 40 euros
|
|
259
|
+
// Check calculated discount is 50_0000 * 0.0152 + 40_0000 * 0.0111 = 7500 + 4000 = 1_2040 normally, but not allowed, rounded to 1_2000
|
|
214
260
|
expect(cart.bundleDiscounts).toHaveLength(1);
|
|
215
|
-
expect(cart.bundleDiscounts[0].total).toEqual(
|
|
216
|
-
expect(cart.bundleDiscounts[0].netTotal).toEqual(
|
|
217
|
-
expect(cart.price).toEqual(
|
|
218
|
-
expect(checkout.totalPrice).toEqual(
|
|
261
|
+
expect(cart.bundleDiscounts[0].total).toEqual(12000);
|
|
262
|
+
expect(cart.bundleDiscounts[0].netTotal).toEqual(12000);
|
|
263
|
+
expect(cart.price).toEqual(500000 + 400000 + 400000);
|
|
264
|
+
expect(checkout.totalPrice).toEqual(500000 + 400000 + 400000 - 12000);
|
|
219
265
|
expect(checkout.priceBreakown).toEqual([
|
|
220
266
|
expect.objectContaining({
|
|
221
|
-
price:
|
|
267
|
+
price: 1300000,
|
|
222
268
|
}),
|
|
223
269
|
{
|
|
224
270
|
name: 'Bundle discount',
|
|
225
|
-
price: -
|
|
271
|
+
price: -12000,
|
|
226
272
|
},
|
|
227
273
|
expect.objectContaining({
|
|
228
|
-
price:
|
|
274
|
+
price: 1300000 - 12000,
|
|
229
275
|
}),
|
|
230
276
|
]);
|
|
231
277
|
});
|
|
@@ -252,25 +298,25 @@ describe('Unit.RegisterCart', () => {
|
|
|
252
298
|
cart.add(itemC);
|
|
253
299
|
cart.calculatePrices();
|
|
254
300
|
// Check price for items
|
|
255
|
-
expect(itemB.calculatedPrice).toEqual(
|
|
256
|
-
expect(itemC.calculatedPrice).toEqual(
|
|
301
|
+
expect(itemB.calculatedPrice).toEqual(400000);
|
|
302
|
+
expect(itemC.calculatedPrice).toEqual(400000);
|
|
257
303
|
// 15% will be applied to 50 euro (max), and 10% to one of the 40 euros
|
|
258
|
-
// Check calculated discount is
|
|
304
|
+
// Check calculated discount is 50_0000 * 0.15 + 40_0000 * 0.10 = 7_5000 + 4_0000 = 11_5000
|
|
259
305
|
expect(cart.bundleDiscounts).toHaveLength(1);
|
|
260
|
-
expect(cart.bundleDiscounts[0].total).toEqual(
|
|
261
|
-
expect(cart.bundleDiscounts[0].netTotal).toEqual(
|
|
262
|
-
expect(cart.price).toEqual(
|
|
263
|
-
expect(checkout.totalPrice).toEqual(
|
|
306
|
+
expect(cart.bundleDiscounts[0].total).toEqual(115000);
|
|
307
|
+
expect(cart.bundleDiscounts[0].netTotal).toEqual(115000);
|
|
308
|
+
expect(cart.price).toEqual(400000 + 400000);
|
|
309
|
+
expect(checkout.totalPrice).toEqual(400000 + 400000 - 115000);
|
|
264
310
|
expect(checkout.priceBreakown).toEqual([
|
|
265
311
|
expect.objectContaining({
|
|
266
|
-
price:
|
|
312
|
+
price: 800000,
|
|
267
313
|
}),
|
|
268
314
|
{
|
|
269
315
|
name: 'Bundle discount',
|
|
270
|
-
price: -
|
|
316
|
+
price: -115000,
|
|
271
317
|
},
|
|
272
318
|
expect.objectContaining({
|
|
273
|
-
price:
|
|
319
|
+
price: 800000 - 115000,
|
|
274
320
|
}),
|
|
275
321
|
]);
|
|
276
322
|
});
|
|
@@ -291,7 +337,7 @@ describe('Unit.RegisterCart', () => {
|
|
|
291
337
|
{ value: 1500, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Percentage },
|
|
292
338
|
],
|
|
293
339
|
}),
|
|
294
|
-
groupPrices: [
|
|
340
|
+
groupPrices: [1000000, 400000],
|
|
295
341
|
});
|
|
296
342
|
const [groupA, groupB] = groups;
|
|
297
343
|
const [memberA, memberB] = family.members;
|
|
@@ -301,7 +347,7 @@ describe('Unit.RegisterCart', () => {
|
|
|
301
347
|
discount.id,
|
|
302
348
|
AppliedRegistrationDiscount_js_1.AppliedRegistrationDiscount.create({
|
|
303
349
|
name: discount.name,
|
|
304
|
-
amount:
|
|
350
|
+
amount: 100000, // 10% discount on 100_0000 = 10_0000
|
|
305
351
|
}),
|
|
306
352
|
],
|
|
307
353
|
]));
|
|
@@ -314,13 +360,13 @@ describe('Unit.RegisterCart', () => {
|
|
|
314
360
|
}));
|
|
315
361
|
cart.calculatePrices();
|
|
316
362
|
expect(cart.bundleDiscounts).toHaveLength(0);
|
|
317
|
-
expect(checkout.totalPrice).toEqual(-
|
|
363
|
+
expect(checkout.totalPrice).toEqual(-300000);
|
|
318
364
|
expect(checkout.priceBreakown).toEqual([
|
|
319
365
|
expect.objectContaining({
|
|
320
|
-
price: -
|
|
366
|
+
price: -400000 + 100000,
|
|
321
367
|
}),
|
|
322
368
|
expect.objectContaining({
|
|
323
|
-
price: -
|
|
369
|
+
price: -400000 + 100000,
|
|
324
370
|
}),
|
|
325
371
|
]);
|
|
326
372
|
// Now readd the registration
|
|
@@ -336,19 +382,19 @@ describe('Unit.RegisterCart', () => {
|
|
|
336
382
|
cart.calculatePrices();
|
|
337
383
|
expect(cart.bundleDiscounts).toHaveLength(1);
|
|
338
384
|
expect(cart.bundleDiscounts[0].total).toEqual(0);
|
|
339
|
-
expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(
|
|
340
|
-
expect(cart.bundleDiscounts[0].netTotal).toEqual(-
|
|
341
|
-
expect(checkout.totalPrice).toEqual(-
|
|
385
|
+
expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(100000); // The previous discount
|
|
386
|
+
expect(cart.bundleDiscounts[0].netTotal).toEqual(-100000);
|
|
387
|
+
expect(checkout.totalPrice).toEqual(-900000);
|
|
342
388
|
expect(checkout.priceBreakown).toEqual([
|
|
343
|
-
expect.objectContaining({
|
|
344
|
-
price: -10000, // Reeds aangerekend
|
|
345
|
-
}),
|
|
346
389
|
{
|
|
347
390
|
name: '766a39be-a4af-4a04-baf0-1f064d2fed16 (Multiple family members discount)',
|
|
348
|
-
price:
|
|
391
|
+
price: 100000,
|
|
349
392
|
},
|
|
350
393
|
expect.objectContaining({
|
|
351
|
-
price: -
|
|
394
|
+
price: -1000000, // Reeds aangerekend
|
|
395
|
+
}),
|
|
396
|
+
expect.objectContaining({
|
|
397
|
+
price: -900000,
|
|
352
398
|
}),
|
|
353
399
|
]);
|
|
354
400
|
});
|
|
@@ -369,7 +415,7 @@ describe('Unit.RegisterCart', () => {
|
|
|
369
415
|
{ value: 1500, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Percentage },
|
|
370
416
|
],
|
|
371
417
|
}),
|
|
372
|
-
groupPrices: [
|
|
418
|
+
groupPrices: [1000000, 400000],
|
|
373
419
|
});
|
|
374
420
|
const [groupA, groupB] = groups;
|
|
375
421
|
const [memberA, memberB] = family.members;
|
|
@@ -379,7 +425,7 @@ describe('Unit.RegisterCart', () => {
|
|
|
379
425
|
discount.id,
|
|
380
426
|
AppliedRegistrationDiscount_js_1.AppliedRegistrationDiscount.create({
|
|
381
427
|
name: discount.name,
|
|
382
|
-
amount:
|
|
428
|
+
amount: 100000, // 10% discount on 1_0000 = 10_00
|
|
383
429
|
}),
|
|
384
430
|
],
|
|
385
431
|
]));
|
|
@@ -393,17 +439,17 @@ describe('Unit.RegisterCart', () => {
|
|
|
393
439
|
}));
|
|
394
440
|
cart.calculatePrices();
|
|
395
441
|
expect(cart.bundleDiscounts).toHaveLength(0);
|
|
396
|
-
expect(checkout.totalPrice).toEqual(-
|
|
442
|
+
expect(checkout.totalPrice).toEqual(-150000);
|
|
397
443
|
expect(checkout.priceBreakown).toEqual([
|
|
398
444
|
expect.objectContaining({
|
|
399
|
-
price: -
|
|
445
|
+
price: -400000 + 100000, // Already charged amount
|
|
400
446
|
}),
|
|
401
|
-
// Cancellation fee = 50% of the balance total,
|
|
447
|
+
// Cancellation fee = 50% of the balance total, 30_0000 = 15_0000
|
|
402
448
|
expect.objectContaining({
|
|
403
|
-
price:
|
|
449
|
+
price: 150000,
|
|
404
450
|
}),
|
|
405
451
|
expect.objectContaining({
|
|
406
|
-
price: -
|
|
452
|
+
price: -150000,
|
|
407
453
|
}),
|
|
408
454
|
]);
|
|
409
455
|
// Now readd the registration
|
|
@@ -419,24 +465,24 @@ describe('Unit.RegisterCart', () => {
|
|
|
419
465
|
cart.calculatePrices();
|
|
420
466
|
expect(cart.bundleDiscounts).toHaveLength(1);
|
|
421
467
|
expect(cart.bundleDiscounts[0].total).toEqual(0);
|
|
422
|
-
expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(
|
|
423
|
-
expect(cart.bundleDiscounts[0].netTotal).toEqual(-
|
|
424
|
-
expect(checkout.totalPrice).toEqual(-
|
|
468
|
+
expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(100000); // The previous discount
|
|
469
|
+
expect(cart.bundleDiscounts[0].netTotal).toEqual(-100000);
|
|
470
|
+
expect(checkout.totalPrice).toEqual(-400000);
|
|
425
471
|
expect(checkout.priceBreakown).toEqual([
|
|
426
|
-
expect.objectContaining({
|
|
427
|
-
price: -10000, // Already charged for registration A that is being deleted
|
|
428
|
-
}),
|
|
429
|
-
// Cancellation fee = 50% of the balance total, 100_00 = 50_00
|
|
430
|
-
expect.objectContaining({
|
|
431
|
-
price: 5000,
|
|
432
|
-
}),
|
|
433
472
|
{
|
|
434
473
|
// Side effect in registration B
|
|
435
474
|
name: '766a39be-a4af-4a04-baf0-1f064d2fed16 (Multiple family members discount)',
|
|
436
|
-
price:
|
|
475
|
+
price: 100000,
|
|
437
476
|
},
|
|
438
477
|
expect.objectContaining({
|
|
439
|
-
price: -
|
|
478
|
+
price: -1000000, // Already charged for registration A that is being deleted
|
|
479
|
+
}),
|
|
480
|
+
// Cancellation fee = 50% of the balance total, 100_0000 = 50_0000
|
|
481
|
+
expect.objectContaining({
|
|
482
|
+
price: 500000,
|
|
483
|
+
}),
|
|
484
|
+
expect.objectContaining({
|
|
485
|
+
price: -400000,
|
|
440
486
|
}),
|
|
441
487
|
]);
|
|
442
488
|
});
|
|
@@ -456,7 +502,7 @@ describe('Unit.RegisterCart', () => {
|
|
|
456
502
|
{ value: 1500, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Percentage },
|
|
457
503
|
],
|
|
458
504
|
}),
|
|
459
|
-
groupPrices: [
|
|
505
|
+
groupPrices: [1000000, 400000],
|
|
460
506
|
});
|
|
461
507
|
const [groupA, groupB] = groups;
|
|
462
508
|
const [memberA, memberB] = family.members;
|
|
@@ -466,13 +512,13 @@ describe('Unit.RegisterCart', () => {
|
|
|
466
512
|
discount.id,
|
|
467
513
|
AppliedRegistrationDiscount_js_1.AppliedRegistrationDiscount.create({
|
|
468
514
|
name: discount.name,
|
|
469
|
-
amount:
|
|
515
|
+
amount: 100000, // 10% discount on 100_0000 = 10_0000
|
|
470
516
|
}),
|
|
471
517
|
],
|
|
472
518
|
]));
|
|
473
519
|
const groupCPrice = GroupSettings_js_1.GroupPrice.create({
|
|
474
520
|
price: ReduceablePrice_js_1.ReduceablePrice.create({
|
|
475
|
-
price:
|
|
521
|
+
price: 500000,
|
|
476
522
|
}),
|
|
477
523
|
});
|
|
478
524
|
const groupC = Group_js_1.Group.create({
|
|
@@ -497,30 +543,30 @@ describe('Unit.RegisterCart', () => {
|
|
|
497
543
|
cart.add(itemA);
|
|
498
544
|
cart.calculatePrices();
|
|
499
545
|
// Check price for items
|
|
500
|
-
expect(itemA.calculatedPrice).toEqual(
|
|
501
|
-
expect(itemA.calculatedRefund).toEqual(
|
|
546
|
+
expect(itemA.calculatedPrice).toEqual(500000);
|
|
547
|
+
expect(itemA.calculatedRefund).toEqual(1000000);
|
|
502
548
|
expect(itemA.calculatedPriceDueLater).toEqual(0);
|
|
503
549
|
// Check discount should be given back
|
|
504
550
|
expect(cart.bundleDiscounts).toHaveLength(1);
|
|
505
551
|
expect(cart.bundleDiscounts[0].total).toEqual(0);
|
|
506
|
-
expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(
|
|
507
|
-
expect(cart.bundleDiscounts[0].netTotal).toEqual(-
|
|
508
|
-
expect(checkout.totalPrice).toEqual(
|
|
552
|
+
expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(100000); // The previous discount
|
|
553
|
+
expect(cart.bundleDiscounts[0].netTotal).toEqual(-100000);
|
|
554
|
+
expect(checkout.totalPrice).toEqual(500000 - 1000000 + 100000);
|
|
509
555
|
expect(checkout.priceBreakown).toEqual([
|
|
510
556
|
expect.objectContaining({
|
|
511
557
|
// Subtotal (normal price)
|
|
512
|
-
price:
|
|
513
|
-
}),
|
|
514
|
-
expect.objectContaining({
|
|
515
|
-
// Refund for the previous registration
|
|
516
|
-
price: -10000,
|
|
558
|
+
price: 500000,
|
|
517
559
|
}),
|
|
518
560
|
{
|
|
519
561
|
name: '766a39be-a4af-4a04-baf0-1f064d2fed16 (Multiple family members discount)',
|
|
520
|
-
price:
|
|
562
|
+
price: 100000,
|
|
521
563
|
},
|
|
522
564
|
expect.objectContaining({
|
|
523
|
-
|
|
565
|
+
// Refund for the previous registration
|
|
566
|
+
price: -1000000,
|
|
567
|
+
}),
|
|
568
|
+
expect.objectContaining({
|
|
569
|
+
price: -500000 + 100000,
|
|
524
570
|
}),
|
|
525
571
|
]);
|
|
526
572
|
// Now, what if groupC does have a higher discount instead of no discount?
|
|
@@ -530,7 +576,7 @@ describe('Unit.RegisterCart', () => {
|
|
|
530
576
|
// Custom discount for this price
|
|
531
577
|
GroupPriceDiscount_js_1.GroupPriceDiscount.create({
|
|
532
578
|
value: ReduceablePrice_js_1.ReduceablePrice.create({
|
|
533
|
-
price:
|
|
579
|
+
price: 250000,
|
|
534
580
|
}),
|
|
535
581
|
type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Fixed,
|
|
536
582
|
}),
|
|
@@ -540,25 +586,25 @@ describe('Unit.RegisterCart', () => {
|
|
|
540
586
|
cart.calculatePrices();
|
|
541
587
|
// Check discount should be given back
|
|
542
588
|
expect(cart.bundleDiscounts).toHaveLength(1);
|
|
543
|
-
expect(cart.bundleDiscounts[0].total).toEqual(
|
|
544
|
-
expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(
|
|
545
|
-
expect(cart.bundleDiscounts[0].netTotal).toEqual(
|
|
546
|
-
expect(checkout.totalPrice).toEqual(
|
|
589
|
+
expect(cart.bundleDiscounts[0].total).toEqual(250000);
|
|
590
|
+
expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(100000); // The previous discount
|
|
591
|
+
expect(cart.bundleDiscounts[0].netTotal).toEqual(150000);
|
|
592
|
+
expect(checkout.totalPrice).toEqual(500000 - 1000000 - 150000);
|
|
547
593
|
expect(checkout.priceBreakown).toEqual([
|
|
548
594
|
expect.objectContaining({
|
|
549
595
|
// Subtotal (normal price)
|
|
550
|
-
price:
|
|
551
|
-
}),
|
|
552
|
-
expect.objectContaining({
|
|
553
|
-
// Refund for the previous registration
|
|
554
|
-
price: -10000,
|
|
596
|
+
price: 500000,
|
|
555
597
|
}),
|
|
556
598
|
{
|
|
557
599
|
name: 'Multiple family members discount',
|
|
558
|
-
price: -
|
|
600
|
+
price: -150000,
|
|
559
601
|
},
|
|
560
602
|
expect.objectContaining({
|
|
561
|
-
|
|
603
|
+
// Refund for the previous registration
|
|
604
|
+
price: -1000000,
|
|
605
|
+
}),
|
|
606
|
+
expect.objectContaining({
|
|
607
|
+
price: -500000 - 150000,
|
|
562
608
|
}),
|
|
563
609
|
]);
|
|
564
610
|
});
|
|
@@ -574,7 +620,7 @@ describe('Unit.RegisterCart', () => {
|
|
|
574
620
|
{ value: 1500, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Percentage },
|
|
575
621
|
],
|
|
576
622
|
}),
|
|
577
|
-
groupPrices: [
|
|
623
|
+
groupPrices: [1000000, 400000],
|
|
578
624
|
});
|
|
579
625
|
const [groupA, groupB] = groups;
|
|
580
626
|
const [memberA, memberB] = family.members;
|
|
@@ -583,14 +629,14 @@ describe('Unit.RegisterCart', () => {
|
|
|
583
629
|
discount.id,
|
|
584
630
|
AppliedRegistrationDiscount_js_1.AppliedRegistrationDiscount.create({
|
|
585
631
|
name: discount.name,
|
|
586
|
-
amount:
|
|
632
|
+
amount: 100000, // 10% discount on 100_0000 = 10_0000
|
|
587
633
|
}),
|
|
588
634
|
],
|
|
589
635
|
]));
|
|
590
636
|
addHistoricRegistration(memberB, groupB, organization);
|
|
591
637
|
const groupCPrice = GroupSettings_js_1.GroupPrice.create({
|
|
592
638
|
price: ReduceablePrice_js_1.ReduceablePrice.create({
|
|
593
|
-
price:
|
|
639
|
+
price: 500000,
|
|
594
640
|
}),
|
|
595
641
|
});
|
|
596
642
|
const groupC = Group_js_1.Group.create({
|
|
@@ -615,23 +661,23 @@ describe('Unit.RegisterCart', () => {
|
|
|
615
661
|
cart.add(itemA);
|
|
616
662
|
cart.calculatePrices();
|
|
617
663
|
// Check price for items
|
|
618
|
-
expect(itemA.calculatedPrice).toEqual(
|
|
619
|
-
expect(itemA.calculatedRefund).toEqual(
|
|
664
|
+
expect(itemA.calculatedPrice).toEqual(500000);
|
|
665
|
+
expect(itemA.calculatedRefund).toEqual(900000);
|
|
620
666
|
expect(itemA.calculatedPriceDueLater).toEqual(0);
|
|
621
667
|
// No discounts anymore
|
|
622
668
|
expect(cart.bundleDiscounts).toHaveLength(0);
|
|
623
|
-
expect(checkout.totalPrice).toEqual(
|
|
669
|
+
expect(checkout.totalPrice).toEqual(500000 - 900000);
|
|
624
670
|
expect(checkout.priceBreakown).toEqual([
|
|
625
671
|
expect.objectContaining({
|
|
626
672
|
// Subtotal (normal price)
|
|
627
|
-
price:
|
|
673
|
+
price: 500000,
|
|
628
674
|
}),
|
|
629
675
|
expect.objectContaining({
|
|
630
676
|
// Refund for the previous registration, without the discount that was granted
|
|
631
|
-
price: -
|
|
677
|
+
price: -900000,
|
|
632
678
|
}),
|
|
633
679
|
expect.objectContaining({
|
|
634
|
-
price:
|
|
680
|
+
price: 500000 - 900000,
|
|
635
681
|
}),
|
|
636
682
|
]);
|
|
637
683
|
// Now, what if groupC does have a higher discount instead of no discount?
|
|
@@ -641,7 +687,7 @@ describe('Unit.RegisterCart', () => {
|
|
|
641
687
|
// Custom discount for this price
|
|
642
688
|
GroupPriceDiscount_js_1.GroupPriceDiscount.create({
|
|
643
689
|
value: ReduceablePrice_js_1.ReduceablePrice.create({
|
|
644
|
-
price:
|
|
690
|
+
price: 250000,
|
|
645
691
|
}),
|
|
646
692
|
type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Fixed,
|
|
647
693
|
}),
|
|
@@ -651,25 +697,25 @@ describe('Unit.RegisterCart', () => {
|
|
|
651
697
|
cart.calculatePrices();
|
|
652
698
|
// Check discount should be given back
|
|
653
699
|
expect(cart.bundleDiscounts).toHaveLength(1);
|
|
654
|
-
expect(cart.bundleDiscounts[0].total).toEqual(
|
|
700
|
+
expect(cart.bundleDiscounts[0].total).toEqual(250000);
|
|
655
701
|
expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(0); // Not included here, because the registration will be removed including the applied discount
|
|
656
|
-
expect(cart.bundleDiscounts[0].netTotal).toEqual(
|
|
657
|
-
expect(checkout.totalPrice).toEqual(
|
|
702
|
+
expect(cart.bundleDiscounts[0].netTotal).toEqual(250000);
|
|
703
|
+
expect(checkout.totalPrice).toEqual(500000 - 900000 - 250000);
|
|
658
704
|
expect(checkout.priceBreakown).toEqual([
|
|
659
705
|
expect.objectContaining({
|
|
660
706
|
// Subtotal (normal price)
|
|
661
|
-
price:
|
|
662
|
-
}),
|
|
663
|
-
expect.objectContaining({
|
|
664
|
-
// Refund for the previous registration
|
|
665
|
-
price: -9000,
|
|
707
|
+
price: 500000,
|
|
666
708
|
}),
|
|
667
709
|
{
|
|
668
710
|
name: 'Multiple family members discount',
|
|
669
|
-
price: -
|
|
711
|
+
price: -250000,
|
|
670
712
|
},
|
|
671
713
|
expect.objectContaining({
|
|
672
|
-
|
|
714
|
+
// Refund for the previous registration
|
|
715
|
+
price: -900000,
|
|
716
|
+
}),
|
|
717
|
+
expect.objectContaining({
|
|
718
|
+
price: 500000 - 900000 - 250000,
|
|
673
719
|
}),
|
|
674
720
|
]);
|
|
675
721
|
});
|
|
@@ -678,7 +724,7 @@ describe('Unit.RegisterCart', () => {
|
|
|
678
724
|
// The bundle discount only defined one discount, but that should be repated for the second and third item
|
|
679
725
|
const { organization, groups, family, discount } = setupDiscountTest({
|
|
680
726
|
memberCount: 3,
|
|
681
|
-
groupPrices: [
|
|
727
|
+
groupPrices: [500000, 400000],
|
|
682
728
|
groupNames: ['Group A', 'Group B'],
|
|
683
729
|
bundleDiscount: createBundleDiscount({
|
|
684
730
|
name: 'Bundle discount',
|
|
@@ -700,39 +746,39 @@ describe('Unit.RegisterCart', () => {
|
|
|
700
746
|
cart.add(itemC);
|
|
701
747
|
cart.calculatePrices();
|
|
702
748
|
// Check price for items
|
|
703
|
-
expect(itemA.calculatedPrice).toEqual(
|
|
749
|
+
expect(itemA.calculatedPrice).toEqual(500000);
|
|
704
750
|
expect(itemA.calculatedRefund).toEqual(0);
|
|
705
751
|
expect(itemA.calculatedPriceDueLater).toEqual(0);
|
|
706
|
-
expect(itemB.calculatedPrice).toEqual(
|
|
752
|
+
expect(itemB.calculatedPrice).toEqual(400000);
|
|
707
753
|
expect(itemB.calculatedRefund).toEqual(0);
|
|
708
754
|
expect(itemB.calculatedPriceDueLater).toEqual(0);
|
|
709
|
-
expect(itemC.calculatedPrice).toEqual(
|
|
755
|
+
expect(itemC.calculatedPrice).toEqual(400000);
|
|
710
756
|
expect(itemC.calculatedRefund).toEqual(0);
|
|
711
757
|
expect(itemC.calculatedPriceDueLater).toEqual(0);
|
|
712
|
-
// Check calculated discount is
|
|
758
|
+
// Check calculated discount is 50_0000 * 0.10 + 40_0000 * 0.10 = 5_0000 + 4_0000 = 9_0000
|
|
713
759
|
expect(cart.bundleDiscounts).toHaveLength(1);
|
|
714
|
-
expect(cart.bundleDiscounts[0].total).toEqual(
|
|
760
|
+
expect(cart.bundleDiscounts[0].total).toEqual(90000);
|
|
715
761
|
expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(0);
|
|
716
|
-
expect(cart.bundleDiscounts[0].netTotal).toEqual(
|
|
717
|
-
expect(cart.price).toEqual(
|
|
718
|
-
expect(checkout.totalPrice).toEqual(
|
|
762
|
+
expect(cart.bundleDiscounts[0].netTotal).toEqual(90000);
|
|
763
|
+
expect(cart.price).toEqual(500000 + 400000 + 400000);
|
|
764
|
+
expect(checkout.totalPrice).toEqual(500000 + 400000 + 400000 - 90000);
|
|
719
765
|
expect(checkout.priceBreakown).toEqual([
|
|
720
766
|
expect.objectContaining({
|
|
721
|
-
price:
|
|
767
|
+
price: 1300000,
|
|
722
768
|
}),
|
|
723
769
|
{
|
|
724
770
|
name: 'Bundle discount',
|
|
725
|
-
price: -
|
|
771
|
+
price: -90000,
|
|
726
772
|
},
|
|
727
773
|
expect.objectContaining({
|
|
728
|
-
price:
|
|
774
|
+
price: 1300000 - 90000,
|
|
729
775
|
}),
|
|
730
776
|
]);
|
|
731
777
|
});
|
|
732
778
|
test('The highest possible discount is granted', () => {
|
|
733
779
|
const { organization, groups, family, discount } = setupDiscountTest({
|
|
734
780
|
memberCount: 3,
|
|
735
|
-
groupPrices: [
|
|
781
|
+
groupPrices: [500000, 400000],
|
|
736
782
|
groupNames: ['Group A', 'Group B'],
|
|
737
783
|
bundleDiscount: createBundleDiscount({
|
|
738
784
|
name: 'Bundle discount',
|
|
@@ -752,7 +798,7 @@ describe('Unit.RegisterCart', () => {
|
|
|
752
798
|
customDiscounts: [
|
|
753
799
|
GroupPriceDiscount_js_1.GroupPriceDiscount.create({
|
|
754
800
|
value: ReduceablePrice_js_1.ReduceablePrice.create({
|
|
755
|
-
price:
|
|
801
|
+
price: 200000,
|
|
756
802
|
}),
|
|
757
803
|
type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Fixed,
|
|
758
804
|
}),
|
|
@@ -772,32 +818,32 @@ describe('Unit.RegisterCart', () => {
|
|
|
772
818
|
cart.add(itemC);
|
|
773
819
|
cart.calculatePrices();
|
|
774
820
|
// Check price for items
|
|
775
|
-
expect(itemA.calculatedPrice).toEqual(
|
|
821
|
+
expect(itemA.calculatedPrice).toEqual(500000);
|
|
776
822
|
expect(itemA.calculatedRefund).toEqual(0);
|
|
777
823
|
expect(itemA.calculatedPriceDueLater).toEqual(0);
|
|
778
|
-
expect(itemB.calculatedPrice).toEqual(
|
|
824
|
+
expect(itemB.calculatedPrice).toEqual(400000);
|
|
779
825
|
expect(itemB.calculatedRefund).toEqual(0);
|
|
780
826
|
expect(itemB.calculatedPriceDueLater).toEqual(0);
|
|
781
|
-
expect(itemC.calculatedPrice).toEqual(
|
|
827
|
+
expect(itemC.calculatedPrice).toEqual(400000);
|
|
782
828
|
expect(itemC.calculatedRefund).toEqual(0);
|
|
783
829
|
expect(itemC.calculatedPriceDueLater).toEqual(0);
|
|
784
|
-
// Check calculated discount is
|
|
830
|
+
// Check calculated discount is 50_0000 * 0.10 + 20_0000 fixed + 0 = 5_0000 + 20_0000 + 0 = 25_0000
|
|
785
831
|
expect(cart.bundleDiscounts).toHaveLength(1);
|
|
786
|
-
expect(cart.bundleDiscounts[0].total).toEqual(
|
|
832
|
+
expect(cart.bundleDiscounts[0].total).toEqual(250000);
|
|
787
833
|
expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(0);
|
|
788
|
-
expect(cart.bundleDiscounts[0].netTotal).toEqual(
|
|
789
|
-
expect(cart.price).toEqual(
|
|
790
|
-
expect(checkout.totalPrice).toEqual(
|
|
834
|
+
expect(cart.bundleDiscounts[0].netTotal).toEqual(250000);
|
|
835
|
+
expect(cart.price).toEqual(500000 + 400000 + 400000);
|
|
836
|
+
expect(checkout.totalPrice).toEqual(500000 + 400000 + 400000 - 250000);
|
|
791
837
|
expect(checkout.priceBreakown).toEqual([
|
|
792
838
|
expect.objectContaining({
|
|
793
|
-
price:
|
|
839
|
+
price: 1300000,
|
|
794
840
|
}),
|
|
795
841
|
{
|
|
796
842
|
name: 'Bundle discount',
|
|
797
|
-
price: -
|
|
843
|
+
price: -250000,
|
|
798
844
|
},
|
|
799
845
|
expect.objectContaining({
|
|
800
|
-
price:
|
|
846
|
+
price: 1300000 - 250000,
|
|
801
847
|
}),
|
|
802
848
|
]);
|
|
803
849
|
});
|
|
@@ -808,12 +854,12 @@ describe('Unit.RegisterCart', () => {
|
|
|
808
854
|
// On top of that there is an extra discount if you combine multiple expensive camps (camp B) of 5 euro, 10 ...
|
|
809
855
|
const { organization, groups, family, organizationRegistrationPeriod } = setupDiscountTest({
|
|
810
856
|
memberCount: 5,
|
|
811
|
-
groupPrices: [
|
|
857
|
+
groupPrices: [1000000, 1500000],
|
|
812
858
|
groupNames: ['Camp A', 'Camp B'],
|
|
813
859
|
bundleDiscount: createBundleDiscount({
|
|
814
860
|
name: 'All camp discount',
|
|
815
861
|
discounts: [
|
|
816
|
-
{ value:
|
|
862
|
+
{ value: 100000, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Fixed },
|
|
817
863
|
],
|
|
818
864
|
}),
|
|
819
865
|
});
|
|
@@ -822,7 +868,7 @@ describe('Unit.RegisterCart', () => {
|
|
|
822
868
|
const expensiveCampDiscount = createBundleDiscount({
|
|
823
869
|
name: 'Expensive camp discount',
|
|
824
870
|
discounts: [
|
|
825
|
-
{ value:
|
|
871
|
+
{ value: 50000, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Fixed },
|
|
826
872
|
],
|
|
827
873
|
});
|
|
828
874
|
// Add discount to organizationRegistrationPeriod
|
|
@@ -835,10 +881,10 @@ describe('Unit.RegisterCart', () => {
|
|
|
835
881
|
const checkout = family.checkout;
|
|
836
882
|
const cart = checkout.cart;
|
|
837
883
|
const itemA = RegisterItem_js_1.RegisterItem.defaultFor(memberA, campA, organization);
|
|
838
|
-
const itemB = RegisterItem_js_1.RegisterItem.defaultFor(memberB, campB, organization); // +
|
|
839
|
-
const itemC = RegisterItem_js_1.RegisterItem.defaultFor(memberC, campB, organization); // +
|
|
840
|
-
const itemD = RegisterItem_js_1.RegisterItem.defaultFor(memberD, campA, organization); // +
|
|
841
|
-
const itemE = RegisterItem_js_1.RegisterItem.defaultFor(memberE, campB, organization); // +
|
|
884
|
+
const itemB = RegisterItem_js_1.RegisterItem.defaultFor(memberB, campB, organization); // +10_0000 discount
|
|
885
|
+
const itemC = RegisterItem_js_1.RegisterItem.defaultFor(memberC, campB, organization); // +10_0000 discount and +5_0000 discount
|
|
886
|
+
const itemD = RegisterItem_js_1.RegisterItem.defaultFor(memberD, campA, organization); // +10_0000 discount
|
|
887
|
+
const itemE = RegisterItem_js_1.RegisterItem.defaultFor(memberE, campB, organization); // +10_0000 discount and +5_0000 discount
|
|
842
888
|
cart.add(itemA);
|
|
843
889
|
cart.add(itemB);
|
|
844
890
|
cart.add(itemC);
|
|
@@ -855,29 +901,29 @@ describe('Unit.RegisterCart', () => {
|
|
|
855
901
|
})).toEqual([
|
|
856
902
|
{
|
|
857
903
|
name: 'All camp discount',
|
|
858
|
-
total:
|
|
859
|
-
netTotal:
|
|
904
|
+
total: 100000 * 4,
|
|
905
|
+
netTotal: 100000 * 4,
|
|
860
906
|
},
|
|
861
907
|
{
|
|
862
908
|
name: 'Expensive camp discount',
|
|
863
|
-
total:
|
|
864
|
-
netTotal:
|
|
909
|
+
total: 50000 * 2,
|
|
910
|
+
netTotal: 50000 * 2,
|
|
865
911
|
},
|
|
866
912
|
]);
|
|
867
913
|
expect(checkout.priceBreakown).toEqual([
|
|
868
914
|
expect.objectContaining({
|
|
869
|
-
price:
|
|
915
|
+
price: 1000000 * 2 + 1500000 * 3,
|
|
870
916
|
}),
|
|
871
917
|
{
|
|
872
918
|
name: 'All camp discount',
|
|
873
|
-
price: -
|
|
919
|
+
price: -100000 * 4,
|
|
874
920
|
},
|
|
875
921
|
{
|
|
876
922
|
name: 'Expensive camp discount',
|
|
877
|
-
price: -
|
|
923
|
+
price: -50000 * 2,
|
|
878
924
|
},
|
|
879
925
|
expect.objectContaining({
|
|
880
|
-
price:
|
|
926
|
+
price: 1000000 * 2 + 1500000 * 3 - 100000 * 4 - 50000 * 2,
|
|
881
927
|
}),
|
|
882
928
|
]);
|
|
883
929
|
});
|
|
@@ -898,7 +944,7 @@ describe('Unit.RegisterCart', () => {
|
|
|
898
944
|
{ value: 1500, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Percentage },
|
|
899
945
|
],
|
|
900
946
|
}),
|
|
901
|
-
groupPrices: [
|
|
947
|
+
groupPrices: [1000000, 400000],
|
|
902
948
|
});
|
|
903
949
|
const [groupA, groupB] = groups;
|
|
904
950
|
const [memberA, memberB] = family.members;
|
|
@@ -906,7 +952,7 @@ describe('Unit.RegisterCart', () => {
|
|
|
906
952
|
const registrationB = addHistoricRegistration(memberB, groupB, organization);
|
|
907
953
|
registrationA.discounts.set(discount.id, AppliedRegistrationDiscount_js_1.AppliedRegistrationDiscount.create({
|
|
908
954
|
name: discount.name,
|
|
909
|
-
amount:
|
|
955
|
+
amount: 100000, // 10% discount on 100_0000 = 10_0000
|
|
910
956
|
}));
|
|
911
957
|
// Now create itemC
|
|
912
958
|
const itemC = RegisterItem_js_1.RegisterItem.defaultFor(memberA, groupB, organization);
|
|
@@ -916,26 +962,26 @@ describe('Unit.RegisterCart', () => {
|
|
|
916
962
|
cart.add(itemC);
|
|
917
963
|
cart.calculatePrices();
|
|
918
964
|
// Check price for items
|
|
919
|
-
expect(itemC.calculatedPrice).toEqual(
|
|
965
|
+
expect(itemC.calculatedPrice).toEqual(400000);
|
|
920
966
|
expect(itemC.calculatedRefund).toEqual(0);
|
|
921
967
|
expect(itemC.calculatedPriceDueLater).toEqual(0);
|
|
922
|
-
// Check calculated discount is
|
|
968
|
+
// Check calculated discount is 100_0000 * 0.15 + 40_0000 * 0.10 = 15_0000 + 4_0000 = 19_0000
|
|
923
969
|
expect(cart.bundleDiscounts).toHaveLength(1);
|
|
924
|
-
expect(cart.bundleDiscounts[0].total).toEqual(
|
|
925
|
-
expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(
|
|
926
|
-
expect(cart.bundleDiscounts[0].netTotal).toEqual(
|
|
927
|
-
expect(cart.price).toEqual(
|
|
928
|
-
expect(checkout.totalPrice).toEqual(
|
|
970
|
+
expect(cart.bundleDiscounts[0].total).toEqual(190000);
|
|
971
|
+
expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(100000); // The previous discount
|
|
972
|
+
expect(cart.bundleDiscounts[0].netTotal).toEqual(90000);
|
|
973
|
+
expect(cart.price).toEqual(400000);
|
|
974
|
+
expect(checkout.totalPrice).toEqual(400000 - 90000);
|
|
929
975
|
expect(checkout.priceBreakown).toEqual([
|
|
930
976
|
expect.objectContaining({
|
|
931
|
-
price:
|
|
977
|
+
price: 400000,
|
|
932
978
|
}),
|
|
933
979
|
{
|
|
934
980
|
name: 'Multiple family members discount',
|
|
935
|
-
price: -
|
|
981
|
+
price: -90000,
|
|
936
982
|
},
|
|
937
983
|
expect.objectContaining({
|
|
938
|
-
price:
|
|
984
|
+
price: 400000 - 90000,
|
|
939
985
|
}),
|
|
940
986
|
]);
|
|
941
987
|
});
|
|
@@ -944,7 +990,7 @@ describe('Unit.RegisterCart', () => {
|
|
|
944
990
|
// The bundle discount only defined one discount, but that should be repated for the second and third item
|
|
945
991
|
const { organization, groups, family, discount } = setupDiscountTest({
|
|
946
992
|
memberCount: 3,
|
|
947
|
-
groupPrices: [
|
|
993
|
+
groupPrices: [500000, 400000],
|
|
948
994
|
groupNames: ['Group A', 'Group B'],
|
|
949
995
|
bundleDiscount: createBundleDiscount({
|
|
950
996
|
name: 'Bundle discount',
|
|
@@ -967,32 +1013,32 @@ describe('Unit.RegisterCart', () => {
|
|
|
967
1013
|
cart.add(itemC);
|
|
968
1014
|
cart.calculatePrices();
|
|
969
1015
|
// Check price for items
|
|
970
|
-
expect(itemA.calculatedPrice).toEqual(
|
|
1016
|
+
expect(itemA.calculatedPrice).toEqual(500000);
|
|
971
1017
|
expect(itemA.calculatedRefund).toEqual(0);
|
|
972
1018
|
expect(itemA.calculatedPriceDueLater).toEqual(0);
|
|
973
|
-
expect(itemB.calculatedPrice).toEqual(
|
|
1019
|
+
expect(itemB.calculatedPrice).toEqual(400000);
|
|
974
1020
|
expect(itemB.calculatedRefund).toEqual(0);
|
|
975
1021
|
expect(itemB.calculatedPriceDueLater).toEqual(0);
|
|
976
|
-
expect(itemC.calculatedPrice).toEqual(
|
|
1022
|
+
expect(itemC.calculatedPrice).toEqual(400000);
|
|
977
1023
|
expect(itemC.calculatedRefund).toEqual(0);
|
|
978
1024
|
expect(itemC.calculatedPriceDueLater).toEqual(0);
|
|
979
|
-
// Check calculated discount is
|
|
1025
|
+
// Check calculated discount is 50_0000 * 0.10 = 5_0000
|
|
980
1026
|
expect(cart.bundleDiscounts).toHaveLength(1);
|
|
981
|
-
expect(cart.bundleDiscounts[0].total).toEqual(
|
|
1027
|
+
expect(cart.bundleDiscounts[0].total).toEqual(50000);
|
|
982
1028
|
expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(0);
|
|
983
|
-
expect(cart.bundleDiscounts[0].netTotal).toEqual(
|
|
984
|
-
expect(cart.price).toEqual(
|
|
985
|
-
expect(checkout.totalPrice).toEqual(
|
|
1029
|
+
expect(cart.bundleDiscounts[0].netTotal).toEqual(50000);
|
|
1030
|
+
expect(cart.price).toEqual(500000 + 400000 + 400000);
|
|
1031
|
+
expect(checkout.totalPrice).toEqual(500000 + 400000 + 400000 - 50000);
|
|
986
1032
|
expect(checkout.priceBreakown).toEqual([
|
|
987
1033
|
expect.objectContaining({
|
|
988
|
-
price:
|
|
1034
|
+
price: 1300000,
|
|
989
1035
|
}),
|
|
990
1036
|
{
|
|
991
1037
|
name: 'Bundle discount',
|
|
992
|
-
price: -
|
|
1038
|
+
price: -50000,
|
|
993
1039
|
},
|
|
994
1040
|
expect.objectContaining({
|
|
995
|
-
price:
|
|
1041
|
+
price: 1300000 - 50000,
|
|
996
1042
|
}),
|
|
997
1043
|
]);
|
|
998
1044
|
});
|
|
@@ -1003,7 +1049,7 @@ describe('Unit.RegisterCart', () => {
|
|
|
1003
1049
|
// Create a 50%, 100% discount for the reduced price in a bundle discount (so it should be free in a family with 3 members)
|
|
1004
1050
|
const { organization, groups, family } = setupDiscountTest({
|
|
1005
1051
|
memberCount: 3,
|
|
1006
|
-
groupPrices: [
|
|
1052
|
+
groupPrices: [500000, 400000],
|
|
1007
1053
|
groupNames: ['Group A', 'Group B'],
|
|
1008
1054
|
bundleDiscount: createBundleDiscount({
|
|
1009
1055
|
name: 'Bundle discount',
|
|
@@ -1028,42 +1074,42 @@ describe('Unit.RegisterCart', () => {
|
|
|
1028
1074
|
cart.add(itemC);
|
|
1029
1075
|
cart.calculatePrices();
|
|
1030
1076
|
// Check price for items
|
|
1031
|
-
expect(itemA.calculatedPrice).toEqual(
|
|
1032
|
-
expect(itemB.calculatedPrice).toEqual(
|
|
1033
|
-
expect(itemC.calculatedPrice).toEqual(
|
|
1034
|
-
// Check calculated discount is
|
|
1077
|
+
expect(itemA.calculatedPrice).toEqual(500000);
|
|
1078
|
+
expect(itemB.calculatedPrice).toEqual(400000);
|
|
1079
|
+
expect(itemC.calculatedPrice).toEqual(400000);
|
|
1080
|
+
// Check calculated discount is 40_0000 * 1 + 50_0000 * 5% = 40_0000 + 2_5000 = 42_5000
|
|
1035
1081
|
expect(cart.bundleDiscounts).toHaveLength(1);
|
|
1036
|
-
expect(cart.bundleDiscounts[0].total).toEqual(
|
|
1082
|
+
expect(cart.bundleDiscounts[0].total).toEqual(425000);
|
|
1037
1083
|
expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(0);
|
|
1038
|
-
expect(cart.bundleDiscounts[0].netTotal).toEqual(
|
|
1039
|
-
expect(cart.price).toEqual(
|
|
1040
|
-
expect(checkout.totalPrice).toEqual(
|
|
1084
|
+
expect(cart.bundleDiscounts[0].netTotal).toEqual(425000);
|
|
1085
|
+
expect(cart.price).toEqual(500000 + 400000 + 400000);
|
|
1086
|
+
expect(checkout.totalPrice).toEqual(500000 + 400000 + 400000 - 425000);
|
|
1041
1087
|
expect(checkout.priceBreakown).toEqual([
|
|
1042
1088
|
expect.objectContaining({
|
|
1043
|
-
price:
|
|
1089
|
+
price: 1300000,
|
|
1044
1090
|
}),
|
|
1045
1091
|
{
|
|
1046
1092
|
name: 'Bundle discount',
|
|
1047
|
-
price: -
|
|
1093
|
+
price: -425000,
|
|
1048
1094
|
},
|
|
1049
1095
|
expect.objectContaining({
|
|
1050
|
-
price:
|
|
1096
|
+
price: 1300000 - 425000,
|
|
1051
1097
|
}),
|
|
1052
1098
|
]);
|
|
1053
1099
|
// Remove requires financial support, then recalculate
|
|
1054
1100
|
memberC.member.details.requiresFinancialSupport = MemberDetails_js_1.BooleanStatus.create({ value: false });
|
|
1055
1101
|
cart.calculatePrices();
|
|
1056
|
-
// 10% on
|
|
1102
|
+
// 10% on 50_0000 + 5% on 40_0000 = 5_0000 + 2_0000 = 7_0000
|
|
1057
1103
|
expect(checkout.priceBreakown).toEqual([
|
|
1058
1104
|
expect.objectContaining({
|
|
1059
|
-
price:
|
|
1105
|
+
price: 1300000,
|
|
1060
1106
|
}),
|
|
1061
1107
|
{
|
|
1062
1108
|
name: 'Bundle discount',
|
|
1063
|
-
price: -
|
|
1109
|
+
price: -70000,
|
|
1064
1110
|
},
|
|
1065
1111
|
expect.objectContaining({
|
|
1066
|
-
price:
|
|
1112
|
+
price: 1300000 - 70000,
|
|
1067
1113
|
}),
|
|
1068
1114
|
]);
|
|
1069
1115
|
});
|
|
@@ -1095,25 +1141,25 @@ describe('Unit.RegisterCart', () => {
|
|
|
1095
1141
|
cart.add(itemC);
|
|
1096
1142
|
cart.calculatePrices();
|
|
1097
1143
|
// Check price for items
|
|
1098
|
-
expect(itemA.calculatedPrice).toEqual(
|
|
1099
|
-
expect(itemB.calculatedPrice).toEqual(
|
|
1100
|
-
expect(itemC.calculatedPrice).toEqual(
|
|
1101
|
-
// Check calculated discount is
|
|
1144
|
+
expect(itemA.calculatedPrice).toEqual(500000);
|
|
1145
|
+
expect(itemB.calculatedPrice).toEqual(400000);
|
|
1146
|
+
expect(itemC.calculatedPrice).toEqual(500000);
|
|
1147
|
+
// Check calculated discount is 50_0000 * 0.10 = 5_0000
|
|
1102
1148
|
expect(cart.bundleDiscounts.map(c => c.netTotal)).toHaveLength(1);
|
|
1103
|
-
expect(cart.bundleDiscounts[0].total).toEqual(
|
|
1104
|
-
expect(cart.bundleDiscounts[0].netTotal).toEqual(
|
|
1105
|
-
expect(cart.price).toEqual(
|
|
1106
|
-
expect(checkout.totalPrice).toEqual(
|
|
1149
|
+
expect(cart.bundleDiscounts[0].total).toEqual(50000);
|
|
1150
|
+
expect(cart.bundleDiscounts[0].netTotal).toEqual(50000);
|
|
1151
|
+
expect(cart.price).toEqual(500000 + 400000 + 500000);
|
|
1152
|
+
expect(checkout.totalPrice).toEqual(500000 + 400000 + 500000 - 50000);
|
|
1107
1153
|
expect(checkout.priceBreakown).toEqual([
|
|
1108
1154
|
expect.objectContaining({
|
|
1109
|
-
price:
|
|
1155
|
+
price: 500000 + 400000 + 500000,
|
|
1110
1156
|
}),
|
|
1111
1157
|
{
|
|
1112
1158
|
name: 'Multiple lessons discount (John)',
|
|
1113
|
-
price: -
|
|
1159
|
+
price: -50000,
|
|
1114
1160
|
},
|
|
1115
1161
|
expect.objectContaining({
|
|
1116
|
-
price:
|
|
1162
|
+
price: 500000 + 400000 + 500000 - 50000,
|
|
1117
1163
|
}),
|
|
1118
1164
|
]);
|
|
1119
1165
|
// Add a historic registration for member B, so it also gets a discount
|
|
@@ -1121,18 +1167,18 @@ describe('Unit.RegisterCart', () => {
|
|
|
1121
1167
|
cart.calculatePrices();
|
|
1122
1168
|
expect(checkout.priceBreakown).toEqual([
|
|
1123
1169
|
expect.objectContaining({
|
|
1124
|
-
price:
|
|
1170
|
+
price: 500000 + 400000 + 500000, // no change
|
|
1125
1171
|
}),
|
|
1126
1172
|
{
|
|
1127
1173
|
name: 'Multiple lessons discount (John)',
|
|
1128
|
-
price: -
|
|
1174
|
+
price: -50000,
|
|
1129
1175
|
},
|
|
1130
1176
|
{
|
|
1131
1177
|
name: 'Multiple lessons discount (Jane)',
|
|
1132
|
-
price: -
|
|
1178
|
+
price: -50000,
|
|
1133
1179
|
},
|
|
1134
1180
|
expect.objectContaining({
|
|
1135
|
-
price:
|
|
1181
|
+
price: 500000 + 400000 + 500000 - 50000 - 50000,
|
|
1136
1182
|
}),
|
|
1137
1183
|
]);
|
|
1138
1184
|
});
|
|
@@ -1162,27 +1208,27 @@ describe('Unit.RegisterCart', () => {
|
|
|
1162
1208
|
cart.calculatePrices();
|
|
1163
1209
|
// No discount should be applied yet (need at least 2 different groups)
|
|
1164
1210
|
expect(cart.bundleDiscounts).toHaveLength(0);
|
|
1165
|
-
expect(checkout.totalPrice).toEqual(
|
|
1211
|
+
expect(checkout.totalPrice).toEqual(500000 + 400000);
|
|
1166
1212
|
// Now register one member for group B as well
|
|
1167
1213
|
const itemC = RegisterItem_js_1.RegisterItem.defaultFor(memberA, groupB, organization);
|
|
1168
1214
|
cart.add(itemC);
|
|
1169
1215
|
cart.calculatePrices();
|
|
1170
1216
|
// Now we should get a discount
|
|
1171
1217
|
expect(cart.bundleDiscounts).toHaveLength(1);
|
|
1172
|
-
expect(cart.bundleDiscounts[0].total).toEqual(
|
|
1173
|
-
expect(cart.bundleDiscounts[0].netTotal).toEqual(
|
|
1174
|
-
expect(cart.price).toEqual(
|
|
1175
|
-
expect(checkout.totalPrice).toEqual(
|
|
1218
|
+
expect(cart.bundleDiscounts[0].total).toEqual(40000); // 10% of 40_0000 (not 50_0000)
|
|
1219
|
+
expect(cart.bundleDiscounts[0].netTotal).toEqual(40000);
|
|
1220
|
+
expect(cart.price).toEqual(500000 + 400000 + 400000);
|
|
1221
|
+
expect(checkout.totalPrice).toEqual(500000 + 400000 + 400000 - 40000);
|
|
1176
1222
|
expect(checkout.priceBreakown).toEqual([
|
|
1177
1223
|
expect.objectContaining({
|
|
1178
|
-
price:
|
|
1224
|
+
price: 500000 + 400000 + 400000,
|
|
1179
1225
|
}),
|
|
1180
1226
|
{
|
|
1181
1227
|
name: 'Multiple family members discount (Group B)',
|
|
1182
|
-
price: -
|
|
1228
|
+
price: -40000,
|
|
1183
1229
|
},
|
|
1184
1230
|
expect.objectContaining({
|
|
1185
|
-
price:
|
|
1231
|
+
price: 500000 + 400000 + 400000 - 40000,
|
|
1186
1232
|
}),
|
|
1187
1233
|
]);
|
|
1188
1234
|
// Change calculation to count across groups
|
|
@@ -1191,14 +1237,14 @@ describe('Unit.RegisterCart', () => {
|
|
|
1191
1237
|
// Now we should get a discount for both groups
|
|
1192
1238
|
expect(checkout.priceBreakown).toEqual([
|
|
1193
1239
|
expect.objectContaining({
|
|
1194
|
-
price:
|
|
1240
|
+
price: 500000 + 400000 + 400000,
|
|
1195
1241
|
}),
|
|
1196
1242
|
{
|
|
1197
1243
|
name: 'Multiple family members discount',
|
|
1198
|
-
price: -
|
|
1244
|
+
price: -90000,
|
|
1199
1245
|
},
|
|
1200
1246
|
expect.objectContaining({
|
|
1201
|
-
price:
|
|
1247
|
+
price: 500000 + 400000 + 400000 - 90000,
|
|
1202
1248
|
}),
|
|
1203
1249
|
]);
|
|
1204
1250
|
});
|
|
@@ -1230,25 +1276,25 @@ describe('Unit.RegisterCart', () => {
|
|
|
1230
1276
|
cart.add(itemC);
|
|
1231
1277
|
cart.calculatePrices();
|
|
1232
1278
|
// Check price for items
|
|
1233
|
-
expect(itemA.calculatedPrice).toEqual(
|
|
1234
|
-
expect(itemB.calculatedPrice).toEqual(
|
|
1235
|
-
expect(itemC.calculatedPrice).toEqual(
|
|
1279
|
+
expect(itemA.calculatedPrice).toEqual(500000);
|
|
1280
|
+
expect(itemB.calculatedPrice).toEqual(400000);
|
|
1281
|
+
expect(itemC.calculatedPrice).toEqual(500000);
|
|
1236
1282
|
// Check calculated discount - should only apply to member A (who has multiple registrations)
|
|
1237
1283
|
expect(cart.bundleDiscounts).toHaveLength(1);
|
|
1238
|
-
expect(cart.bundleDiscounts[0].total).toEqual(
|
|
1239
|
-
expect(cart.bundleDiscounts[0].netTotal).toEqual(
|
|
1240
|
-
expect(cart.price).toEqual(
|
|
1241
|
-
expect(checkout.totalPrice).toEqual(
|
|
1284
|
+
expect(cart.bundleDiscounts[0].total).toEqual(50000); // 10% of 50_0000 (we always apply discounts to highest price first)
|
|
1285
|
+
expect(cart.bundleDiscounts[0].netTotal).toEqual(50000);
|
|
1286
|
+
expect(cart.price).toEqual(500000 + 400000 + 500000);
|
|
1287
|
+
expect(checkout.totalPrice).toEqual(500000 + 400000 + 500000 - 50000);
|
|
1242
1288
|
expect(checkout.priceBreakown).toEqual([
|
|
1243
1289
|
expect.objectContaining({
|
|
1244
|
-
price:
|
|
1290
|
+
price: 500000 + 400000 + 500000,
|
|
1245
1291
|
}),
|
|
1246
1292
|
{
|
|
1247
1293
|
name: 'Multiple lessons discount (John)',
|
|
1248
|
-
price: -
|
|
1294
|
+
price: -50000,
|
|
1249
1295
|
},
|
|
1250
1296
|
expect.objectContaining({
|
|
1251
|
-
price:
|
|
1297
|
+
price: 500000 + 400000 + 500000 - 50000,
|
|
1252
1298
|
}),
|
|
1253
1299
|
]);
|
|
1254
1300
|
// Now explicitly turn on countPerGroup and set countWholeFamily to true
|
|
@@ -1259,14 +1305,14 @@ describe('Unit.RegisterCart', () => {
|
|
|
1259
1305
|
// Now we should get a discount for group A (since two members are registered for it)
|
|
1260
1306
|
expect(checkout.priceBreakown).toEqual([
|
|
1261
1307
|
expect.objectContaining({
|
|
1262
|
-
price:
|
|
1308
|
+
price: 500000 + 400000 + 500000,
|
|
1263
1309
|
}),
|
|
1264
1310
|
{
|
|
1265
1311
|
name: 'Multiple lessons discount (Group A)',
|
|
1266
|
-
price: -
|
|
1312
|
+
price: -50000, // 10% of the second 50_0000
|
|
1267
1313
|
},
|
|
1268
1314
|
expect.objectContaining({
|
|
1269
|
-
price:
|
|
1315
|
+
price: 500000 + 400000 + 500000 - 50000,
|
|
1270
1316
|
}),
|
|
1271
1317
|
]);
|
|
1272
1318
|
});
|
|
@@ -1275,7 +1321,7 @@ describe('Unit.RegisterCart', () => {
|
|
|
1275
1321
|
// now, add a new registration to the cart that is not applicable to the discount - the old discount should not be altered
|
|
1276
1322
|
const { organization, groups, family, period, discount } = setupDiscountTest({
|
|
1277
1323
|
memberCount: 2,
|
|
1278
|
-
groupPrices: [
|
|
1324
|
+
groupPrices: [500000, 400000],
|
|
1279
1325
|
groupNames: ['Group A', 'Group B'],
|
|
1280
1326
|
bundleDiscount: createBundleDiscount({
|
|
1281
1327
|
name: 'Multiple family members discount',
|
|
@@ -1291,19 +1337,19 @@ describe('Unit.RegisterCart', () => {
|
|
|
1291
1337
|
const registrationA = addHistoricRegistration(memberA, groupA, organization);
|
|
1292
1338
|
const registrationB = addHistoricRegistration(memberB, groupB, organization);
|
|
1293
1339
|
// Create a new group that is not applicable to the discount
|
|
1294
|
-
const [groupC] = createTestGroups(organization, period, [
|
|
1340
|
+
const [groupC] = createTestGroups(organization, period, [300000], ['Group C']);
|
|
1295
1341
|
const itemC = RegisterItem_js_1.RegisterItem.defaultFor(memberA, groupC, organization);
|
|
1296
1342
|
// Add to a single cart
|
|
1297
1343
|
const checkout = family.checkout;
|
|
1298
1344
|
const cart = checkout.cart;
|
|
1299
1345
|
cart.add(itemC);
|
|
1300
1346
|
cart.calculatePrices();
|
|
1301
|
-
expect(itemC.calculatedPrice).toEqual(
|
|
1347
|
+
expect(itemC.calculatedPrice).toEqual(300000);
|
|
1302
1348
|
expect(cart.bundleDiscounts).toHaveLength(0);
|
|
1303
|
-
expect(checkout.totalPrice).toEqual(
|
|
1349
|
+
expect(checkout.totalPrice).toEqual(300000);
|
|
1304
1350
|
expect(checkout.priceBreakown).toEqual([
|
|
1305
1351
|
expect.objectContaining({
|
|
1306
|
-
price:
|
|
1352
|
+
price: 300000,
|
|
1307
1353
|
}),
|
|
1308
1354
|
]);
|
|
1309
1355
|
// Now also register memberB for group A and add it to the cart
|
|
@@ -1311,26 +1357,26 @@ describe('Unit.RegisterCart', () => {
|
|
|
1311
1357
|
cart.add(itemD);
|
|
1312
1358
|
cart.calculatePrices();
|
|
1313
1359
|
// Check price for items
|
|
1314
|
-
expect(itemD.calculatedPrice).toEqual(
|
|
1315
|
-
expect(itemC.calculatedPrice).toEqual(
|
|
1360
|
+
expect(itemD.calculatedPrice).toEqual(500000);
|
|
1361
|
+
expect(itemC.calculatedPrice).toEqual(300000);
|
|
1316
1362
|
// Check calculated discount: should also take old registrations into account
|
|
1317
|
-
//
|
|
1363
|
+
// 50_0000 * 10% + 50_0000 * 10% = 5_0000 + 5_0000 = 10_0000
|
|
1318
1364
|
expect(cart.bundleDiscounts).toHaveLength(1);
|
|
1319
|
-
expect(cart.bundleDiscounts[0].total).toEqual(
|
|
1365
|
+
expect(cart.bundleDiscounts[0].total).toEqual(100000);
|
|
1320
1366
|
expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(0);
|
|
1321
|
-
expect(cart.bundleDiscounts[0].netTotal).toEqual(
|
|
1322
|
-
expect(cart.price).toEqual(
|
|
1323
|
-
expect(checkout.totalPrice).toEqual(
|
|
1367
|
+
expect(cart.bundleDiscounts[0].netTotal).toEqual(100000);
|
|
1368
|
+
expect(cart.price).toEqual(500000 + 300000);
|
|
1369
|
+
expect(checkout.totalPrice).toEqual(500000 + 300000 - 100000);
|
|
1324
1370
|
expect(checkout.priceBreakown).toEqual([
|
|
1325
1371
|
expect.objectContaining({
|
|
1326
|
-
price:
|
|
1372
|
+
price: 500000 + 300000,
|
|
1327
1373
|
}),
|
|
1328
1374
|
{
|
|
1329
1375
|
name: 'Multiple family members discount',
|
|
1330
|
-
price: -
|
|
1376
|
+
price: -100000,
|
|
1331
1377
|
},
|
|
1332
1378
|
expect.objectContaining({
|
|
1333
|
-
price:
|
|
1379
|
+
price: 500000 + 300000 - 100000,
|
|
1334
1380
|
}),
|
|
1335
1381
|
]);
|
|
1336
1382
|
});
|
|
@@ -1343,7 +1389,7 @@ describe('Unit.RegisterCart', () => {
|
|
|
1343
1389
|
countWholeFamily: true,
|
|
1344
1390
|
countPerGroup: false,
|
|
1345
1391
|
discounts: [
|
|
1346
|
-
{ value:
|
|
1392
|
+
{ value: 10000000, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Fixed },
|
|
1347
1393
|
],
|
|
1348
1394
|
}),
|
|
1349
1395
|
});
|
|
@@ -1358,21 +1404,21 @@ describe('Unit.RegisterCart', () => {
|
|
|
1358
1404
|
cart.add(itemB);
|
|
1359
1405
|
cart.calculatePrices();
|
|
1360
1406
|
expect(cart.bundleDiscounts).toHaveLength(1);
|
|
1361
|
-
expect(cart.bundleDiscounts[0].total).toEqual(
|
|
1407
|
+
expect(cart.bundleDiscounts[0].total).toEqual(500000);
|
|
1362
1408
|
expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(0);
|
|
1363
|
-
expect(cart.bundleDiscounts[0].netTotal).toEqual(
|
|
1364
|
-
expect(cart.price).toEqual(
|
|
1365
|
-
expect(checkout.totalPrice).toEqual(
|
|
1409
|
+
expect(cart.bundleDiscounts[0].netTotal).toEqual(500000);
|
|
1410
|
+
expect(cart.price).toEqual(500000 + 400000);
|
|
1411
|
+
expect(checkout.totalPrice).toEqual(400000);
|
|
1366
1412
|
expect(checkout.priceBreakown).toEqual([
|
|
1367
1413
|
expect.objectContaining({
|
|
1368
|
-
price:
|
|
1414
|
+
price: 500000 + 400000,
|
|
1369
1415
|
}),
|
|
1370
1416
|
{
|
|
1371
1417
|
name: 'Multiple family members discount',
|
|
1372
|
-
price: -
|
|
1418
|
+
price: -500000,
|
|
1373
1419
|
},
|
|
1374
1420
|
expect.objectContaining({
|
|
1375
|
-
price:
|
|
1421
|
+
price: 400000,
|
|
1376
1422
|
}),
|
|
1377
1423
|
]);
|
|
1378
1424
|
});
|