@xsolla/payment-client-core 0.0.1 → 0.0.2
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/README.md +8 -11
- package/esm2020/lib/core/boolean-number.enum.mjs +6 -0
- package/esm2020/lib/core/country/country.service.mjs +27 -0
- package/esm2020/lib/core/deep-readonly.type.mjs +2 -0
- package/esm2020/lib/core/exceptions-handling/errors/api-error.interface.mjs +2 -0
- package/esm2020/lib/core/exceptions-handling/errors/app-error.class.mjs +6 -0
- package/esm2020/lib/core/exceptions-handling/errors/http-error.class.mjs +40 -0
- package/esm2020/lib/core/exceptions-handling/errors/response-error.class.mjs +7 -0
- package/esm2020/lib/core/exceptions-handling/http-interceptor/http-error-data.interface.mjs +2 -0
- package/esm2020/lib/core/exceptions-handling/http-interceptor/http-error-response-data.interface.mjs +2 -0
- package/esm2020/lib/core/exceptions-handling/http-interceptor/http-exceptions.interceptor.mjs +22 -0
- package/esm2020/lib/core/extended-window.interface.mjs +2 -0
- package/esm2020/lib/core/http/secure-api/api-url.const.mjs +3 -0
- package/esm2020/lib/core/http/secure-api/options.interface.mjs +2 -0
- package/esm2020/lib/core/http/secure-api/secure-api.service.mjs +55 -0
- package/esm2020/lib/core/payment-methods/payment-method-api.interface.mjs +2 -0
- package/esm2020/lib/core/payment-methods/payment-method.interface.mjs +2 -0
- package/esm2020/lib/core/payment-methods/payment-methods-api.interface.mjs +2 -0
- package/esm2020/lib/core/payment-methods/payment-methods-request-params.interface.mjs +2 -0
- package/esm2020/lib/core/payment-methods/payment-methods-response.class.mjs +26 -0
- package/esm2020/lib/core/payment-methods/payment-methods-response.interface.mjs +2 -0
- package/esm2020/lib/core/payment-methods/payment-methods-response.token.mjs +8 -0
- package/esm2020/lib/core/payment-methods/payment-methods.service.mjs +58 -0
- package/esm2020/lib/core/settings/auto-redirect-on-status.mjs +14 -0
- package/esm2020/lib/core/settings/balance.interface.mjs +2 -0
- package/esm2020/lib/core/settings/bonus.interface.mjs +2 -0
- package/esm2020/lib/core/settings/configuration.interface.mjs +2 -0
- package/esm2020/lib/core/settings/empty-utils-response.error.mjs +7 -0
- package/esm2020/lib/core/settings/header-type.enum.mjs +6 -0
- package/esm2020/lib/core/settings/offer.interface.mjs +2 -0
- package/esm2020/lib/core/settings/project.interface.mjs +2 -0
- package/esm2020/lib/core/settings/purchase.interface.mjs +2 -0
- package/esm2020/lib/core/settings/settings-mode.enum.mjs +5 -0
- package/esm2020/lib/core/settings/settings.interface.mjs +2 -0
- package/esm2020/lib/core/settings/settings.service.mjs +85 -0
- package/esm2020/lib/core/settings/status-back-show.mjs +16 -0
- package/esm2020/lib/core/settings/tracking-info.interface.mjs +2 -0
- package/esm2020/lib/core/settings/user.interface.mjs +2 -0
- package/esm2020/lib/core/settings/utils-response.interface.mjs +2 -0
- package/esm2020/lib/core/window.token.mjs +3 -0
- package/esm2020/lib/core-library.module.mjs +35 -17
- package/esm2020/lib/core-library.service.mjs +31 -13
- package/esm2020/public-api.mjs +6 -7
- package/esm2020/xsolla-payment-client-core.mjs +4 -4
- package/fesm2015/xsolla-payment-client-core.mjs +390 -33
- package/fesm2015/xsolla-payment-client-core.mjs.map +1 -1
- package/fesm2020/xsolla-payment-client-core.mjs +376 -33
- package/fesm2020/xsolla-payment-client-core.mjs.map +1 -1
- package/index.d.ts +5 -5
- package/lib/core/boolean-number.enum.d.ts +4 -0
- package/lib/core/country/country.service.d.ts +12 -0
- package/lib/core/deep-readonly.type.d.ts +3 -0
- package/lib/core/exceptions-handling/errors/api-error.interface.d.ts +4 -0
- package/lib/core/exceptions-handling/errors/app-error.class.d.ts +3 -0
- package/lib/core/exceptions-handling/errors/http-error.class.d.ts +10 -0
- package/lib/core/exceptions-handling/errors/response-error.class.d.ts +4 -0
- package/lib/core/exceptions-handling/http-interceptor/http-error-data.interface.d.ts +20 -0
- package/lib/core/exceptions-handling/http-interceptor/http-error-response-data.interface.d.ts +7 -0
- package/lib/core/exceptions-handling/http-interceptor/http-exceptions.interceptor.d.ts +11 -0
- package/lib/core/extended-window.interface.d.ts +1 -0
- package/lib/core/http/secure-api/api-url.const.d.ts +2 -0
- package/lib/core/http/secure-api/options.interface.d.ts +14 -0
- package/lib/core/http/secure-api/secure-api.service.d.ts +20 -0
- package/lib/core/payment-methods/payment-method-api.interface.d.ts +11 -0
- package/lib/core/payment-methods/payment-method.interface.d.ts +11 -0
- package/lib/core/payment-methods/payment-methods-api.interface.d.ts +10 -0
- package/lib/core/payment-methods/payment-methods-request-params.interface.d.ts +4 -0
- package/lib/core/payment-methods/payment-methods-response.class.d.ts +13 -0
- package/lib/core/payment-methods/payment-methods-response.interface.d.ts +4 -0
- package/lib/core/payment-methods/payment-methods-response.token.d.ts +7 -0
- package/lib/core/payment-methods/payment-methods.service.d.ts +20 -0
- package/lib/core/settings/auto-redirect-on-status.d.ts +12 -0
- package/lib/core/settings/balance.interface.d.ts +4 -0
- package/lib/core/settings/bonus.interface.d.ts +10 -0
- package/lib/core/settings/configuration.interface.d.ts +5 -0
- package/lib/core/settings/empty-utils-response.error.d.ts +4 -0
- package/lib/core/settings/header-type.enum.d.ts +4 -0
- package/lib/core/settings/offer.interface.d.ts +6 -0
- package/lib/core/settings/project.interface.d.ts +32 -0
- package/lib/core/settings/purchase.interface.d.ts +47 -0
- package/lib/core/settings/settings-mode.enum.d.ts +3 -0
- package/lib/core/settings/settings.interface.d.ts +45 -0
- package/lib/core/settings/settings.service.d.ts +30 -0
- package/lib/core/settings/status-back-show.d.ts +14 -0
- package/lib/core/settings/tracking-info.interface.d.ts +5 -0
- package/lib/core/settings/user.interface.d.ts +23 -0
- package/lib/core/settings/utils-response.interface.d.ts +16 -0
- package/lib/core/window.token.d.ts +3 -0
- package/lib/core-library.module.d.ts +7 -7
- package/lib/core-library.service.d.ts +20 -5
- package/package.json +4 -3
- package/public-api.d.ts +2 -3
- package/xsolla-payment-client-core-0.0.2.tgz +0 -0
- package/esm2020/lib/core-library.component.mjs +0 -11
- package/lib/core-library.component.d.ts +0 -5
- package/xsolla-payment-client-core-0.0.1.tgz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xsolla-payment-client-core.mjs","sources":["../../../packages/payment-client-core/src/lib/core-library.service.ts","../../../packages/payment-client-core/src/lib/core-library.component.ts","../../../packages/payment-client-core/src/lib/core-library.module.ts","../../../packages/payment-client-core/src/public-api.ts","../../../packages/payment-client-core/src/xsolla-payment-client-core.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class CoreLibraryService {}\n","import { Component } from '@angular/core';\n\n@Component({\n selector: 'x-payment-client-core',\n template: ` <p>core-library works!</p> `,\n styles: [],\n})\nexport class CoreLibraryComponent {}\n","import { NgModule } from '@angular/core';\nimport { CoreLibraryComponent } from './core-library.component';\n\n@NgModule({\n declarations: [CoreLibraryComponent],\n imports: [],\n exports: [CoreLibraryComponent],\n})\nexport class CoreLibraryModule {}\n","/*\n * Public API Surface of core-library\n */\n\nexport * from './lib/core-library.service';\nexport * from './lib/core-library.component';\nexport * from './lib/core-library.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;MAKa,kBAAkB,CAAA;;+GAAlB,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAlB,kBAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,cAFjB,MAAM,EAAA,CAAA,CAAA;2FAEP,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAH9B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;iBACnB,CAAA;;;MCGY,oBAAoB,CAAA;;iHAApB,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAApB,oBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,oBAAoB,6DAHrB,8BAA8B,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,CAAA;2FAG7B,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBALhC,SAAS;YACE,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,uBAAuB,YACvB,CAA8B,4BAAA,CAAA,EAAA,CAAA;;;MCI7B,iBAAiB,CAAA;;8GAAjB,iBAAiB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;+GAAjB,iBAAiB,EAAA,YAAA,EAAA,CAJb,oBAAoB,CAAA,EAAA,OAAA,EAAA,CAEzB,oBAAoB,CAAA,EAAA,CAAA,CAAA;+GAEnB,iBAAiB,EAAA,CAAA,CAAA;2FAAjB,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAL7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,YAAY,EAAE,CAAC,oBAAoB,CAAC;AACpC,oBAAA,OAAO,EAAE,EAAE;oBACX,OAAO,EAAE,CAAC,oBAAoB,CAAC;iBAChC,CAAA;;;ACPD;;AAEG;;ACFH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"xsolla-payment-client-core.mjs","sources":["../../../packages/payment-client-core/src/lib/core/exceptions-handling/errors/app-error.class.ts","../../../packages/payment-client-core/src/lib/core/settings/empty-utils-response.error.ts","../../../packages/payment-client-core/src/lib/core/window.token.ts","../../../packages/payment-client-core/src/lib/core/http/secure-api/api-url.const.ts","../../../packages/payment-client-core/src/lib/core/http/secure-api/secure-api.service.ts","../../../packages/payment-client-core/src/lib/core/settings/settings.service.ts","../../../packages/payment-client-core/src/lib/core/country/country.service.ts","../../../packages/payment-client-core/src/lib/core/exceptions-handling/errors/response-error.class.ts","../../../packages/payment-client-core/src/lib/core/boolean-number.enum.ts","../../../packages/payment-client-core/src/lib/core/payment-methods/payment-methods-response.class.ts","../../../packages/payment-client-core/src/lib/core/payment-methods/payment-methods-response.token.ts","../../../packages/payment-client-core/src/lib/core/payment-methods/payment-methods.service.ts","../../../packages/payment-client-core/src/lib/core-library.service.ts","../../../packages/payment-client-core/src/lib/core/exceptions-handling/errors/http-error.class.ts","../../../packages/payment-client-core/src/lib/core/exceptions-handling/http-interceptor/http-exceptions.interceptor.ts","../../../packages/payment-client-core/src/lib/core-library.module.ts","../../../packages/payment-client-core/src/public-api.ts","../../../packages/payment-client-core/src/xsolla-payment-client-core.ts"],"sourcesContent":["export class AppError extends Error {\n public constructor(message: string) {\n super(message);\n }\n}\n","import { AppError } from '../exceptions-handling/errors/app-error.class';\n\nexport class EmptyUtilsResponseError extends AppError {\n public constructor() {\n super('Utils response is empty or not requested. Check your token.');\n }\n}\n","import { InjectionToken } from '@angular/core';\nimport { ExtendedWindow } from './extended-window.interface';\n\nexport const windowToken: InjectionToken<ExtendedWindow> = new InjectionToken(\n 'window'\n);\n","export const defaultApiUrl = 'https://secure.xsolla.com/paystation2/api/';\nexport const sandboxApiUrl =\n 'https://sandbox-secure.xsolla.com/paystation2/api/';\n","import { Observable } from 'rxjs';\nimport { Inject, Injectable } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { windowToken } from '../../window.token';\nimport { ExtendedWindow } from '../../extended-window.interface';\nimport { RequestOptions } from './options.interface';\nimport { defaultApiUrl, sandboxApiUrl } from './api-url.const';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SecureApiClient {\n private isSandboxMode = false;\n\n public constructor(\n private readonly httpClient: HttpClient,\n @Inject(windowToken)\n private readonly window: ExtendedWindow\n ) {}\n\n public setSandboxMode(isSandboxMode: boolean): void {\n this.isSandboxMode = isSandboxMode;\n }\n\n public get<T>(url: string, options?: RequestOptions): Observable<T> {\n return this.httpClient.get<T>(`${this.baseUrl}${url}`, options);\n }\n\n public post<T>(\n url: string,\n body: unknown | null,\n options?: RequestOptions\n ): Observable<T> {\n return this.httpClient.post<T>(`${this.baseUrl}${url}`, body, options);\n }\n\n public patch<T>(\n url: string,\n body: unknown | null,\n options?: RequestOptions\n ): Observable<T> {\n return this.httpClient.patch<T>(`${this.baseUrl}${url}`, body, options);\n }\n\n public put<T>(\n url: string,\n body: unknown | null,\n options?: RequestOptions\n ): Observable<T> {\n return this.httpClient.put<T>(`${this.baseUrl}${url}`, body, options);\n }\n\n public delete<T>(url: string, options?: RequestOptions): Observable<T> {\n return this.httpClient.delete<T>(`${this.baseUrl}${url}`, options);\n }\n\n public get baseUrl(): string {\n let predefinedBaseUrl: string | null = null;\n\n try {\n predefinedBaseUrl = this.window.localStorage.getItem('devApiUrl');\n } catch (e: unknown) {\n console.warn('localStorage is not available');\n }\n\n if (predefinedBaseUrl) {\n return predefinedBaseUrl;\n }\n\n return this.isSandboxMode ? sandboxApiUrl : defaultApiUrl;\n }\n}\n","import { firstValueFrom } from 'rxjs';\nimport { Injectable } from '@angular/core';\nimport { HttpParams } from '@angular/common/http';\nimport { SecureApiClient } from '../http/secure-api/secure-api.service';\nimport { DeepReadonly } from '../deep-readonly.type';\nimport { InitConfiguration } from './configuration.interface';\nimport { EmptyUtilsResponseError } from './empty-utils-response.error';\nimport { User } from './user.interface';\nimport { Settings } from './settings.interface';\nimport { Purchase } from './purchase.interface';\nimport { Project } from './project.interface';\nimport { UtilsResponse } from './utils-response.interface';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SettingsService {\n public get project(): DeepReadonly<Project> {\n if (!this.response) {\n throw new EmptyUtilsResponseError();\n }\n\n return this.response.project;\n }\n\n public get purchase(): DeepReadonly<Purchase> {\n if (!this.response) {\n throw new EmptyUtilsResponseError();\n }\n\n return this.response.purchase;\n }\n\n public get settings(): DeepReadonly<Settings> {\n if (!this.response) {\n throw new EmptyUtilsResponseError();\n }\n\n if (this.response?.purchase_external_id) {\n return {\n ...this.response.settings,\n purchase_external_id: this.response.purchase_external_id,\n };\n }\n\n return this.response?.settings;\n }\n\n public get user(): DeepReadonly<User> {\n if (!this.response) {\n throw new EmptyUtilsResponseError();\n }\n\n return this.response.user;\n }\n\n public get utilsResponse(): DeepReadonly<UtilsResponse> {\n if (!this.response) {\n throw new EmptyUtilsResponseError();\n }\n\n return this.response;\n }\n\n public get isEmpty(): boolean {\n return !this.response;\n }\n\n public get token(): string {\n return this._token;\n }\n\n public get hasResponse(): boolean {\n return !!this.response;\n }\n\n public isInitialized = false;\n\n private response!: DeepReadonly<UtilsResponse> | undefined;\n\n private _token = '';\n\n private sandboxMode = false;\n\n public constructor(private readonly secureApi: SecureApiClient) {}\n\n public async init(configuration: InitConfiguration): Promise<void> {\n if (!configuration.token) {\n return Promise.reject('token is missing');\n }\n\n this._token = configuration.token;\n this.sandboxMode = !!configuration.sandbox;\n\n await this.sendRequest(this.token);\n\n this.isInitialized = true;\n }\n\n public isSandboxMode(): boolean {\n return this.sandboxMode;\n }\n\n private async sendRequest(token: string): Promise<void> {\n const params = new HttpParams().set('access_token', token);\n\n this.secureApi.setSandboxMode(this.isSandboxMode());\n\n this.response = await firstValueFrom(\n this.secureApi.get<UtilsResponse>('utils', { params })\n );\n }\n}\n","import { Injectable } from '@angular/core';\nimport { SettingsService } from '../settings/settings.service';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class CountryService {\n private userDefinedCountry: string | null = null;\n\n public constructor(private readonly settingsService: SettingsService) {}\n\n public setCountry(country: string): void {\n this.userDefinedCountry = country;\n }\n\n public getCountry(): string {\n return this.userDefinedCountry ?? this.getTokenCountry();\n }\n\n private getTokenCountry(): string {\n return this.settingsService.user.country.value;\n }\n}\n","import { AppError } from './app-error.class';\n\nexport class ResponseError extends AppError {\n public constructor(message?: string) {\n super('Response failed' + (message ? `: \"${message}\".` : '.'));\n }\n}\n","export enum BooleanNumber {\n false = 0,\n true = 1,\n}\n","import { BooleanNumber } from '../boolean-number.enum';\nimport { PaymentMethodApi } from './payment-method-api.interface';\nimport { PaymentMethod } from './payment-method.interface';\nimport { PaymentMethodsApi } from './payment-methods-api.interface';\n\nexport class PaymentMethodsResponse {\n public readonly top: PaymentMethod[];\n public readonly especial: PaymentMethod[];\n public readonly remained: PaymentMethod[];\n public readonly remainedCount: { total: number; visible: number };\n\n public constructor(paymentMethods: PaymentMethodsApi) {\n this.especial = paymentMethods.especial.map((method) =>\n this.mapPaymentMethod(method)\n );\n this.top = paymentMethods.top.map((method) =>\n this.mapPaymentMethod(method)\n );\n this.remained = paymentMethods.remained.map((method) =>\n this.mapPaymentMethod(method)\n );\n this.remainedCount = {\n total: paymentMethods.remained_count.total,\n visible: paymentMethods.remained_count.visible,\n };\n }\n\n private mapPaymentMethod(method: PaymentMethodApi): PaymentMethod {\n return {\n id: method.id,\n rank: method.rank,\n name: method.name,\n aliases: method.aliases,\n categories: method.cat,\n isVisible: method.is_visible,\n recommended: method.recommended === BooleanNumber.true,\n enabledSaveAccount: method.enabled_save_account,\n iconName: method.switch_icon_name,\n };\n }\n}\n","import { InjectionToken, ValueProvider } from '@angular/core';\nimport { PaymentMethodsResponse } from './payment-methods-response.class';\n\ntype ResponseParameters = ConstructorParameters<typeof PaymentMethodsResponse>;\n\nexport type PaymentMethodsResponseFactory = (\n ...args: ResponseParameters\n) => PaymentMethodsResponse;\n\nexport const paymentMethodsResponseFactoryToken: InjectionToken<PaymentMethodsResponseFactory> =\n new InjectionToken<PaymentMethodsResponseFactory>('PaymentMethodsResponse');\n\nexport const paymentMethodsResponseFactoryProvider: ValueProvider = {\n provide: paymentMethodsResponseFactoryToken,\n useValue: (...args: ResponseParameters) =>\n new PaymentMethodsResponse(...args),\n};\n","import { HttpHeaders } from '@angular/common/http';\nimport { Inject, Injectable } from '@angular/core';\nimport { lastValueFrom, map } from 'rxjs';\nimport { CountryService } from '../country/country.service';\nimport { ResponseError } from '../exceptions-handling/errors/response-error.class';\nimport { SecureApiClient } from '../http/secure-api/secure-api.service';\nimport { SettingsService } from '../settings/settings.service';\nimport { PaymentMethod } from './payment-method.interface';\nimport { PaymentMethodsRequestParams } from './payment-methods-request-params.interface';\nimport { PaymentMethodsResponse } from './payment-methods-response.class';\nimport { PaymentMethodsResponseApi } from './payment-methods-response.interface';\nimport {\n PaymentMethodsResponseFactory,\n paymentMethodsResponseFactoryToken,\n} from './payment-methods-response.token';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class PaymentMethodsService {\n private readonly apiRoute = 'remained_payment_methods';\n\n private readonly cache = new Map<string, Promise<PaymentMethodsResponse>>();\n\n public constructor(\n @Inject(paymentMethodsResponseFactoryToken)\n private readonly responseFactory: PaymentMethodsResponseFactory,\n private readonly settingsService: SettingsService,\n private readonly countryService: CountryService,\n private readonly secureApi: SecureApiClient\n ) {}\n\n public async getList(): Promise<PaymentMethod[]> {\n const response = await this.request();\n return response.remained;\n }\n\n public async getQuickMethods(): Promise<PaymentMethod[]> {\n const response = await this.request();\n return response.especial;\n }\n\n private async request(): Promise<PaymentMethodsResponse> {\n const requestParams: PaymentMethodsRequestParams = {\n access_token: this.settingsService.token,\n country: this.countryService.getCountry(),\n };\n const cacheKey = JSON.stringify(requestParams);\n\n if (!this.cache.has(cacheKey)) {\n this.cache.set(\n cacheKey,\n lastValueFrom(\n this.secureApi\n .post<PaymentMethodsResponseApi>(\n this.apiRoute,\n new URLSearchParams({ ...requestParams }),\n {\n headers: new HttpHeaders().set(\n 'Content-Type',\n 'application/x-www-form-urlencoded; charset=utf-8'\n ),\n responseType: 'json',\n }\n )\n .pipe(\n map((response) => this.responseFactory(response.payment_methods))\n )\n ).catch((error: Error) => {\n throw new ResponseError(error.message);\n })\n );\n }\n\n // @ts-expect-error the map already has the cache with key\n return this.cache.get(cacheKey);\n }\n}\n","import { Injectable } from '@angular/core';\nimport { InitConfiguration } from './core/settings/configuration.interface';\nimport { SettingsService } from './core/settings/settings.service';\nimport { CountryService } from './core/country/country.service';\nimport { PaymentMethodsService } from './core/payment-methods/payment-methods.service';\nimport { PaymentMethod } from './core/payment-methods/payment-method.interface';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class CoreLibraryService {\n public paymentMethods = {\n getList: async (): Promise<PaymentMethod[]> =>\n this.paymentMethodsService.getList(),\n\n getQuickMethods: async (): Promise<PaymentMethod[]> =>\n this.paymentMethodsService.getQuickMethods(),\n };\n\n public constructor(\n private readonly settingsService: SettingsService,\n private readonly countryService: CountryService,\n private readonly paymentMethodsService: PaymentMethodsService\n ) {}\n\n public async init(configuration: InitConfiguration): Promise<void> {\n return this.settingsService.init(configuration);\n }\n\n public setCountry(country: string): void {\n this.countryService.setCountry(country);\n }\n}\n","import { HttpErrorResponse, HttpRequest } from '@angular/common/http';\nimport { AppError } from './app-error.class';\nimport { HttpErrorData } from '../http-interceptor/http-error-data.interface';\nimport { HttpErrorResponseData } from '../http-interceptor/http-error-response-data.interface';\n\nexport class HttpError extends AppError {\n private readonly RESTRICTED_KEYS_REGEXP = new RegExp(\n '.*(card_number|number|cvv|cvn|month|year|cardholdername|client_data|dfp|password).*',\n 'i'\n );\n private readonly httpErrorData!: HttpErrorData;\n\n public constructor(error: HttpErrorResponse, req: HttpRequest<unknown>) {\n super(error.message);\n\n this.httpErrorData = {\n request: {\n url: req.url,\n method: req.method,\n headers: req.headers,\n },\n response: {\n status: error.status,\n headers: error.headers,\n },\n };\n\n if (req.body) {\n this.httpErrorData.request.data = this.cleanPersonalData(\n req.body as { [key: string]: unknown }\n );\n }\n\n if (error.statusText) {\n const errorData = error.error as HttpErrorResponseData;\n\n this.httpErrorData.response.data = {\n statusText: error.statusText,\n errors: errorData?.errors ?? [],\n };\n }\n }\n\n public getHttpErrorData(): HttpErrorData {\n return this.httpErrorData;\n }\n\n private cleanPersonalData(data: { [key: string]: unknown }): {\n [key: string]: unknown;\n } {\n return Object.entries(data).reduce((acc, [key, val]) => {\n return {\n ...acc,\n [key]: this.RESTRICTED_KEYS_REGEXP.test(key) ? '***' : val,\n };\n }, {});\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n HttpErrorResponse,\n HttpEvent,\n HttpHandler,\n HttpInterceptor,\n HttpRequest,\n} from '@angular/common/http';\n\nimport { catchError } from 'rxjs/operators';\nimport { Router } from '@angular/router';\nimport { Observable, throwError } from 'rxjs';\nimport { HttpError } from '../errors/http-error.class';\n@Injectable()\nexport class HttpExceptionsInterceptor implements HttpInterceptor {\n public constructor(public router: Router) {}\n\n public intercept(\n req: HttpRequest<unknown>,\n next: HttpHandler\n ): Observable<HttpEvent<unknown>> {\n return next.handle(req).pipe(\n catchError((error: HttpErrorResponse) => {\n return throwError(() => new HttpError(error, req));\n })\n );\n }\n}\n","import { NgModule } from '@angular/core';\nimport { HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http';\nimport { HttpExceptionsInterceptor } from './core/exceptions-handling/http-interceptor/http-exceptions.interceptor';\nimport { windowToken } from './core/window.token';\nimport { paymentMethodsResponseFactoryProvider } from './core/payment-methods/payment-methods-response.token';\n\n@NgModule({\n imports: [HttpClientModule],\n providers: [\n {\n provide: HTTP_INTERCEPTORS,\n useClass: HttpExceptionsInterceptor,\n multi: true,\n },\n { provide: windowToken, useValue: window },\n paymentMethodsResponseFactoryProvider,\n ],\n})\nexport class CoreLibraryModule {}\n","/*\n * Public API Surface of core-library\n */\n\nexport * from './lib/core-library.service';\nexport * from './lib/core-library.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.SecureApiClient","i1.SettingsService","i2.CountryService","i3.SecureApiClient","i3.PaymentMethodsService","i1"],"mappings":";;;;;;;;;AAAM,MAAO,QAAS,SAAQ,KAAK,CAAA;AACjC,IAAA,WAAA,CAAmB,OAAe,EAAA;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;KAChB;AACF;;ACFK,MAAO,uBAAwB,SAAQ,QAAQ,CAAA;AACn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EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iBAAiB,EAVjB,SAAA,EAAA;AACT,QAAA;AACE,YAAA,OAAO,EAAE,iBAAiB;AAC1B,YAAA,QAAQ,EAAE,yBAAyB;AACnC,YAAA,KAAK,EAAE,IAAI;AACZ,SAAA;AACD,QAAA,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE;QAC1C,qCAAqC;AACtC,KAAA,EAAA,OAAA,EAAA,CATS,gBAAgB,CAAA,EAAA,CAAA,CAAA;2FAWf,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAZ7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,gBAAgB,CAAC;AAC3B,oBAAA,SAAS,EAAE;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,QAAQ,EAAE,yBAAyB;AACnC,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;AACD,wBAAA,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE;wBAC1C,qCAAqC;AACtC,qBAAA;iBACF,CAAA;;;ACjBD;;AAEG;;ACFH;;AAEG;;;;"}
|
|
@@ -1,47 +1,390 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable,
|
|
2
|
+
import { InjectionToken, Injectable, Inject, NgModule } from '@angular/core';
|
|
3
|
+
import { firstValueFrom, lastValueFrom, map, throwError } from 'rxjs';
|
|
4
|
+
import * as i1 from '@angular/common/http';
|
|
5
|
+
import { HttpParams, HttpHeaders, HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
6
|
+
import { catchError } from 'rxjs/operators';
|
|
7
|
+
import * as i1$1 from '@angular/router';
|
|
3
8
|
|
|
4
|
-
class
|
|
9
|
+
class AppError extends Error {
|
|
10
|
+
constructor(message) {
|
|
11
|
+
super(message);
|
|
12
|
+
}
|
|
5
13
|
}
|
|
6
|
-
CoreLibraryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
7
|
-
CoreLibraryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, providedIn: 'root' });
|
|
8
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, decorators: [{
|
|
9
|
-
type: Injectable,
|
|
10
|
-
args: [{
|
|
11
|
-
providedIn: 'root',
|
|
12
|
-
}]
|
|
13
|
-
}] });
|
|
14
14
|
|
|
15
|
-
class
|
|
15
|
+
class EmptyUtilsResponseError extends AppError {
|
|
16
|
+
constructor() {
|
|
17
|
+
super('Utils response is empty or not requested. Check your token.');
|
|
18
|
+
}
|
|
16
19
|
}
|
|
17
|
-
CoreLibraryComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
18
|
-
CoreLibraryComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: CoreLibraryComponent, selector: "x-payment-client-core", ngImport: i0, template: ` <p>core-library works!</p> `, isInline: true });
|
|
19
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryComponent, decorators: [{
|
|
20
|
-
type: Component,
|
|
21
|
-
args: [{ selector: 'x-payment-client-core', template: ` <p>core-library works!</p> ` }]
|
|
22
|
-
}] });
|
|
23
20
|
|
|
24
|
-
|
|
21
|
+
const windowToken = new InjectionToken('window');
|
|
22
|
+
|
|
23
|
+
const defaultApiUrl = 'https://secure.xsolla.com/paystation2/api/';
|
|
24
|
+
const sandboxApiUrl = 'https://sandbox-secure.xsolla.com/paystation2/api/';
|
|
25
|
+
|
|
26
|
+
class SecureApiClient {
|
|
27
|
+
constructor(httpClient, window) {
|
|
28
|
+
this.httpClient = httpClient;
|
|
29
|
+
this.window = window;
|
|
30
|
+
this.isSandboxMode = false;
|
|
31
|
+
}
|
|
32
|
+
setSandboxMode(isSandboxMode) {
|
|
33
|
+
this.isSandboxMode = isSandboxMode;
|
|
34
|
+
}
|
|
35
|
+
get(url, options) {
|
|
36
|
+
return this.httpClient.get(`${this.baseUrl}${url}`, options);
|
|
37
|
+
}
|
|
38
|
+
post(url, body, options) {
|
|
39
|
+
return this.httpClient.post(`${this.baseUrl}${url}`, body, options);
|
|
40
|
+
}
|
|
41
|
+
patch(url, body, options) {
|
|
42
|
+
return this.httpClient.patch(`${this.baseUrl}${url}`, body, options);
|
|
43
|
+
}
|
|
44
|
+
put(url, body, options) {
|
|
45
|
+
return this.httpClient.put(`${this.baseUrl}${url}`, body, options);
|
|
46
|
+
}
|
|
47
|
+
delete(url, options) {
|
|
48
|
+
return this.httpClient.delete(`${this.baseUrl}${url}`, options);
|
|
49
|
+
}
|
|
50
|
+
get baseUrl() {
|
|
51
|
+
let predefinedBaseUrl = null;
|
|
52
|
+
try {
|
|
53
|
+
predefinedBaseUrl = this.window.localStorage.getItem('devApiUrl');
|
|
54
|
+
}
|
|
55
|
+
catch (e) {
|
|
56
|
+
console.warn('localStorage is not available');
|
|
57
|
+
}
|
|
58
|
+
if (predefinedBaseUrl) {
|
|
59
|
+
return predefinedBaseUrl;
|
|
60
|
+
}
|
|
61
|
+
return this.isSandboxMode ? sandboxApiUrl : defaultApiUrl;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
SecureApiClient.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SecureApiClient, deps: [{ token: i1.HttpClient }, { token: windowToken }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
65
|
+
SecureApiClient.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SecureApiClient, providedIn: 'root' });
|
|
66
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SecureApiClient, decorators: [{
|
|
67
|
+
type: Injectable,
|
|
68
|
+
args: [{
|
|
69
|
+
providedIn: 'root',
|
|
70
|
+
}]
|
|
71
|
+
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
|
|
72
|
+
type: Inject,
|
|
73
|
+
args: [windowToken]
|
|
74
|
+
}] }]; } });
|
|
75
|
+
|
|
76
|
+
class SettingsService {
|
|
77
|
+
get project() {
|
|
78
|
+
if (!this.response) {
|
|
79
|
+
throw new EmptyUtilsResponseError();
|
|
80
|
+
}
|
|
81
|
+
return this.response.project;
|
|
82
|
+
}
|
|
83
|
+
get purchase() {
|
|
84
|
+
if (!this.response) {
|
|
85
|
+
throw new EmptyUtilsResponseError();
|
|
86
|
+
}
|
|
87
|
+
return this.response.purchase;
|
|
88
|
+
}
|
|
89
|
+
get settings() {
|
|
90
|
+
if (!this.response) {
|
|
91
|
+
throw new EmptyUtilsResponseError();
|
|
92
|
+
}
|
|
93
|
+
if (this.response?.purchase_external_id) {
|
|
94
|
+
return {
|
|
95
|
+
...this.response.settings,
|
|
96
|
+
purchase_external_id: this.response.purchase_external_id,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
return this.response?.settings;
|
|
100
|
+
}
|
|
101
|
+
get user() {
|
|
102
|
+
if (!this.response) {
|
|
103
|
+
throw new EmptyUtilsResponseError();
|
|
104
|
+
}
|
|
105
|
+
return this.response.user;
|
|
106
|
+
}
|
|
107
|
+
get utilsResponse() {
|
|
108
|
+
if (!this.response) {
|
|
109
|
+
throw new EmptyUtilsResponseError();
|
|
110
|
+
}
|
|
111
|
+
return this.response;
|
|
112
|
+
}
|
|
113
|
+
get isEmpty() {
|
|
114
|
+
return !this.response;
|
|
115
|
+
}
|
|
116
|
+
get token() {
|
|
117
|
+
return this._token;
|
|
118
|
+
}
|
|
119
|
+
get hasResponse() {
|
|
120
|
+
return !!this.response;
|
|
121
|
+
}
|
|
122
|
+
constructor(secureApi) {
|
|
123
|
+
this.secureApi = secureApi;
|
|
124
|
+
this.isInitialized = false;
|
|
125
|
+
this._token = '';
|
|
126
|
+
this.sandboxMode = false;
|
|
127
|
+
}
|
|
128
|
+
async init(configuration) {
|
|
129
|
+
if (!configuration.token) {
|
|
130
|
+
return Promise.reject('token is missing');
|
|
131
|
+
}
|
|
132
|
+
this._token = configuration.token;
|
|
133
|
+
this.sandboxMode = !!configuration.sandbox;
|
|
134
|
+
await this.sendRequest(this.token);
|
|
135
|
+
this.isInitialized = true;
|
|
136
|
+
}
|
|
137
|
+
isSandboxMode() {
|
|
138
|
+
return this.sandboxMode;
|
|
139
|
+
}
|
|
140
|
+
async sendRequest(token) {
|
|
141
|
+
const params = new HttpParams().set('access_token', token);
|
|
142
|
+
this.secureApi.setSandboxMode(this.isSandboxMode());
|
|
143
|
+
this.response = await firstValueFrom(this.secureApi.get('utils', { params }));
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
SettingsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SettingsService, deps: [{ token: SecureApiClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
147
|
+
SettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SettingsService, providedIn: 'root' });
|
|
148
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SettingsService, decorators: [{
|
|
149
|
+
type: Injectable,
|
|
150
|
+
args: [{
|
|
151
|
+
providedIn: 'root',
|
|
152
|
+
}]
|
|
153
|
+
}], ctorParameters: function () { return [{ type: SecureApiClient }]; } });
|
|
154
|
+
|
|
155
|
+
class CountryService {
|
|
156
|
+
constructor(settingsService) {
|
|
157
|
+
this.settingsService = settingsService;
|
|
158
|
+
this.userDefinedCountry = null;
|
|
159
|
+
}
|
|
160
|
+
setCountry(country) {
|
|
161
|
+
this.userDefinedCountry = country;
|
|
162
|
+
}
|
|
163
|
+
getCountry() {
|
|
164
|
+
return this.userDefinedCountry ?? this.getTokenCountry();
|
|
165
|
+
}
|
|
166
|
+
getTokenCountry() {
|
|
167
|
+
return this.settingsService.user.country.value;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
CountryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CountryService, deps: [{ token: SettingsService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
171
|
+
CountryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CountryService, providedIn: 'root' });
|
|
172
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CountryService, decorators: [{
|
|
173
|
+
type: Injectable,
|
|
174
|
+
args: [{
|
|
175
|
+
providedIn: 'root',
|
|
176
|
+
}]
|
|
177
|
+
}], ctorParameters: function () { return [{ type: SettingsService }]; } });
|
|
178
|
+
|
|
179
|
+
class ResponseError extends AppError {
|
|
180
|
+
constructor(message) {
|
|
181
|
+
super('Response failed' + (message ? `: "${message}".` : '.'));
|
|
182
|
+
}
|
|
25
183
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
184
|
+
|
|
185
|
+
var BooleanNumber;
|
|
186
|
+
(function (BooleanNumber) {
|
|
187
|
+
BooleanNumber[BooleanNumber["false"] = 0] = "false";
|
|
188
|
+
BooleanNumber[BooleanNumber["true"] = 1] = "true";
|
|
189
|
+
})(BooleanNumber || (BooleanNumber = {}));
|
|
190
|
+
|
|
191
|
+
class PaymentMethodsResponse {
|
|
192
|
+
constructor(paymentMethods) {
|
|
193
|
+
this.especial = paymentMethods.especial.map((method) => this.mapPaymentMethod(method));
|
|
194
|
+
this.top = paymentMethods.top.map((method) => this.mapPaymentMethod(method));
|
|
195
|
+
this.remained = paymentMethods.remained.map((method) => this.mapPaymentMethod(method));
|
|
196
|
+
this.remainedCount = {
|
|
197
|
+
total: paymentMethods.remained_count.total,
|
|
198
|
+
visible: paymentMethods.remained_count.visible,
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
mapPaymentMethod(method) {
|
|
202
|
+
return {
|
|
203
|
+
id: method.id,
|
|
204
|
+
rank: method.rank,
|
|
205
|
+
name: method.name,
|
|
206
|
+
aliases: method.aliases,
|
|
207
|
+
categories: method.cat,
|
|
208
|
+
isVisible: method.is_visible,
|
|
209
|
+
recommended: method.recommended === BooleanNumber.true,
|
|
210
|
+
enabledSaveAccount: method.enabled_save_account,
|
|
211
|
+
iconName: method.switch_icon_name,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const paymentMethodsResponseFactoryToken = new InjectionToken('PaymentMethodsResponse');
|
|
217
|
+
const paymentMethodsResponseFactoryProvider = {
|
|
218
|
+
provide: paymentMethodsResponseFactoryToken,
|
|
219
|
+
useValue: (...args) => new PaymentMethodsResponse(...args),
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
class PaymentMethodsService {
|
|
223
|
+
constructor(responseFactory, settingsService, countryService, secureApi) {
|
|
224
|
+
this.responseFactory = responseFactory;
|
|
225
|
+
this.settingsService = settingsService;
|
|
226
|
+
this.countryService = countryService;
|
|
227
|
+
this.secureApi = secureApi;
|
|
228
|
+
this.apiRoute = 'remained_payment_methods';
|
|
229
|
+
this.cache = new Map();
|
|
230
|
+
}
|
|
231
|
+
async getList() {
|
|
232
|
+
const response = await this.request();
|
|
233
|
+
return response.remained;
|
|
234
|
+
}
|
|
235
|
+
async getQuickMethods() {
|
|
236
|
+
const response = await this.request();
|
|
237
|
+
return response.especial;
|
|
238
|
+
}
|
|
239
|
+
async request() {
|
|
240
|
+
const requestParams = {
|
|
241
|
+
access_token: this.settingsService.token,
|
|
242
|
+
country: this.countryService.getCountry(),
|
|
243
|
+
};
|
|
244
|
+
const cacheKey = JSON.stringify(requestParams);
|
|
245
|
+
if (!this.cache.has(cacheKey)) {
|
|
246
|
+
this.cache.set(cacheKey, lastValueFrom(this.secureApi
|
|
247
|
+
.post(this.apiRoute, new URLSearchParams({ ...requestParams }), {
|
|
248
|
+
headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'),
|
|
249
|
+
responseType: 'json',
|
|
250
|
+
})
|
|
251
|
+
.pipe(map((response) => this.responseFactory(response.payment_methods)))).catch((error) => {
|
|
252
|
+
throw new ResponseError(error.message);
|
|
253
|
+
}));
|
|
254
|
+
}
|
|
255
|
+
// @ts-expect-error the map already has the cache with key
|
|
256
|
+
return this.cache.get(cacheKey);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
PaymentMethodsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentMethodsService, deps: [{ token: paymentMethodsResponseFactoryToken }, { token: SettingsService }, { token: CountryService }, { token: SecureApiClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
260
|
+
PaymentMethodsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentMethodsService, providedIn: 'root' });
|
|
261
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentMethodsService, decorators: [{
|
|
262
|
+
type: Injectable,
|
|
263
|
+
args: [{
|
|
264
|
+
providedIn: 'root',
|
|
265
|
+
}]
|
|
266
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
267
|
+
type: Inject,
|
|
268
|
+
args: [paymentMethodsResponseFactoryToken]
|
|
269
|
+
}] }, { type: SettingsService }, { type: CountryService }, { type: SecureApiClient }]; } });
|
|
270
|
+
|
|
271
|
+
class CoreLibraryService {
|
|
272
|
+
constructor(settingsService, countryService, paymentMethodsService) {
|
|
273
|
+
this.settingsService = settingsService;
|
|
274
|
+
this.countryService = countryService;
|
|
275
|
+
this.paymentMethodsService = paymentMethodsService;
|
|
276
|
+
this.paymentMethods = {
|
|
277
|
+
getList: async () => this.paymentMethodsService.getList(),
|
|
278
|
+
getQuickMethods: async () => this.paymentMethodsService.getQuickMethods(),
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
async init(configuration) {
|
|
282
|
+
return this.settingsService.init(configuration);
|
|
283
|
+
}
|
|
284
|
+
setCountry(country) {
|
|
285
|
+
this.countryService.setCountry(country);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
CoreLibraryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, deps: [{ token: SettingsService }, { token: CountryService }, { token: PaymentMethodsService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
289
|
+
CoreLibraryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, providedIn: 'root' });
|
|
290
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, decorators: [{
|
|
291
|
+
type: Injectable,
|
|
292
|
+
args: [{
|
|
293
|
+
providedIn: 'root',
|
|
294
|
+
}]
|
|
295
|
+
}], ctorParameters: function () { return [{ type: SettingsService }, { type: CountryService }, { type: PaymentMethodsService }]; } });
|
|
296
|
+
|
|
297
|
+
class HttpError extends AppError {
|
|
298
|
+
constructor(error, req) {
|
|
299
|
+
super(error.message);
|
|
300
|
+
this.RESTRICTED_KEYS_REGEXP = new RegExp('.*(card_number|number|cvv|cvn|month|year|cardholdername|client_data|dfp|password).*', 'i');
|
|
301
|
+
this.httpErrorData = {
|
|
302
|
+
request: {
|
|
303
|
+
url: req.url,
|
|
304
|
+
method: req.method,
|
|
305
|
+
headers: req.headers,
|
|
306
|
+
},
|
|
307
|
+
response: {
|
|
308
|
+
status: error.status,
|
|
309
|
+
headers: error.headers,
|
|
310
|
+
},
|
|
311
|
+
};
|
|
312
|
+
if (req.body) {
|
|
313
|
+
this.httpErrorData.request.data = this.cleanPersonalData(req.body);
|
|
314
|
+
}
|
|
315
|
+
if (error.statusText) {
|
|
316
|
+
const errorData = error.error;
|
|
317
|
+
this.httpErrorData.response.data = {
|
|
318
|
+
statusText: error.statusText,
|
|
319
|
+
errors: errorData?.errors ?? [],
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
getHttpErrorData() {
|
|
324
|
+
return this.httpErrorData;
|
|
325
|
+
}
|
|
326
|
+
cleanPersonalData(data) {
|
|
327
|
+
return Object.entries(data).reduce((acc, [key, val]) => {
|
|
328
|
+
return {
|
|
329
|
+
...acc,
|
|
330
|
+
[key]: this.RESTRICTED_KEYS_REGEXP.test(key) ? '***' : val,
|
|
331
|
+
};
|
|
332
|
+
}, {});
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
class HttpExceptionsInterceptor {
|
|
337
|
+
constructor(router) {
|
|
338
|
+
this.router = router;
|
|
339
|
+
}
|
|
340
|
+
intercept(req, next) {
|
|
341
|
+
return next.handle(req).pipe(catchError((error) => {
|
|
342
|
+
return throwError(() => new HttpError(error, req));
|
|
343
|
+
}));
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
HttpExceptionsInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: HttpExceptionsInterceptor, deps: [{ token: i1$1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
347
|
+
HttpExceptionsInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: HttpExceptionsInterceptor });
|
|
348
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: HttpExceptionsInterceptor, decorators: [{
|
|
349
|
+
type: Injectable
|
|
350
|
+
}], ctorParameters: function () { return [{ type: i1$1.Router }]; } });
|
|
351
|
+
|
|
352
|
+
class CoreLibraryModule {
|
|
353
|
+
}
|
|
354
|
+
CoreLibraryModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
355
|
+
CoreLibraryModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryModule, imports: [HttpClientModule] });
|
|
356
|
+
CoreLibraryModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryModule, providers: [
|
|
357
|
+
{
|
|
358
|
+
provide: HTTP_INTERCEPTORS,
|
|
359
|
+
useClass: HttpExceptionsInterceptor,
|
|
360
|
+
multi: true,
|
|
361
|
+
},
|
|
362
|
+
{ provide: windowToken, useValue: window },
|
|
363
|
+
paymentMethodsResponseFactoryProvider,
|
|
364
|
+
], imports: [HttpClientModule] });
|
|
365
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryModule, decorators: [{
|
|
366
|
+
type: NgModule,
|
|
367
|
+
args: [{
|
|
368
|
+
imports: [HttpClientModule],
|
|
369
|
+
providers: [
|
|
370
|
+
{
|
|
371
|
+
provide: HTTP_INTERCEPTORS,
|
|
372
|
+
useClass: HttpExceptionsInterceptor,
|
|
373
|
+
multi: true,
|
|
374
|
+
},
|
|
375
|
+
{ provide: windowToken, useValue: window },
|
|
376
|
+
paymentMethodsResponseFactoryProvider,
|
|
377
|
+
],
|
|
378
|
+
}]
|
|
36
379
|
}] });
|
|
37
380
|
|
|
38
|
-
/*
|
|
39
|
-
* Public API Surface of core-library
|
|
381
|
+
/*
|
|
382
|
+
* Public API Surface of core-library
|
|
40
383
|
*/
|
|
41
384
|
|
|
42
|
-
/**
|
|
43
|
-
* Generated bundle index. Do not edit.
|
|
385
|
+
/**
|
|
386
|
+
* Generated bundle index. Do not edit.
|
|
44
387
|
*/
|
|
45
388
|
|
|
46
|
-
export {
|
|
389
|
+
export { CoreLibraryModule, CoreLibraryService };
|
|
47
390
|
//# sourceMappingURL=xsolla-payment-client-core.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xsolla-payment-client-core.mjs","sources":["../../../packages/payment-client-core/src/lib/core-library.service.ts","../../../packages/payment-client-core/src/lib/core-library.component.ts","../../../packages/payment-client-core/src/lib/core-library.module.ts","../../../packages/payment-client-core/src/public-api.ts","../../../packages/payment-client-core/src/xsolla-payment-client-core.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class CoreLibraryService {}\n","import { Component } from '@angular/core';\n\n@Component({\n selector: 'x-payment-client-core',\n template: ` <p>core-library works!</p> `,\n styles: [],\n})\nexport class CoreLibraryComponent {}\n","import { NgModule } from '@angular/core';\nimport { CoreLibraryComponent } from './core-library.component';\n\n@NgModule({\n declarations: [CoreLibraryComponent],\n imports: [],\n exports: [CoreLibraryComponent],\n})\nexport class CoreLibraryModule {}\n","/*\n * Public API Surface of core-library\n */\n\nexport * from './lib/core-library.service';\nexport * from './lib/core-library.component';\nexport * from './lib/core-library.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;MAKa,kBAAkB,CAAA;;+GAAlB,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAA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AAY,EAAE,CAAC,oBAAoB,CAAC;AACpC,oBAAA,OAAO,EAAE,EAAE;oBACX,OAAO,EAAE,CAAC,oBAAoB,CAAC;AAChC,iBAAA,CAAA;;;ACPD;;AAEG;;ACFH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"xsolla-payment-client-core.mjs","sources":["../../../packages/payment-client-core/src/lib/core/exceptions-handling/errors/app-error.class.ts","../../../packages/payment-client-core/src/lib/core/settings/empty-utils-response.error.ts","../../../packages/payment-client-core/src/lib/core/window.token.ts","../../../packages/payment-client-core/src/lib/core/http/secure-api/api-url.const.ts","../../../packages/payment-client-core/src/lib/core/http/secure-api/secure-api.service.ts","../../../packages/payment-client-core/src/lib/core/settings/settings.service.ts","../../../packages/payment-client-core/src/lib/core/country/country.service.ts","../../../packages/payment-client-core/src/lib/core/exceptions-handling/errors/response-error.class.ts","../../../packages/payment-client-core/src/lib/core/boolean-number.enum.ts","../../../packages/payment-client-core/src/lib/core/payment-methods/payment-methods-response.class.ts","../../../packages/payment-client-core/src/lib/core/payment-methods/payment-methods-response.token.ts","../../../packages/payment-client-core/src/lib/core/payment-methods/payment-methods.service.ts","../../../packages/payment-client-core/src/lib/core-library.service.ts","../../../packages/payment-client-core/src/lib/core/exceptions-handling/errors/http-error.class.ts","../../../packages/payment-client-core/src/lib/core/exceptions-handling/http-interceptor/http-exceptions.interceptor.ts","../../../packages/payment-client-core/src/lib/core-library.module.ts","../../../packages/payment-client-core/src/public-api.ts","../../../packages/payment-client-core/src/xsolla-payment-client-core.ts"],"sourcesContent":["export class AppError extends Error {\n public constructor(message: string) {\n super(message);\n }\n}\n","import { AppError } from '../exceptions-handling/errors/app-error.class';\n\nexport class EmptyUtilsResponseError extends AppError {\n public constructor() {\n super('Utils response is empty or not requested. Check your token.');\n }\n}\n","import { InjectionToken } from '@angular/core';\nimport { ExtendedWindow } from './extended-window.interface';\n\nexport const windowToken: InjectionToken<ExtendedWindow> = new InjectionToken(\n 'window'\n);\n","export const defaultApiUrl = 'https://secure.xsolla.com/paystation2/api/';\nexport const sandboxApiUrl =\n 'https://sandbox-secure.xsolla.com/paystation2/api/';\n","import { Observable } from 'rxjs';\nimport { Inject, Injectable } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { windowToken } from '../../window.token';\nimport { ExtendedWindow } from '../../extended-window.interface';\nimport { RequestOptions } from './options.interface';\nimport { defaultApiUrl, sandboxApiUrl } from './api-url.const';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SecureApiClient {\n private isSandboxMode = false;\n\n public constructor(\n private readonly httpClient: HttpClient,\n @Inject(windowToken)\n private readonly window: ExtendedWindow\n ) {}\n\n public setSandboxMode(isSandboxMode: boolean): void {\n this.isSandboxMode = isSandboxMode;\n }\n\n public get<T>(url: string, options?: RequestOptions): Observable<T> {\n return this.httpClient.get<T>(`${this.baseUrl}${url}`, options);\n }\n\n public post<T>(\n url: string,\n body: unknown | null,\n options?: RequestOptions\n ): Observable<T> {\n return this.httpClient.post<T>(`${this.baseUrl}${url}`, body, options);\n }\n\n public patch<T>(\n url: string,\n body: unknown | null,\n options?: RequestOptions\n ): Observable<T> {\n return this.httpClient.patch<T>(`${this.baseUrl}${url}`, body, options);\n }\n\n public put<T>(\n url: string,\n body: unknown | null,\n options?: RequestOptions\n ): Observable<T> {\n return this.httpClient.put<T>(`${this.baseUrl}${url}`, body, options);\n }\n\n public delete<T>(url: string, options?: RequestOptions): Observable<T> {\n return this.httpClient.delete<T>(`${this.baseUrl}${url}`, options);\n }\n\n public get baseUrl(): string {\n let predefinedBaseUrl: string | null = null;\n\n try {\n predefinedBaseUrl = this.window.localStorage.getItem('devApiUrl');\n } catch (e: unknown) {\n console.warn('localStorage is not available');\n }\n\n if (predefinedBaseUrl) {\n return predefinedBaseUrl;\n }\n\n return this.isSandboxMode ? sandboxApiUrl : defaultApiUrl;\n }\n}\n","import { firstValueFrom } from 'rxjs';\nimport { Injectable } from '@angular/core';\nimport { HttpParams } from '@angular/common/http';\nimport { SecureApiClient } from '../http/secure-api/secure-api.service';\nimport { DeepReadonly } from '../deep-readonly.type';\nimport { InitConfiguration } from './configuration.interface';\nimport { EmptyUtilsResponseError } from './empty-utils-response.error';\nimport { User } from './user.interface';\nimport { Settings } from './settings.interface';\nimport { Purchase } from './purchase.interface';\nimport { Project } from './project.interface';\nimport { UtilsResponse } from './utils-response.interface';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SettingsService {\n public get project(): DeepReadonly<Project> {\n if (!this.response) {\n throw new EmptyUtilsResponseError();\n }\n\n return this.response.project;\n }\n\n public get purchase(): DeepReadonly<Purchase> {\n if (!this.response) {\n throw new EmptyUtilsResponseError();\n }\n\n return this.response.purchase;\n }\n\n public get settings(): DeepReadonly<Settings> {\n if (!this.response) {\n throw new EmptyUtilsResponseError();\n }\n\n if (this.response?.purchase_external_id) {\n return {\n ...this.response.settings,\n purchase_external_id: this.response.purchase_external_id,\n };\n }\n\n return this.response?.settings;\n }\n\n public get user(): DeepReadonly<User> {\n if (!this.response) {\n throw new EmptyUtilsResponseError();\n }\n\n return this.response.user;\n }\n\n public get utilsResponse(): DeepReadonly<UtilsResponse> {\n if (!this.response) {\n throw new EmptyUtilsResponseError();\n }\n\n return this.response;\n }\n\n public get isEmpty(): boolean {\n return !this.response;\n }\n\n public get token(): string {\n return this._token;\n }\n\n public get hasResponse(): boolean {\n return !!this.response;\n }\n\n public isInitialized = false;\n\n private response!: DeepReadonly<UtilsResponse> | undefined;\n\n private _token = '';\n\n private sandboxMode = false;\n\n public constructor(private readonly secureApi: SecureApiClient) {}\n\n public async init(configuration: InitConfiguration): Promise<void> {\n if (!configuration.token) {\n return Promise.reject('token is missing');\n }\n\n this._token = configuration.token;\n this.sandboxMode = !!configuration.sandbox;\n\n await this.sendRequest(this.token);\n\n this.isInitialized = true;\n }\n\n public isSandboxMode(): boolean {\n return this.sandboxMode;\n }\n\n private async sendRequest(token: string): Promise<void> {\n const params = new HttpParams().set('access_token', token);\n\n this.secureApi.setSandboxMode(this.isSandboxMode());\n\n this.response = await firstValueFrom(\n this.secureApi.get<UtilsResponse>('utils', { params })\n );\n }\n}\n","import { Injectable } from '@angular/core';\nimport { SettingsService } from '../settings/settings.service';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class CountryService {\n private userDefinedCountry: string | null = null;\n\n public constructor(private readonly settingsService: SettingsService) {}\n\n public setCountry(country: string): void {\n this.userDefinedCountry = country;\n }\n\n public getCountry(): string {\n return this.userDefinedCountry ?? this.getTokenCountry();\n }\n\n private getTokenCountry(): string {\n return this.settingsService.user.country.value;\n }\n}\n","import { AppError } from './app-error.class';\n\nexport class ResponseError extends AppError {\n public constructor(message?: string) {\n super('Response failed' + (message ? `: \"${message}\".` : '.'));\n }\n}\n","export enum BooleanNumber {\n false = 0,\n true = 1,\n}\n","import { BooleanNumber } from '../boolean-number.enum';\nimport { PaymentMethodApi } from './payment-method-api.interface';\nimport { PaymentMethod } from './payment-method.interface';\nimport { PaymentMethodsApi } from './payment-methods-api.interface';\n\nexport class PaymentMethodsResponse {\n public readonly top: PaymentMethod[];\n public readonly especial: PaymentMethod[];\n public readonly remained: PaymentMethod[];\n public readonly remainedCount: { total: number; visible: number };\n\n public constructor(paymentMethods: PaymentMethodsApi) {\n this.especial = paymentMethods.especial.map((method) =>\n this.mapPaymentMethod(method)\n );\n this.top = paymentMethods.top.map((method) =>\n this.mapPaymentMethod(method)\n );\n this.remained = paymentMethods.remained.map((method) =>\n this.mapPaymentMethod(method)\n );\n this.remainedCount = {\n total: paymentMethods.remained_count.total,\n visible: paymentMethods.remained_count.visible,\n };\n }\n\n private mapPaymentMethod(method: PaymentMethodApi): PaymentMethod {\n return {\n id: method.id,\n rank: method.rank,\n name: method.name,\n aliases: method.aliases,\n categories: method.cat,\n isVisible: method.is_visible,\n recommended: method.recommended === BooleanNumber.true,\n enabledSaveAccount: method.enabled_save_account,\n iconName: method.switch_icon_name,\n };\n }\n}\n","import { InjectionToken, ValueProvider } from '@angular/core';\nimport { PaymentMethodsResponse } from './payment-methods-response.class';\n\ntype ResponseParameters = ConstructorParameters<typeof PaymentMethodsResponse>;\n\nexport type PaymentMethodsResponseFactory = (\n ...args: ResponseParameters\n) => PaymentMethodsResponse;\n\nexport const paymentMethodsResponseFactoryToken: InjectionToken<PaymentMethodsResponseFactory> =\n new InjectionToken<PaymentMethodsResponseFactory>('PaymentMethodsResponse');\n\nexport const paymentMethodsResponseFactoryProvider: ValueProvider = {\n provide: paymentMethodsResponseFactoryToken,\n useValue: (...args: ResponseParameters) =>\n new PaymentMethodsResponse(...args),\n};\n","import { HttpHeaders } from '@angular/common/http';\nimport { Inject, Injectable } from '@angular/core';\nimport { lastValueFrom, map } from 'rxjs';\nimport { CountryService } from '../country/country.service';\nimport { ResponseError } from '../exceptions-handling/errors/response-error.class';\nimport { SecureApiClient } from '../http/secure-api/secure-api.service';\nimport { SettingsService } from '../settings/settings.service';\nimport { PaymentMethod } from './payment-method.interface';\nimport { PaymentMethodsRequestParams } from './payment-methods-request-params.interface';\nimport { PaymentMethodsResponse } from './payment-methods-response.class';\nimport { PaymentMethodsResponseApi } from './payment-methods-response.interface';\nimport {\n PaymentMethodsResponseFactory,\n paymentMethodsResponseFactoryToken,\n} from './payment-methods-response.token';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class PaymentMethodsService {\n private readonly apiRoute = 'remained_payment_methods';\n\n private readonly cache = new Map<string, Promise<PaymentMethodsResponse>>();\n\n public constructor(\n @Inject(paymentMethodsResponseFactoryToken)\n private readonly responseFactory: PaymentMethodsResponseFactory,\n private readonly settingsService: SettingsService,\n private readonly countryService: CountryService,\n private readonly secureApi: SecureApiClient\n ) {}\n\n public async getList(): Promise<PaymentMethod[]> {\n const response = await this.request();\n return response.remained;\n }\n\n public async getQuickMethods(): Promise<PaymentMethod[]> {\n const response = await this.request();\n return response.especial;\n }\n\n private async request(): Promise<PaymentMethodsResponse> {\n const requestParams: PaymentMethodsRequestParams = {\n access_token: this.settingsService.token,\n country: this.countryService.getCountry(),\n };\n const cacheKey = JSON.stringify(requestParams);\n\n if (!this.cache.has(cacheKey)) {\n this.cache.set(\n cacheKey,\n lastValueFrom(\n this.secureApi\n .post<PaymentMethodsResponseApi>(\n this.apiRoute,\n new URLSearchParams({ ...requestParams }),\n {\n headers: new HttpHeaders().set(\n 'Content-Type',\n 'application/x-www-form-urlencoded; charset=utf-8'\n ),\n responseType: 'json',\n }\n )\n .pipe(\n map((response) => this.responseFactory(response.payment_methods))\n )\n ).catch((error: Error) => {\n throw new ResponseError(error.message);\n })\n );\n }\n\n // @ts-expect-error the map already has the cache with key\n return this.cache.get(cacheKey);\n }\n}\n","import { Injectable } from '@angular/core';\nimport { InitConfiguration } from './core/settings/configuration.interface';\nimport { SettingsService } from './core/settings/settings.service';\nimport { CountryService } from './core/country/country.service';\nimport { PaymentMethodsService } from './core/payment-methods/payment-methods.service';\nimport { PaymentMethod } from './core/payment-methods/payment-method.interface';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class CoreLibraryService {\n public paymentMethods = {\n getList: async (): Promise<PaymentMethod[]> =>\n this.paymentMethodsService.getList(),\n\n getQuickMethods: async (): Promise<PaymentMethod[]> =>\n this.paymentMethodsService.getQuickMethods(),\n };\n\n public constructor(\n private readonly settingsService: SettingsService,\n private readonly countryService: CountryService,\n private readonly paymentMethodsService: PaymentMethodsService\n ) {}\n\n public async init(configuration: InitConfiguration): Promise<void> {\n return this.settingsService.init(configuration);\n }\n\n public setCountry(country: string): void {\n this.countryService.setCountry(country);\n }\n}\n","import { HttpErrorResponse, HttpRequest } from '@angular/common/http';\nimport { AppError } from './app-error.class';\nimport { HttpErrorData } from '../http-interceptor/http-error-data.interface';\nimport { HttpErrorResponseData } from '../http-interceptor/http-error-response-data.interface';\n\nexport class HttpError extends AppError {\n private readonly RESTRICTED_KEYS_REGEXP = new RegExp(\n '.*(card_number|number|cvv|cvn|month|year|cardholdername|client_data|dfp|password).*',\n 'i'\n );\n private readonly httpErrorData!: HttpErrorData;\n\n public constructor(error: HttpErrorResponse, req: HttpRequest<unknown>) {\n super(error.message);\n\n this.httpErrorData = {\n request: {\n url: req.url,\n method: req.method,\n headers: req.headers,\n },\n response: {\n status: error.status,\n headers: error.headers,\n },\n };\n\n if (req.body) {\n this.httpErrorData.request.data = this.cleanPersonalData(\n req.body as { [key: string]: unknown }\n );\n }\n\n if (error.statusText) {\n const errorData = error.error as HttpErrorResponseData;\n\n this.httpErrorData.response.data = {\n statusText: error.statusText,\n errors: errorData?.errors ?? [],\n };\n }\n }\n\n public getHttpErrorData(): HttpErrorData {\n return this.httpErrorData;\n }\n\n private cleanPersonalData(data: { [key: string]: unknown }): {\n [key: string]: unknown;\n } {\n return Object.entries(data).reduce((acc, [key, val]) => {\n return {\n ...acc,\n [key]: this.RESTRICTED_KEYS_REGEXP.test(key) ? '***' : val,\n };\n }, {});\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n HttpErrorResponse,\n HttpEvent,\n HttpHandler,\n HttpInterceptor,\n HttpRequest,\n} from '@angular/common/http';\n\nimport { catchError } from 'rxjs/operators';\nimport { Router } from '@angular/router';\nimport { Observable, throwError } from 'rxjs';\nimport { HttpError } from '../errors/http-error.class';\n@Injectable()\nexport class HttpExceptionsInterceptor implements HttpInterceptor {\n public constructor(public router: Router) {}\n\n public intercept(\n req: HttpRequest<unknown>,\n next: HttpHandler\n ): Observable<HttpEvent<unknown>> {\n return next.handle(req).pipe(\n catchError((error: HttpErrorResponse) => {\n return throwError(() => new HttpError(error, req));\n })\n );\n }\n}\n","import { NgModule } from '@angular/core';\nimport { HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http';\nimport { HttpExceptionsInterceptor } from './core/exceptions-handling/http-interceptor/http-exceptions.interceptor';\nimport { windowToken } from './core/window.token';\nimport { paymentMethodsResponseFactoryProvider } from './core/payment-methods/payment-methods-response.token';\n\n@NgModule({\n imports: [HttpClientModule],\n providers: [\n {\n provide: HTTP_INTERCEPTORS,\n useClass: HttpExceptionsInterceptor,\n multi: true,\n },\n { provide: windowToken, useValue: window },\n paymentMethodsResponseFactoryProvider,\n ],\n})\nexport class CoreLibraryModule {}\n","/*\n * Public API Surface of core-library\n */\n\nexport * from './lib/core-library.service';\nexport * from './lib/core-library.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.SecureApiClient","i1.SettingsService","i2.CountryService","i3.SecureApiClient","i3.PaymentMethodsService","i1"],"mappings":";;;;;;;;AAAM,MAAO,QAAS,SAAQ,KAAK,CAAA;AACjC,IAAA,WAAA,CAAmB,OAAe,EAAA;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;KAChB;AACF;;ACFK,MAAO,uBAAwB,SAAQ,QAAQ,CAAA;AACnD,IAAA,WAAA,GAAA;QACE,KAAK,CAAC,6DAA6D,CAAC,CAAC;KACtE;AACF;;ACHM,MAAM,WAAW,GAAmC,IAAI,cAAc,CAC3E,QAAQ,CACT;;ACLM,MAAM,aAAa,GAAG,4CAA4C,CAAC;AACnE,MAAM,aAAa,GACxB,oDAAoD;;MCSzC,eAAe,CAAA;IAG1B,WACmB,CAAA,UAAsB,EAEtB,MAAsB,EAAA;QAFtB,IAAU,CAAA,UAAA,GAAV,UAAU,CAAY;QAEtB,IAAM,CAAA,MAAA,GAAN,MAAM,CAAgB;QALjC,IAAa,CAAA,aAAA,GAAG,KAAK,CAAC;KAM1B;AAEG,IAAA,cAAc,CAAC,aAAsB,EAAA;AAC1C,QAAA,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;KACpC;IAEM,GAAG,CAAI,GAAW,EAAE,OAAwB,EAAA;AACjD,QAAA,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAI,CAAG,EAAA,IAAI,CAAC,OAAO,GAAG,GAAG,CAAA,CAAE,EAAE,OAAO,CAAC,CAAC;KACjE;AAEM,IAAA,IAAI,CACT,GAAW,EACX,IAAoB,EACpB,OAAwB,EAAA;AAExB,QAAA,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAA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KAAA,EAAA,OAAA,EAAA,CATS,gBAAgB,CAAA,EAAA,CAAA,CAAA;2FAWf,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAZ7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,gBAAgB,CAAC;AAC3B,oBAAA,SAAS,EAAE;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,QAAQ,EAAE,yBAAyB;AACnC,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;AACD,wBAAA,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE;wBAC1C,qCAAqC;AACtC,qBAAA;AACF,iBAAA,CAAA;;;ACjBD;;AAEG;;ACFH;;AAEG;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated bundle index. Do not edit.
|
|
3
|
-
*/
|
|
4
|
-
/// <amd-module name="@xsolla/payment-client-core" />
|
|
5
|
-
export * from './public-api';
|
|
1
|
+
/**
|
|
2
|
+
* Generated bundle index. Do not edit.
|
|
3
|
+
*/
|
|
4
|
+
/// <amd-module name="@xsolla/payment-client-core" />
|
|
5
|
+
export * from './public-api';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SettingsService } from '../settings/settings.service';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class CountryService {
|
|
4
|
+
private readonly settingsService;
|
|
5
|
+
private userDefinedCountry;
|
|
6
|
+
constructor(settingsService: SettingsService);
|
|
7
|
+
setCountry(country: string): void;
|
|
8
|
+
getCountry(): string;
|
|
9
|
+
private getTokenCountry;
|
|
10
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CountryService, never>;
|
|
11
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<CountryService>;
|
|
12
|
+
}
|