@xsolla/payment-client-core 0.2.8 → 0.2.9
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/actions/next-action.interface.mjs +1 -1
- package/esm2020/lib/core/payment/actions/next-actions.mjs +3 -1
- package/esm2020/lib/core/payment/actions/show-qr-code/show-qr-code.action.class.mjs +22 -0
- package/esm2020/lib/core/payment/actions/show-qr-code/show-qr-code.action.type.mjs +2 -0
- package/esm2020/lib/core/payment/initialize/initialize-request-params.interface.mjs +1 -1
- package/esm2020/lib/core/payment/payment.service.mjs +7 -1
- package/esm2020/lib/core/payment/xps-api/xps-api.service.mjs +4 -1
- package/esm2020/lib/core/settings/configuration.interface.mjs +1 -1
- package/esm2020/lib/core/settings/settings.service.mjs +6 -1
- package/esm2020/lib/core-library.service.mjs +7 -1
- package/fesm2015/xsolla-payment-client-core.mjs +42 -0
- package/fesm2015/xsolla-payment-client-core.mjs.map +1 -1
- package/fesm2020/xsolla-payment-client-core.mjs +41 -0
- package/fesm2020/xsolla-payment-client-core.mjs.map +1 -1
- package/lib/core/payment/actions/next-action.interface.d.ts +2 -1
- package/lib/core/payment/actions/show-qr-code/show-qr-code.action.class.d.ts +11 -0
- package/lib/core/payment/actions/show-qr-code/show-qr-code.action.type.d.ts +3 -0
- package/lib/core/payment/initialize/initialize-request-params.interface.d.ts +1 -0
- package/lib/core/payment/payment.service.d.ts +1 -0
- package/lib/core/settings/configuration.interface.d.ts +1 -0
- package/lib/core/settings/settings.service.d.ts +2 -0
- package/lib/core-library.service.d.ts +4 -0
- package/package.json +1 -1
- package/xsolla-payment-client-core-0.2.9.tgz +0 -0
- package/xsolla-payment-client-core-0.2.8.tgz +0 -0
|
@@ -126,6 +126,9 @@ class SettingsService {
|
|
|
126
126
|
get token() {
|
|
127
127
|
return this._token;
|
|
128
128
|
}
|
|
129
|
+
get isMobile() {
|
|
130
|
+
return this._isMobile;
|
|
131
|
+
}
|
|
129
132
|
get hasResponse() {
|
|
130
133
|
return !!this.response;
|
|
131
134
|
}
|
|
@@ -134,6 +137,7 @@ class SettingsService {
|
|
|
134
137
|
this.isInitialized = false;
|
|
135
138
|
this._token = '';
|
|
136
139
|
this.sandboxMode = false;
|
|
140
|
+
this._isMobile = false;
|
|
137
141
|
}
|
|
138
142
|
async init(configuration) {
|
|
139
143
|
if (!configuration.token) {
|
|
@@ -141,6 +145,7 @@ class SettingsService {
|
|
|
141
145
|
}
|
|
142
146
|
this._token = configuration.token;
|
|
143
147
|
this.sandboxMode = !!configuration.sandbox;
|
|
148
|
+
this._isMobile = configuration.isMobile;
|
|
144
149
|
await this.sendRequest(this.token);
|
|
145
150
|
this.isInitialized = true;
|
|
146
151
|
}
|
|
@@ -691,6 +696,9 @@ class XpsApiService {
|
|
|
691
696
|
country: this.countryService.getCountry(),
|
|
692
697
|
...parameters,
|
|
693
698
|
};
|
|
699
|
+
if (this.settingsService.isMobile) {
|
|
700
|
+
requestParams.mobile = "1" /* XpsBoolean.true */;
|
|
701
|
+
}
|
|
694
702
|
return lastValueFrom(this.secureApiClient.post(this.directPaymentApiRoute, new URLSearchParams({ ...requestParams }), {
|
|
695
703
|
headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'),
|
|
696
704
|
responseType: 'json',
|
|
@@ -1096,11 +1104,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
1096
1104
|
type: Injectable
|
|
1097
1105
|
}] });
|
|
1098
1106
|
|
|
1107
|
+
class ShowQrCodeActionCreator {
|
|
1108
|
+
constructor() {
|
|
1109
|
+
this.type = 'show_qr_code';
|
|
1110
|
+
}
|
|
1111
|
+
getActionData() {
|
|
1112
|
+
return {
|
|
1113
|
+
type: this.type,
|
|
1114
|
+
data: null,
|
|
1115
|
+
};
|
|
1116
|
+
}
|
|
1117
|
+
isSuitable(response) {
|
|
1118
|
+
return Boolean(response.parameters?.form?.qr);
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
ShowQrCodeActionCreator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ShowQrCodeActionCreator, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1122
|
+
ShowQrCodeActionCreator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ShowQrCodeActionCreator });
|
|
1123
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ShowQrCodeActionCreator, decorators: [{
|
|
1124
|
+
type: Injectable
|
|
1125
|
+
}] });
|
|
1126
|
+
|
|
1099
1127
|
const nextActionsToken = new InjectionToken('Action');
|
|
1100
1128
|
const nextActions = [
|
|
1101
1129
|
ShowFieldsActionCreator,
|
|
1102
1130
|
CheckStatusActionCreator,
|
|
1103
1131
|
SpecialButtonActionCreator,
|
|
1132
|
+
ShowQrCodeActionCreator,
|
|
1104
1133
|
RedirectActionCreator,
|
|
1105
1134
|
];
|
|
1106
1135
|
const flowUpdateNextActions = [
|
|
@@ -5471,6 +5500,12 @@ class PaymentService {
|
|
|
5471
5500
|
country: this.countryService.getCountry(),
|
|
5472
5501
|
};
|
|
5473
5502
|
}
|
|
5503
|
+
getQrCode() {
|
|
5504
|
+
if (!isSubmitResponse(this.data)) {
|
|
5505
|
+
throw new Error('Should submit form first');
|
|
5506
|
+
}
|
|
5507
|
+
return this.data.parameters.form.qr.title;
|
|
5508
|
+
}
|
|
5474
5509
|
getPid() {
|
|
5475
5510
|
if (this.data instanceof SubmitResponse) {
|
|
5476
5511
|
return (Number(this.data.fields.find((field) => field.name === 'fix_pid')?.value) || null);
|
|
@@ -6099,6 +6134,12 @@ class CoreLibraryService {
|
|
|
6099
6134
|
async getStatus(url) {
|
|
6100
6135
|
return this.statusService.getStatusWithUrlSearchParams(url);
|
|
6101
6136
|
}
|
|
6137
|
+
getQrCodeInitialData() {
|
|
6138
|
+
return {
|
|
6139
|
+
qrCode: this.paymentService.getQrCode(),
|
|
6140
|
+
pid: this.paymentService.getPid(),
|
|
6141
|
+
};
|
|
6142
|
+
}
|
|
6102
6143
|
setCountry(country) {
|
|
6103
6144
|
this.countryService.setCountry(country);
|
|
6104
6145
|
}
|