@xsolla/payment-client-core 0.2.12 → 0.2.14

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.
Files changed (24) hide show
  1. package/esm2020/lib/core/combined-payment-methods/combined-payment-methods.interface.mjs +2 -0
  2. package/esm2020/lib/core/combined-payment-methods/combined-payment-methods.service.mjs +32 -0
  3. package/esm2020/lib/core/payment/initialize/initialize-request-params.interface.mjs +1 -1
  4. package/esm2020/lib/core/payment/initialize/initialize.service.mjs +1 -4
  5. package/esm2020/lib/core/payment/xps-api/xps-api.service.mjs +2 -1
  6. package/esm2020/lib/core/payment-methods/payment-methods.service.mjs +4 -1
  7. package/esm2020/lib/core/settings/configuration.interface.mjs +1 -1
  8. package/esm2020/lib/core/settings/settings.service.mjs +5 -1
  9. package/esm2020/lib/core-library.service.mjs +7 -4
  10. package/fesm2015/xsolla-payment-client-core.mjs +45 -7
  11. package/fesm2015/xsolla-payment-client-core.mjs.map +1 -1
  12. package/fesm2020/xsolla-payment-client-core.mjs +41 -6
  13. package/fesm2020/xsolla-payment-client-core.mjs.map +1 -1
  14. package/lib/core/combined-payment-methods/combined-payment-methods.interface.d.ts +9 -0
  15. package/lib/core/combined-payment-methods/combined-payment-methods.service.d.ts +12 -0
  16. package/lib/core/payment/initialize/initialize-request-params.interface.d.ts +0 -1
  17. package/lib/core/payment/initialize/initialize.service.d.ts +0 -1
  18. package/lib/core/payment-methods/payment-methods.service.d.ts +2 -0
  19. package/lib/core/settings/configuration.interface.d.ts +1 -0
  20. package/lib/core/settings/settings.service.d.ts +2 -0
  21. package/lib/core-library.service.d.ts +5 -1
  22. package/package.json +1 -1
  23. package/xsolla-payment-client-core-0.2.14.tgz +0 -0
  24. package/xsolla-payment-client-core-0.2.12.tgz +0 -0
@@ -144,12 +144,16 @@ class SettingsService {
144
144
  }
145
145
  this._token = configuration.token;
146
146
  this.sandboxMode = !!configuration.sandbox;
147
+ this._refer = configuration.refer;
147
148
  await this.sendRequest(this.token);
148
149
  this.isInitialized = true;
149
150
  }
150
151
  isSandboxMode() {
151
152
  return this.sandboxMode;
152
153
  }
154
+ get refer() {
155
+ return this._refer;
156
+ }
153
157
  async sendRequest(token) {
154
158
  const params = new HttpParams().set('access_token', token);
155
159
  this.secureApi.setSandboxMode(this.isSandboxMode());
@@ -241,6 +245,9 @@ class PaymentMethodsService {
241
245
  this.apiRoute = 'remained_payment_methods';
242
246
  this.cache = new Map();
243
247
  }
248
+ async getAllMethods() {
249
+ return this.request();
250
+ }
244
251
  async getList(isSaveMethodMode) {
245
252
  const response = await this.request(isSaveMethodMode);
246
253
  if (this.isFixedPaymentMethod) {
@@ -1222,6 +1229,7 @@ class XpsApiService {
1222
1229
  ...this.collectAnalyticsParameters(pid, paymentWithSavedMethod),
1223
1230
  ...this.collectUserSessionId(),
1224
1231
  country: this.countryService.getCountry(),
1232
+ refer: this.settingsService.refer,
1225
1233
  ...parameters,
1226
1234
  };
1227
1235
  if (this.userAgentService.isMobileDevice) {
@@ -2545,14 +2553,11 @@ class InitializeService {
2545
2553
  this.encryptCreditCardService = encryptCreditCardService;
2546
2554
  this.showErrorsActionCreator = showErrorsActionCreator;
2547
2555
  this.userBehaviourAnalyticsService = userBehaviourAnalyticsService;
2548
- // TODO PAYMENTS-15743: replace with new refer id for headless core
2549
- this.ps4ReferId = '22';
2550
2556
  }
2551
2557
  async request(config) {
2552
2558
  const requestParams = {
2553
2559
  access_token: this.settingsService.token,
2554
2560
  pid: String(config.paymentMethodId),
2555
- refer: this.ps4ReferId,
2556
2561
  country: this.countryService.getCountry(),
2557
2562
  returnUrl: config.returnUrl,
2558
2563
  paymentWithSavedMethod: config.paymentWithSavedMethod === true
@@ -6971,8 +6976,36 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
6971
6976
  args: [windowToken]
6972
6977
  }] }, { type: i0.NgZone }]; } });
6973
6978
 
6979
+ class CombinedPaymentMethodsService {
6980
+ constructor(paymentMethodsService, savedMethodsService) {
6981
+ this.paymentMethodsService = paymentMethodsService;
6982
+ this.savedMethodsService = savedMethodsService;
6983
+ }
6984
+ async getCombinedPaymentMethods() {
6985
+ const [paymentMethods, savedMethods] = await Promise.all([
6986
+ this.paymentMethodsService.getAllMethods(),
6987
+ this.savedMethodsService.getList(),
6988
+ ]);
6989
+ return {
6990
+ paymentMethods: {
6991
+ quick: paymentMethods.especial,
6992
+ remained: paymentMethods.remained,
6993
+ },
6994
+ savedMethods,
6995
+ };
6996
+ }
6997
+ }
6998
+ CombinedPaymentMethodsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CombinedPaymentMethodsService, deps: [{ token: PaymentMethodsService }, { token: SavedMethodsService }], target: i0.ɵɵFactoryTarget.Injectable });
6999
+ CombinedPaymentMethodsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CombinedPaymentMethodsService, providedIn: 'root' });
7000
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CombinedPaymentMethodsService, decorators: [{
7001
+ type: Injectable,
7002
+ args: [{
7003
+ providedIn: 'root',
7004
+ }]
7005
+ }], ctorParameters: function () { return [{ type: PaymentMethodsService }, { type: SavedMethodsService }]; } });
7006
+
6974
7007
  class CoreLibraryService {
6975
- constructor(settingsService, countryService, paymentMethodsService, savedMethodsService, userBalanceService, paymentConfigService, paymentService, deviceFingerPrintService, financeDetailsService, legalService, statusService, nextActionService, creditCardService, creditCardStateService, formMessagesService, editSavedMethodsService, userBehaviourAnalyticsService, performanceService) {
7008
+ constructor(settingsService, countryService, paymentMethodsService, savedMethodsService, userBalanceService, paymentConfigService, paymentService, deviceFingerPrintService, financeDetailsService, legalService, statusService, nextActionService, creditCardService, creditCardStateService, formMessagesService, editSavedMethodsService, userBehaviourAnalyticsService, performanceService, combinedPaymentMethodsService) {
6976
7009
  this.settingsService = settingsService;
6977
7010
  this.countryService = countryService;
6978
7011
  this.paymentMethodsService = paymentMethodsService;
@@ -6991,10 +7024,12 @@ class CoreLibraryService {
6991
7024
  this.editSavedMethodsService = editSavedMethodsService;
6992
7025
  this.userBehaviourAnalyticsService = userBehaviourAnalyticsService;
6993
7026
  this.performanceService = performanceService;
7027
+ this.combinedPaymentMethodsService = combinedPaymentMethodsService;
6994
7028
  this.paymentMethods = {
6995
7029
  getList: async (isSaveMethodMode) => this.paymentMethodsService.getList(isSaveMethodMode),
6996
7030
  getQuickMethods: async () => this.paymentMethodsService.getQuickMethods(),
6997
7031
  getSavedMethods: async () => this.savedMethodsService.getList(),
7032
+ getCombinedPaymentMethods: async () => this.combinedPaymentMethodsService.getCombinedPaymentMethods(),
6998
7033
  getUserBalance: async () => this.userBalanceService.getUserBalance(),
6999
7034
  deleteSavedMethod: async (id, type) => this.editSavedMethodsService.deleteSavedMethodRequest(id, type),
7000
7035
  };
@@ -7088,14 +7123,14 @@ class CoreLibraryService {
7088
7123
  return this.paymentService.formResponseValue;
7089
7124
  }
7090
7125
  }
7091
- CoreLibraryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, deps: [{ token: SettingsService }, { token: CountryService }, { token: PaymentMethodsService }, { token: SavedMethodsService }, { token: UserBalanceService }, { token: PaymentConfigService }, { token: PaymentService }, { token: DeviceFingerPrintService }, { token: FinanceDetailsService }, { token: LegalService }, { token: StatusService }, { token: NextActionService }, { token: CreditCardService }, { token: CreditCardStateService }, { token: FormMessagesService }, { token: EditSavedMethodsService }, { token: UserBehaviourAnalyticsService }, { token: PerformanceService }], target: i0.ɵɵFactoryTarget.Injectable });
7126
+ CoreLibraryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, deps: [{ token: SettingsService }, { token: CountryService }, { token: PaymentMethodsService }, { token: SavedMethodsService }, { token: UserBalanceService }, { token: PaymentConfigService }, { token: PaymentService }, { token: DeviceFingerPrintService }, { token: FinanceDetailsService }, { token: LegalService }, { token: StatusService }, { token: NextActionService }, { token: CreditCardService }, { token: CreditCardStateService }, { token: FormMessagesService }, { token: EditSavedMethodsService }, { token: UserBehaviourAnalyticsService }, { token: PerformanceService }, { token: CombinedPaymentMethodsService }], target: i0.ɵɵFactoryTarget.Injectable });
7092
7127
  CoreLibraryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, providedIn: 'root' });
7093
7128
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, decorators: [{
7094
7129
  type: Injectable,
7095
7130
  args: [{
7096
7131
  providedIn: 'root',
7097
7132
  }]
7098
- }], ctorParameters: function () { return [{ type: SettingsService }, { type: CountryService }, { type: PaymentMethodsService }, { type: SavedMethodsService }, { type: UserBalanceService }, { type: PaymentConfigService }, { type: PaymentService }, { type: DeviceFingerPrintService }, { type: FinanceDetailsService }, { type: LegalService }, { type: StatusService }, { type: NextActionService }, { type: CreditCardService }, { type: CreditCardStateService }, { type: FormMessagesService }, { type: EditSavedMethodsService }, { type: UserBehaviourAnalyticsService }, { type: PerformanceService }]; } });
7133
+ }], ctorParameters: function () { return [{ type: SettingsService }, { type: CountryService }, { type: PaymentMethodsService }, { type: SavedMethodsService }, { type: UserBalanceService }, { type: PaymentConfigService }, { type: PaymentService }, { type: DeviceFingerPrintService }, { type: FinanceDetailsService }, { type: LegalService }, { type: StatusService }, { type: NextActionService }, { type: CreditCardService }, { type: CreditCardStateService }, { type: FormMessagesService }, { type: EditSavedMethodsService }, { type: UserBehaviourAnalyticsService }, { type: PerformanceService }, { type: CombinedPaymentMethodsService }]; } });
7099
7134
 
7100
7135
  class HttpError extends AppError {
7101
7136
  constructor(error, req) {