@xsolla/payment-client-core 0.1.19 → 0.1.21
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/initialize/initialize.service.mjs +4 -2
- package/esm2020/lib/core/payment/payment.interface.mjs +1 -1
- package/esm2020/lib/core/payment/payment.service.mjs +21 -1
- package/esm2020/lib/core-library.service.mjs +2 -1
- package/fesm2015/xsolla-payment-client-core.mjs +43 -20
- package/fesm2015/xsolla-payment-client-core.mjs.map +1 -1
- package/fesm2020/xsolla-payment-client-core.mjs +42 -20
- package/fesm2020/xsolla-payment-client-core.mjs.map +1 -1
- package/lib/core/payment/payment.interface.d.ts +1 -0
- package/lib/core/payment/payment.service.d.ts +2 -0
- package/package.json +1 -1
- package/xsolla-payment-client-core-0.1.21.tgz +0 -0
- package/xsolla-payment-client-core-0.1.19.tgz +0 -0
|
@@ -595,25 +595,6 @@ class SubmitResponse {
|
|
|
595
595
|
}
|
|
596
596
|
}
|
|
597
597
|
|
|
598
|
-
const isSubmitResponse = (value) => {
|
|
599
|
-
return value instanceof SubmitResponse;
|
|
600
|
-
};
|
|
601
|
-
|
|
602
|
-
var InputEventName;
|
|
603
|
-
(function (InputEventName) {
|
|
604
|
-
InputEventName["blur"] = "blur";
|
|
605
|
-
InputEventName["focus"] = "focus";
|
|
606
|
-
})(InputEventName || (InputEventName = {}));
|
|
607
|
-
|
|
608
|
-
class ShowErrorsAction {
|
|
609
|
-
constructor(errors) {
|
|
610
|
-
this.type = 'show_errors';
|
|
611
|
-
this.data = {
|
|
612
|
-
errors,
|
|
613
|
-
};
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
|
|
617
598
|
class InitializeResponse {
|
|
618
599
|
constructor(response) {
|
|
619
600
|
this.paymentForm = null;
|
|
@@ -657,6 +638,25 @@ class InitializeResponse {
|
|
|
657
638
|
}
|
|
658
639
|
}
|
|
659
640
|
|
|
641
|
+
const isSubmitResponse = (value) => {
|
|
642
|
+
return value instanceof SubmitResponse;
|
|
643
|
+
};
|
|
644
|
+
|
|
645
|
+
var InputEventName;
|
|
646
|
+
(function (InputEventName) {
|
|
647
|
+
InputEventName["blur"] = "blur";
|
|
648
|
+
InputEventName["focus"] = "focus";
|
|
649
|
+
})(InputEventName || (InputEventName = {}));
|
|
650
|
+
|
|
651
|
+
class ShowErrorsAction {
|
|
652
|
+
constructor(errors) {
|
|
653
|
+
this.type = 'show_errors';
|
|
654
|
+
this.data = {
|
|
655
|
+
errors,
|
|
656
|
+
};
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
|
|
660
660
|
const initializeResponseFactoryToken = new InjectionToken('InitializeResponse');
|
|
661
661
|
const initializeResponseFactoryProvider = {
|
|
662
662
|
provide: initializeResponseFactoryToken,
|
|
@@ -1583,11 +1583,13 @@ class InitializeService {
|
|
|
1583
1583
|
paymentWithSavedMethod: config.paymentWithSavedMethod === true
|
|
1584
1584
|
? "1" /* XpsBoolean.true */
|
|
1585
1585
|
: "0" /* XpsBoolean.false */,
|
|
1586
|
-
saved_method_id: config.savedMethodId,
|
|
1587
1586
|
save_payment_account_only: config.savePaymentMethod
|
|
1588
1587
|
? "1" /* XpsBoolean.true */
|
|
1589
1588
|
: "0" /* XpsBoolean.false */,
|
|
1590
1589
|
};
|
|
1590
|
+
if (config.savedMethodId) {
|
|
1591
|
+
requestParams.saved_method_id = config.savedMethodId;
|
|
1592
|
+
}
|
|
1591
1593
|
return this.xpsApiService
|
|
1592
1594
|
.directPaymentRequest(requestParams)
|
|
1593
1595
|
.then((xpsResponse) => {
|
|
@@ -5306,6 +5308,7 @@ class PaymentService {
|
|
|
5306
5308
|
this.data = await this.initializeService.request(config);
|
|
5307
5309
|
this.fields = this.getFields();
|
|
5308
5310
|
this.form = this.formService.createForm(this.fields);
|
|
5311
|
+
this.updatePidConfig();
|
|
5309
5312
|
this.setupSyncService(this.form, this.fields);
|
|
5310
5313
|
this.listenFormStatusChanges(this.form);
|
|
5311
5314
|
this.emitFinanceDetails(this.data.paymentForm?.summary);
|
|
@@ -5345,6 +5348,15 @@ class PaymentService {
|
|
|
5345
5348
|
}
|
|
5346
5349
|
return this.data?.paymentForm?.fields ?? [];
|
|
5347
5350
|
}
|
|
5351
|
+
getPid() {
|
|
5352
|
+
if (this.data instanceof SubmitResponse) {
|
|
5353
|
+
return (Number(this.data.fields.find((field) => field.name === 'fix_pid')?.value) || null);
|
|
5354
|
+
}
|
|
5355
|
+
if (this.data instanceof InitializeResponse) {
|
|
5356
|
+
return (Number(this.data.paymentForm?.fields.find((field) => field.name === 'fix_pid')?.value) || null);
|
|
5357
|
+
}
|
|
5358
|
+
return null;
|
|
5359
|
+
}
|
|
5348
5360
|
async validate(field) {
|
|
5349
5361
|
const syncErrors = this.syncService.getSyncValidationErrors(field);
|
|
5350
5362
|
if (syncErrors) {
|
|
@@ -5467,6 +5479,15 @@ class PaymentService {
|
|
|
5467
5479
|
.pipe(takeUntil(this.formDestroy$))
|
|
5468
5480
|
.subscribe(() => this.emitFormFieldsStatus(form));
|
|
5469
5481
|
}
|
|
5482
|
+
/*
|
|
5483
|
+
* in case the form pid changes despite the one passed during initialization
|
|
5484
|
+
* */
|
|
5485
|
+
updatePidConfig() {
|
|
5486
|
+
const currentPid = this.getPid();
|
|
5487
|
+
if (currentPid) {
|
|
5488
|
+
this.config.paymentMethodId = currentPid;
|
|
5489
|
+
}
|
|
5490
|
+
}
|
|
5470
5491
|
}
|
|
5471
5492
|
PaymentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentService, deps: [{ token: InitializeService }, { token: SubmitService }, { token: SyncService }, { token: FormService }, { token: StatusService }, { token: FinanceDetailsService }, { token: CreditCardStateService }, { token: NextActionService }, { token: ControlConfigService }, { token: ThreeDsService }, { token: FormMessagesService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5472
5493
|
PaymentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentService, providedIn: 'root' });
|
|
@@ -5660,6 +5681,7 @@ class CoreLibraryService {
|
|
|
5660
5681
|
initialize: async () => this.paymentService.initialize(enrichedConfig),
|
|
5661
5682
|
submit: async () => this.paymentService.submit(),
|
|
5662
5683
|
getFields: () => this.paymentService.getFields(),
|
|
5684
|
+
getPid: () => this.paymentService.getPid(),
|
|
5663
5685
|
validate: async (field) => this.paymentService.validate(field),
|
|
5664
5686
|
getFinanceDetails: () => this.paymentService.getFinanceDetails(),
|
|
5665
5687
|
runThreeDs: () => this.paymentService.runThreeDs(),
|