@xsolla/payment-client-core 0.0.11 → 0.0.13
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/esm2020/lib/core/payment/finance-details/cart-item.interface.mjs +1 -1
- package/esm2020/lib/core/payment/finance-details/cart-line.interface.mjs +1 -1
- package/esm2020/lib/core/payment/finance-details/{cart-pricing.interface.mjs → cart-summary.interface.mjs} +1 -1
- package/esm2020/lib/core/payment/finance-details/finance-details.class.mjs +35 -12
- package/esm2020/lib/core/payment/status/status.service.mjs +3 -3
- package/esm2020/lib/core/payment/xps-purchase.interface.mjs +1 -1
- package/fesm2015/xsolla-payment-client-core.mjs +40 -15
- package/fesm2015/xsolla-payment-client-core.mjs.map +1 -1
- package/fesm2020/xsolla-payment-client-core.mjs +36 -13
- package/fesm2020/xsolla-payment-client-core.mjs.map +1 -1
- package/lib/core/payment/finance-details/cart-item.interface.d.ts +1 -0
- package/lib/core/payment/finance-details/cart-line.interface.d.ts +1 -0
- package/lib/core/payment/finance-details/finance-details.class.d.ts +8 -4
- package/lib/core/payment/xps-purchase.interface.d.ts +0 -2
- package/package.json +1 -1
- package/xsolla-payment-client-core-0.0.13.tgz +0 -0
- package/esm2020/lib/core/payment/xps-subscription-item.interface.mjs +0 -2
- package/lib/core/payment/xps-subscription-item.interface.d.ts +0 -20
- package/xsolla-payment-client-core-0.0.11.tgz +0 -0
- /package/lib/core/payment/finance-details/{cart-pricing.interface.d.ts → cart-summary.interface.d.ts} +0 -0
|
@@ -2461,8 +2461,8 @@ class StatusService {
|
|
|
2461
2461
|
this.statusRequestService.setRequestParams(params);
|
|
2462
2462
|
this.startWaitingStatusUpdates(params.invoice);
|
|
2463
2463
|
this.statusRequestService.request();
|
|
2464
|
-
const statusResponse = await firstValueFrom(this.
|
|
2465
|
-
return statusResponse.
|
|
2464
|
+
const statusResponse = await firstValueFrom(this.statusRequestService.response$);
|
|
2465
|
+
return statusResponse.status;
|
|
2466
2466
|
}
|
|
2467
2467
|
startWaitingStatusUpdates(invoice) {
|
|
2468
2468
|
this.listenStatusService.listen(invoice);
|
|
@@ -2517,6 +2517,9 @@ class FinanceDetails {
|
|
|
2517
2517
|
constructor(parameters) {
|
|
2518
2518
|
this.purchase = parameters.purchase;
|
|
2519
2519
|
this.finance = parameters.finance;
|
|
2520
|
+
this.cartItems = this.getFormattedPurchaseForCart();
|
|
2521
|
+
this.cartSummary = this.getFormattedPricingForCart();
|
|
2522
|
+
this.paymentCountry = this.getPaymentCountry();
|
|
2520
2523
|
}
|
|
2521
2524
|
getFormattedPurchaseForCart() {
|
|
2522
2525
|
const checkouts = this.purchase.checkout_items?.map((item) => {
|
|
@@ -2557,9 +2560,8 @@ class FinanceDetails {
|
|
|
2557
2560
|
if (this.purchase.checkout) {
|
|
2558
2561
|
checkoutArray = [
|
|
2559
2562
|
{
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
: 'In-game purchase',
|
|
2563
|
+
key: 'checkout',
|
|
2564
|
+
title: this.purchase.checkout.description,
|
|
2563
2565
|
price: extractMoneyCurrency(this.purchase.checkout),
|
|
2564
2566
|
isBonus: this.purchase.checkout.is_bonus ?? false,
|
|
2565
2567
|
},
|
|
@@ -2577,14 +2579,17 @@ class FinanceDetails {
|
|
|
2577
2579
|
const subtotalDetailsSorting = [
|
|
2578
2580
|
{
|
|
2579
2581
|
key: 'discount',
|
|
2582
|
+
responseKey: 'discount',
|
|
2580
2583
|
title: 'Discount',
|
|
2581
2584
|
},
|
|
2582
2585
|
{
|
|
2583
2586
|
key: 'fee',
|
|
2587
|
+
responseKey: 'fee',
|
|
2584
2588
|
title: 'Payment system fee',
|
|
2585
2589
|
},
|
|
2586
2590
|
{
|
|
2587
|
-
key: '
|
|
2591
|
+
key: 'user-balance',
|
|
2592
|
+
responseKey: 'user_balance',
|
|
2588
2593
|
title: 'Balance',
|
|
2589
2594
|
},
|
|
2590
2595
|
];
|
|
@@ -2604,10 +2609,11 @@ class FinanceDetails {
|
|
|
2604
2609
|
totalDetails: this.getTaxesForTotalDetails(),
|
|
2605
2610
|
subtotalDetails: [
|
|
2606
2611
|
...subtotalDetailsSorting.map((sorting) => {
|
|
2607
|
-
const field = this.finance[sorting.
|
|
2612
|
+
const field = this.finance[sorting.responseKey];
|
|
2608
2613
|
if (field) {
|
|
2609
2614
|
return {
|
|
2610
|
-
|
|
2615
|
+
key: sorting.key,
|
|
2616
|
+
title: sorting.title,
|
|
2611
2617
|
money: {
|
|
2612
2618
|
amount: sorting.key === 'discount' && field.amount
|
|
2613
2619
|
? -field.amount
|
|
@@ -2623,28 +2629,36 @@ class FinanceDetails {
|
|
|
2623
2629
|
};
|
|
2624
2630
|
}
|
|
2625
2631
|
getPaymentCountry() {
|
|
2626
|
-
return this.finance
|
|
2632
|
+
return this.finance.payment_country.iso;
|
|
2627
2633
|
}
|
|
2628
2634
|
getTaxForItem(indirectTaxRate) {
|
|
2629
2635
|
if (indirectTaxRate ||
|
|
2630
2636
|
(this.shouldShowZeroIndirectTaxRate && indirectTaxRate === 0)) {
|
|
2631
2637
|
if (this.isSalesTaxes) {
|
|
2632
2638
|
return {
|
|
2639
|
+
key: 'sales-tax',
|
|
2633
2640
|
content: `Sales tax ${indirectTaxRate}%`,
|
|
2641
|
+
rate: indirectTaxRate,
|
|
2634
2642
|
};
|
|
2635
2643
|
}
|
|
2636
2644
|
if (this.isIndia()) {
|
|
2637
2645
|
return {
|
|
2646
|
+
key: 'vat-india',
|
|
2638
2647
|
content: `GST ${indirectTaxRate}%`,
|
|
2648
|
+
rate: indirectTaxRate,
|
|
2639
2649
|
};
|
|
2640
2650
|
}
|
|
2641
2651
|
if (this.isGhana()) {
|
|
2642
2652
|
return {
|
|
2653
|
+
key: 'vat-ghana',
|
|
2643
2654
|
content: 'VAT, NHIL, GETFund Levy, and Covid-19 Levy',
|
|
2655
|
+
rate: indirectTaxRate,
|
|
2644
2656
|
};
|
|
2645
2657
|
}
|
|
2646
2658
|
return {
|
|
2659
|
+
key: 'vat',
|
|
2647
2660
|
content: `VAT ${indirectTaxRate}%`,
|
|
2661
|
+
rate: indirectTaxRate,
|
|
2648
2662
|
};
|
|
2649
2663
|
}
|
|
2650
2664
|
return null;
|
|
@@ -2655,14 +2669,14 @@ class FinanceDetails {
|
|
|
2655
2669
|
if (this.finance.vat_user &&
|
|
2656
2670
|
(this.finance?.vat_user?.amount ?? this.finance?.vat_user?.visible)) {
|
|
2657
2671
|
ret.push({
|
|
2658
|
-
key:
|
|
2672
|
+
key: this.getVatKeyForDetails(),
|
|
2659
2673
|
title: this.getVatLabelForSubtotalDetails(),
|
|
2660
2674
|
money: extractMoneyCurrency(this.finance.vat_user),
|
|
2661
2675
|
});
|
|
2662
2676
|
}
|
|
2663
2677
|
if (this.finance.sales_tax_user?.amount) {
|
|
2664
2678
|
ret.push({
|
|
2665
|
-
key: '
|
|
2679
|
+
key: 'sales-tax',
|
|
2666
2680
|
title: 'Sales tax',
|
|
2667
2681
|
money: extractMoneyCurrency(this.finance.sales_tax_user),
|
|
2668
2682
|
});
|
|
@@ -2684,7 +2698,7 @@ class FinanceDetails {
|
|
|
2684
2698
|
if ((this.finance?.vat?.amount || this.finance?.vat?.visible) &&
|
|
2685
2699
|
!this.finance?.vat_user?.amount) {
|
|
2686
2700
|
ret.push({
|
|
2687
|
-
key:
|
|
2701
|
+
key: this.getVatKeyForDetails(),
|
|
2688
2702
|
title: this.getVatLabelForTotalDetails(),
|
|
2689
2703
|
money: extractMoneyCurrency(this.finance.vat),
|
|
2690
2704
|
});
|
|
@@ -2692,13 +2706,22 @@ class FinanceDetails {
|
|
|
2692
2706
|
if (this.finance?.sales_tax?.amount &&
|
|
2693
2707
|
!this.finance?.sales_tax_user?.amount) {
|
|
2694
2708
|
ret.push({
|
|
2695
|
-
key: '
|
|
2709
|
+
key: 'sales-tax',
|
|
2696
2710
|
title: 'Sales tax included',
|
|
2697
2711
|
money: extractMoneyCurrency(this.finance.sales_tax),
|
|
2698
2712
|
});
|
|
2699
2713
|
}
|
|
2700
2714
|
return ret;
|
|
2701
2715
|
}
|
|
2716
|
+
getVatKeyForDetails() {
|
|
2717
|
+
if (this.isIndia()) {
|
|
2718
|
+
return 'vat-india';
|
|
2719
|
+
}
|
|
2720
|
+
if (this.isGhana()) {
|
|
2721
|
+
return 'vat-ghana';
|
|
2722
|
+
}
|
|
2723
|
+
return 'vat';
|
|
2724
|
+
}
|
|
2702
2725
|
getVatLabelForTotalDetails() {
|
|
2703
2726
|
if (this.isIndia()) {
|
|
2704
2727
|
return `Including ${this.finance.vat.percent}% GST`;
|