@xsolla/payment-client-core 0.0.10 → 0.0.12

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 (65) hide show
  1. package/esm2020/lib/core/payment/actions/action-factory-value.interface.mjs +1 -1
  2. package/esm2020/lib/core/payment/actions/check-status/check-status.action.token.mjs +5 -2
  3. package/esm2020/lib/core/payment/actions/next-action.interface.mjs +1 -1
  4. package/esm2020/lib/core/payment/actions/next-action.service.mjs +11 -10
  5. package/esm2020/lib/core/payment/actions/next-actions.mjs +3 -1
  6. package/esm2020/lib/core/payment/actions/redirect/redirect.action.class.mjs +20 -0
  7. package/esm2020/lib/core/payment/actions/redirect/redirect.action.token.mjs +16 -0
  8. package/esm2020/lib/core/payment/actions/redirect/redirect.action.type.mjs +2 -0
  9. package/esm2020/lib/core/payment/actions/show-fields/show-fields.action.class.mjs +2 -2
  10. package/esm2020/lib/core/payment/actions/show-fields/show-fields.action.token.mjs +5 -2
  11. package/esm2020/lib/core/payment/actions/status-updated/status-updated.action.token.mjs +2 -2
  12. package/esm2020/lib/core/payment/finance-details/cart-item.interface.mjs +1 -1
  13. package/esm2020/lib/core/payment/finance-details/cart-line.interface.mjs +1 -1
  14. package/esm2020/lib/core/payment/finance-details/{cart-pricing.interface.mjs → cart-summary.interface.mjs} +1 -1
  15. package/esm2020/lib/core/payment/finance-details/finance-details.class.mjs +35 -12
  16. package/esm2020/lib/core/payment/form/converters/converter.abstract.mjs +5 -7
  17. package/esm2020/lib/core/payment/form/converters/zip.converter.mjs +9 -5
  18. package/esm2020/lib/core/payment/form/mask-config.interface.mjs +2 -0
  19. package/esm2020/lib/core/payment/form/masks-functions.map.mjs +7 -0
  20. package/esm2020/lib/core/payment/form/validators/convert.function.mjs +3 -2
  21. package/esm2020/lib/core/payment/form/validators/email-validator.mjs +3 -2
  22. package/esm2020/lib/core/payment/form/validators/errors-codes.enum.mjs +8 -0
  23. package/esm2020/lib/core/payment/form/validators/required-validator.mjs +3 -2
  24. package/esm2020/lib/core/payment/form/validators/validation-error.interface.mjs +1 -1
  25. package/esm2020/lib/core/payment/payment.interface.mjs +1 -1
  26. package/esm2020/lib/core/payment/payment.service.mjs +23 -4
  27. package/esm2020/lib/core/payment/submit/response/is-submit-response.function.mjs +5 -0
  28. package/esm2020/lib/core/payment/sync/field-sync-state.interface.mjs +1 -1
  29. package/esm2020/lib/core/payment/sync/sync.service.mjs +14 -2
  30. package/esm2020/lib/core/payment/xps-purchase.interface.mjs +1 -1
  31. package/esm2020/lib/core-library.service.mjs +7 -2
  32. package/fesm2015/xsolla-payment-client-core.mjs +266 -152
  33. package/fesm2015/xsolla-payment-client-core.mjs.map +1 -1
  34. package/fesm2020/xsolla-payment-client-core.mjs +257 -147
  35. package/fesm2020/xsolla-payment-client-core.mjs.map +1 -1
  36. package/lib/core/payment/actions/action-factory-value.interface.d.ts +2 -1
  37. package/lib/core/payment/actions/next-action.interface.d.ts +2 -1
  38. package/lib/core/payment/actions/next-action.service.d.ts +2 -2
  39. package/lib/core/payment/actions/redirect/redirect.action.class.d.ts +9 -0
  40. package/lib/core/payment/actions/redirect/redirect.action.token.d.ts +4 -0
  41. package/lib/core/payment/actions/redirect/redirect.action.type.d.ts +17 -0
  42. package/lib/core/payment/finance-details/cart-item.interface.d.ts +1 -0
  43. package/lib/core/payment/finance-details/cart-line.interface.d.ts +1 -0
  44. package/lib/core/payment/finance-details/finance-details.class.d.ts +8 -4
  45. package/lib/core/payment/form/converters/converter.abstract.d.ts +1 -2
  46. package/lib/core/payment/form/mask-config.interface.d.ts +6 -0
  47. package/lib/core/payment/form/masks-functions.map.d.ts +3 -0
  48. package/lib/core/payment/form/validators/convert.function.d.ts +1 -1
  49. package/lib/core/payment/form/validators/errors-codes.enum.d.ts +6 -0
  50. package/lib/core/payment/form/validators/validation-error.interface.d.ts +1 -0
  51. package/lib/core/payment/payment.interface.d.ts +1 -2
  52. package/lib/core/payment/payment.service.d.ts +4 -5
  53. package/lib/core/payment/submit/response/is-submit-response.function.d.ts +2 -0
  54. package/lib/core/payment/sync/field-sync-state.interface.d.ts +2 -2
  55. package/lib/core/payment/sync/sync.service.d.ts +1 -0
  56. package/lib/core/payment/xps-purchase.interface.d.ts +0 -2
  57. package/lib/core-library.service.d.ts +2 -0
  58. package/package.json +1 -1
  59. package/xsolla-payment-client-core-0.0.12.tgz +0 -0
  60. package/esm2020/lib/core/payment/actions/action-type-command.map.mjs +0 -6
  61. package/esm2020/lib/core/payment/xps-subscription-item.interface.mjs +0 -2
  62. package/lib/core/payment/actions/action-type-command.map.d.ts +0 -4
  63. package/lib/core/payment/xps-subscription-item.interface.d.ts +0 -20
  64. package/xsolla-payment-client-core-0.0.10.tgz +0 -0
  65. /package/lib/core/payment/finance-details/{cart-pricing.interface.d.ts → cart-summary.interface.d.ts} +0 -0
@@ -1,5 +1,6 @@
1
1
  import { Action } from './action.interface';
2
+ import { SubmitResponse } from '../submit/response/submit-response.class';
2
3
  export interface ActionFactoryValue {
3
4
  factory(...args: unknown[]): Action;
4
- type: string;
5
+ isSuitable(submitResponse: SubmitResponse): boolean;
5
6
  }
@@ -1,4 +1,5 @@
1
1
  import { CheckStatusAction } from './check-status/check-status.action.type';
2
2
  import { ShowFieldsAction } from './show-fields/show-fields.action.type';
3
3
  import { StatusUpdatedAction } from './status-updated/status-updated.action.type';
4
- export type NextAction = CheckStatusAction | ShowFieldsAction | StatusUpdatedAction;
4
+ import { RedirectAction } from './redirect/redirect.action.type';
5
+ export type NextAction = CheckStatusAction | ShowFieldsAction | StatusUpdatedAction | RedirectAction;
@@ -8,12 +8,12 @@ export declare class NextActionService {
8
8
  private readonly nextActionTokens;
9
9
  private readonly injector;
10
10
  private readonly flowUpdatesSubject;
11
- private readonly nextActionsMap;
11
+ private readonly nextActionsList;
12
12
  get flowUpdates$(): Observable<NextAction>;
13
13
  constructor(nextActionTokens: NextActionTokens, injector: Injector);
14
14
  getNextAction(submitResponse: SubmitResponse): NextAction | null;
15
15
  emitFlowUpdates(action: NextAction): void;
16
- private fillNextActionsMap;
16
+ private fillNextActionsList;
17
17
  private findNextAction;
18
18
  static ɵfac: i0.ɵɵFactoryDeclaration<NextActionService, never>;
19
19
  static ɵprov: i0.ɵɵInjectableDeclaration<NextActionService>;
@@ -0,0 +1,9 @@
1
+ import { SubmitResponse } from '../../submit/response/submit-response.class';
2
+ import { Action } from '../action.interface';
3
+ import { RedirectActionData, RedirectActionType } from './redirect.action.type';
4
+ export declare class RedirectAction implements Action {
5
+ type: RedirectActionType;
6
+ data: RedirectActionData;
7
+ constructor(submitResponse: SubmitResponse);
8
+ private getRedirect;
9
+ }
@@ -0,0 +1,4 @@
1
+ import { InjectionToken, ValueProvider } from '@angular/core';
2
+ import { ActionFactoryValue } from '../action-factory-value.interface';
3
+ export declare const redirectActionFactoryToken: InjectionToken<ActionFactoryValue>;
4
+ export declare const redirectActionFactoryProvider: ValueProvider;
@@ -0,0 +1,17 @@
1
+ import { Action } from '../action.interface';
2
+ import { Field } from '../../field.interface';
3
+ import { XpsError } from '../../xps-error.interface';
4
+ import { XpsMessage } from '../../xps-message.interface';
5
+ export type RedirectActionType = 'redirect';
6
+ export interface RedirectActionData {
7
+ fields: Field[];
8
+ errors: XpsError[] | null;
9
+ messages: XpsMessage[] | undefined;
10
+ invoiceId?: string;
11
+ order?: object;
12
+ redirect: {
13
+ redirectUrl: string;
14
+ data: object;
15
+ };
16
+ }
17
+ export type RedirectAction = Action<RedirectActionType, RedirectActionData>;
@@ -1,6 +1,7 @@
1
1
  import { CartLine } from './cart-line.interface';
2
2
  import { Price } from './price.interface';
3
3
  export interface CartItem {
4
+ key?: string;
4
5
  imgSrc?: string;
5
6
  hasDefaultImg?: boolean;
6
7
  title: string;
@@ -4,5 +4,6 @@ export interface CartLine {
4
4
  title?: string;
5
5
  content?: string;
6
6
  money?: Price;
7
+ rate?: number;
7
8
  isDateLine?: boolean;
8
9
  }
@@ -1,23 +1,27 @@
1
1
  import { XpsFinance } from '../xps-finance.interface';
2
2
  import { XpsPurchase } from '../xps-purchase.interface';
3
3
  import { CartItem } from './cart-item.interface';
4
- import { CartSummary } from './cart-pricing.interface';
4
+ import { CartSummary } from './cart-summary.interface';
5
5
  export declare class FinanceDetails {
6
6
  readonly purchase: XpsPurchase;
7
7
  readonly finance: XpsFinance;
8
+ readonly cartItems: CartItem[];
9
+ readonly cartSummary: CartSummary;
10
+ readonly paymentCountry: string;
8
11
  private get shouldShowZeroIndirectTaxRate();
9
12
  private get isSalesTaxes();
10
13
  constructor(parameters: {
11
14
  purchase: XpsPurchase;
12
15
  finance: XpsFinance;
13
16
  });
14
- getFormattedPurchaseForCart(): CartItem[];
15
- getFormattedPricingForCart(): CartSummary;
16
- getPaymentCountry(): string;
17
+ private getFormattedPurchaseForCart;
18
+ private getFormattedPricingForCart;
19
+ private getPaymentCountry;
17
20
  private getTaxForItem;
18
21
  private getTaxesForSubtotalDetails;
19
22
  private getVatLabelForSubtotalDetails;
20
23
  private getTaxesForTotalDetails;
24
+ private getVatKeyForDetails;
21
25
  private getVatLabelForTotalDetails;
22
26
  private isIndia;
23
27
  private isGhana;
@@ -1,4 +1,4 @@
1
- import { AsyncValidatorFn, UntypedFormControl, ValidatorFn } from '@angular/forms';
1
+ import { UntypedFormControl, ValidatorFn } from '@angular/forms';
2
2
  import { Field } from '../../field.interface';
3
3
  import { SyncService } from '../../sync/sync.service';
4
4
  import { ControlConfig } from '../controls/control-config';
@@ -9,7 +9,6 @@ export declare abstract class Converter {
9
9
  convertToConfig(field: Field, formState?: FormState): ControlConfig;
10
10
  convertToFormControl(field: Field): UntypedFormControl;
11
11
  getValidators(field: Field): ValidatorFn[];
12
- getAsyncValidators(field: Field): AsyncValidatorFn | AsyncValidatorFn[] | null;
13
12
  createDefaultControlConfig<T extends {
14
13
  [key: string]: unknown;
15
14
  }>(controlConfigClass: new () => T, field: Field): T;
@@ -0,0 +1,6 @@
1
+ export interface MaskConfig {
2
+ guide: boolean;
3
+ unmaskModelValue: boolean;
4
+ showMask: boolean;
5
+ mask?(): string;
6
+ }
@@ -0,0 +1,3 @@
1
+ export declare const masksFunctionsMap: {
2
+ [fieldNameOrType: string]: () => string;
3
+ };
@@ -1,3 +1,3 @@
1
1
  import { ValidatorFn } from '@angular/forms';
2
2
  import { ValidatorFn as ConvertedValidatorFn } from './validator-fn.type';
3
- export declare function convert(validator: ValidatorFn, message: string): ConvertedValidatorFn;
3
+ export declare function convert(validator: ValidatorFn, message: string, errorCode: string): ConvertedValidatorFn;
@@ -0,0 +1,6 @@
1
+ export declare enum ErrorsCodes {
2
+ minLength = "min-length",
3
+ maxLength = "max-length",
4
+ invalidValue = "invalid-value",
5
+ required = "required"
6
+ }
@@ -1,4 +1,5 @@
1
1
  export interface ValidationError {
2
2
  message?: string;
3
+ code?: string;
3
4
  [parameter: string]: unknown;
4
5
  }
@@ -2,7 +2,6 @@ import { ValidationErrors } from '@angular/forms';
2
2
  import { Observable } from 'rxjs';
3
3
  import { NextAction } from './actions/next-action.interface';
4
4
  import { Status } from './status/status.interface';
5
- import { StatusParams } from './status/status-params.interface';
6
5
  import { Field } from './field.interface';
7
6
  import { ControlConfig } from './form/controls/control-config';
8
7
  import { FinanceDetails } from './finance-details/finance-details.class';
@@ -13,7 +12,7 @@ export interface Payment {
13
12
  validate(field: Field): Promise<ValidationErrors | null>;
14
13
  getFinanceDetails(): FinanceDetails | null;
15
14
  runThreeDs(): NextAction;
16
- getStatus(params: StatusParams): Promise<Status>;
15
+ getStatus(): Promise<Status>;
17
16
  form: {
18
17
  changeFieldValue(name: string, value: string): void;
19
18
  getControlConfig(field: Field): ControlConfig | null;
@@ -1,19 +1,18 @@
1
1
  import { UntypedFormGroup, ValidationErrors } from '@angular/forms';
2
- import { NextAction } from './actions/next-action.interface';
3
- import { Field } from './field.interface';
4
2
  import { FormService } from './form/form.service';
5
3
  import { InitializeService } from './initialize/initialize.service';
6
- import { PaymentConfig } from './payment-config.interface';
7
4
  import { Status } from './status/status.interface';
8
5
  import { SubmitService } from './submit/submit.service';
9
6
  import { SyncService } from './sync/sync.service';
10
7
  import { StatusService } from './status/status.service';
11
- import { StatusParams } from './status/status-params.interface';
12
8
  import { NextActionService } from './actions/next-action.service';
13
9
  import { ControlConfig } from './form/controls/control-config';
14
10
  import { ControlConfigService } from './form/controls/control-config.service';
15
11
  import { FinanceDetails } from './finance-details/finance-details.class';
16
12
  import { FinanceDetailsService } from './finance-details/finance-details.service';
13
+ import { NextAction } from './actions/next-action.interface';
14
+ import { Field } from './field.interface';
15
+ import { PaymentConfig } from './payment-config.interface';
17
16
  import * as i0 from "@angular/core";
18
17
  export declare class PaymentService {
19
18
  private readonly initializeService;
@@ -37,7 +36,7 @@ export declare class PaymentService {
37
36
  validate(field: Field): Promise<ValidationErrors | null>;
38
37
  runThreeDs(): NextAction;
39
38
  getFinanceDetails(): FinanceDetails | null;
40
- getStatus(params: StatusParams): Promise<Status>;
39
+ getStatus(): Promise<Status>;
41
40
  getFieldConfig(field: Field): ControlConfig | null;
42
41
  changeFieldValue(name: string, value: string): void;
43
42
  destroy(): void;
@@ -0,0 +1,2 @@
1
+ import { SubmitResponse } from './submit-response.class';
2
+ export declare const isSubmitResponse: (value: unknown) => value is SubmitResponse;
@@ -1,5 +1,5 @@
1
- import { ValidationErrors } from '@angular/forms';
1
+ import { SyncResponse } from './sync-response.class';
2
2
  export interface FieldSyncState {
3
3
  value: unknown;
4
- result: Promise<ValidationErrors | null>;
4
+ result: Promise<SyncResponse | null>;
5
5
  }
@@ -21,6 +21,7 @@ export declare class SyncService extends EmitDataService<XpsResponse> {
21
21
  setup(form: UntypedFormGroup, fields: Field[]): void;
22
22
  reset(): void;
23
23
  validate(field: Field): Promise<ValidationErrors | null>;
24
+ getSyncValidationErrors(field: Field): ValidationErrors | null;
24
25
  protected request(field: Field): Promise<SyncResponse>;
25
26
  private isReadyField;
26
27
  private getPrevFieldSyncState;
@@ -1,11 +1,9 @@
1
1
  import { CheckoutItem } from './checkout-item.interface';
2
2
  import { VirtualCurrency } from './virtual-currency.interface';
3
- import { XpsSubscriptionItem } from './xps-subscription-item.interface';
4
3
  export interface XpsPurchase {
5
4
  virtual_currency?: VirtualCurrency[];
6
5
  checkout_items?: CheckoutItem[];
7
6
  virtual_items?: VirtualCurrency[];
8
- subscriptions?: XpsSubscriptionItem[];
9
7
  checkout?: {
10
8
  amount: number;
11
9
  currency: string;
@@ -10,6 +10,7 @@ import { UserBalanceService } from './core/user-balance/user-balance.service';
10
10
  import { PaymentConfig } from './core/payment/payment-config.interface';
11
11
  import { PaymentService } from './core/payment/payment.service';
12
12
  import { Payment } from './core/payment/payment.interface';
13
+ import { Field } from './core/payment/field.interface';
13
14
  import { DeviceFingerPrintService } from './core/device-finger-print/device-finger-print.service';
14
15
  import { LegalService } from './core/legal/legal.service';
15
16
  import { LegalComponentConfig } from './core/legal/legal.component.config';
@@ -38,6 +39,7 @@ export declare class CoreLibraryService {
38
39
  setCountry(country: string): void;
39
40
  createPayment(config: PaymentConfig): Payment;
40
41
  getLegalComponentConfig(): LegalComponentConfig;
42
+ getFieldMask(field: Field): undefined | (() => string);
41
43
  static ɵfac: i0.ɵɵFactoryDeclaration<CoreLibraryService, never>;
42
44
  static ɵprov: i0.ɵɵInjectableDeclaration<CoreLibraryService>;
43
45
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xsolla/payment-client-core",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^15.2.0",
6
6
  "@angular/core": "^15.2.0",
@@ -1,6 +0,0 @@
1
- import { XpsCommand } from '../xps-comand.enum';
2
- export const actionTypeCommandMap = {
3
- [XpsCommand.check]: 'show_fields',
4
- [XpsCommand.status]: 'check_status',
5
- };
6
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWN0aW9uLXR5cGUtY29tbWFuZC5tYXAuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8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GVyZmFjZSBYcHNTdWJzY3JpcHRpb25JdGVtIHtcbiAgYW1vdW50OiBudW1iZXI7XG4gIGlzX3RyaWFsOiBib29sZWFuO1xuICB0cmlhbF9wZXJpb2Q6IG51bWJlcjtcbiAgcGVyaW9kOiBudW1iZXI7XG4gIGN1cnJlbmN5OiBzdHJpbmc7XG4gIGRlc2NyaXB0aW9uOiBzdHJpbmc7XG4gIHBhY2thZ2VfaW5mbzogc3RyaW5nO1xuICBwZXJpb2RfdHlwZTogc3RyaW5nO1xuICBleHBpcmF0aW9uX3BlcmlvZF90eXBlOiBzdHJpbmc7XG4gIHJlY3VycmVudF90eXBlOiBzdHJpbmc7XG4gIGRhdGVfbmV4dF9jaGFyZ2U6IHN0cmluZztcbiAgYW1vdW50X25leHRfY2hhcmdlOiBzdHJpbmc7XG4gIHNldHVwX2ZlZTogbnVtYmVyO1xuICBjdXJyZW5jeV9uZXh0X2NoYXJnZTogc3RyaW5nO1xuICBwcm9tb3Rpb25fZGV0YWlsczogdW5rbm93bjtcbiAgaXNfYWxsb3dfdXNlcl9zZWxlY3RfcmVjdXJyZW50X3R5cGU6IHN0cmluZztcbiAgZGF0ZV9zdGFydDogc3RyaW5nO1xuICBkYXRlX2VuZDogc3RyaW5nO1xufVxuIl19
@@ -1,4 +0,0 @@
1
- import { XpsCommand } from '../xps-comand.enum';
2
- export declare const actionTypeCommandMap: {
3
- [key in XpsCommand]?: string;
4
- };
@@ -1,20 +0,0 @@
1
- export interface XpsSubscriptionItem {
2
- amount: number;
3
- is_trial: boolean;
4
- trial_period: number;
5
- period: number;
6
- currency: string;
7
- description: string;
8
- package_info: string;
9
- period_type: string;
10
- expiration_period_type: string;
11
- recurrent_type: string;
12
- date_next_charge: string;
13
- amount_next_charge: string;
14
- setup_fee: number;
15
- currency_next_charge: string;
16
- promotion_details: unknown;
17
- is_allow_user_select_recurrent_type: string;
18
- date_start: string;
19
- date_end: string;
20
- }