@xsolla/payment-client-core 0.2.52 → 0.2.54

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 (197) hide show
  1. package/esm2022/lib/core/encrypt-credit-card/encrypt-credit-card.service.mjs +1 -1
  2. package/esm2022/lib/core/payment/actions/action.interface.mjs +1 -1
  3. package/esm2022/lib/core/payment/actions/check-status/check-status.action.class.mjs +1 -1
  4. package/esm2022/lib/core/payment/actions/next-action.service.mjs +1 -1
  5. package/esm2022/lib/core/payment/actions/redirect/redirect.action.class.mjs +1 -1
  6. package/esm2022/lib/core/payment/actions/show-cash-payment-instruction/show-cash-payment-instruction.action.class.mjs +1 -1
  7. package/esm2022/lib/core/payment/actions/show-errors/show-errors.action.class.mjs +1 -1
  8. package/esm2022/lib/core/payment/actions/show-fields/show-fields.action.class.mjs +1 -1
  9. package/esm2022/lib/core/payment/actions/show-mobile-payment-screen/show-mobile-payment-screen.action.class.mjs +1 -1
  10. package/esm2022/lib/core/payment/actions/show-qr-code/show-qr-code.action.class.mjs +1 -1
  11. package/esm2022/lib/core/payment/actions/show-xsolla-number/show-xsolla-number.action.class.mjs +1 -1
  12. package/esm2022/lib/core/payment/actions/special-button/special-button.action.class.mjs +1 -1
  13. package/esm2022/lib/core/payment/form/converters/birth-date/birth-date.converter.mjs +2 -2
  14. package/esm2022/lib/core/payment/form/converters/card-expiration/card-expiration.converter.mjs +2 -2
  15. package/esm2022/lib/core/payment/form/converters/card-month/card-month.converter.mjs +2 -2
  16. package/esm2022/lib/core/payment/form/converters/card-number/card-number.converter.mjs +2 -2
  17. package/esm2022/lib/core/payment/form/converters/card-year/card-year.converter.mjs +2 -2
  18. package/esm2022/lib/core/payment/form/converters/cardholder-name/cardholder-name.converter.mjs +2 -2
  19. package/esm2022/lib/core/payment/form/converters/checkbox/checkbox.converter.mjs +2 -2
  20. package/esm2022/lib/core/payment/form/converters/converter.abstract.mjs +1 -1
  21. package/esm2022/lib/core/payment/form/converters/converters-map.mjs +2 -2
  22. package/esm2022/lib/core/payment/form/converters/coupon/coupon.converter.mjs +2 -2
  23. package/esm2022/lib/core/payment/form/converters/cpf-name/cpf-name.converter.mjs +2 -2
  24. package/esm2022/lib/core/payment/form/converters/cpf-number/cpf-number.converter.mjs +2 -2
  25. package/esm2022/lib/core/payment/form/converters/cvv/cvv.converter.mjs +2 -2
  26. package/esm2022/lib/core/payment/form/converters/email/email.converter.mjs +2 -2
  27. package/esm2022/lib/core/payment/form/converters/phone/phone.converter.mjs +39 -0
  28. package/esm2022/lib/core/payment/form/converters/pin/pin.converter.mjs +2 -2
  29. package/esm2022/lib/core/payment/form/converters/pricepoint/pricepoint.converter.mjs +2 -2
  30. package/esm2022/lib/core/payment/form/converters/radio-group/radio-group.converter.mjs +2 -2
  31. package/esm2022/lib/core/payment/form/converters/select/select.converter.mjs +2 -2
  32. package/esm2022/lib/core/payment/form/converters/street-number/street-number.converter.mjs +2 -2
  33. package/esm2022/lib/core/payment/form/converters/text/text.converter.mjs +2 -2
  34. package/esm2022/lib/core/payment/form/converters/zip/zip.converter.mjs +2 -2
  35. package/esm2022/lib/core/payment/form/form.module.mjs +2 -2
  36. package/esm2022/lib/core/payment/form-response.interface.mjs +1 -1
  37. package/esm2022/lib/core/payment/initialize-actions/action.interface.mjs +1 -1
  38. package/esm2022/lib/core/payment/initialize-actions/initialize-next-action.service.mjs +1 -1
  39. package/esm2022/lib/core/payment/initialize-actions/special-button/special-button.action.class.mjs +1 -1
  40. package/esm2022/lib/core/payment/payment-behaviour/behaviour-strategies.mjs +7 -0
  41. package/esm2022/lib/core/payment/payment-behaviour/payment-behaviour.module.mjs +33 -0
  42. package/esm2022/lib/core/payment/payment-behaviour/payment-behaviour.service.mjs +29 -0
  43. package/esm2022/lib/core/payment/payment-behaviour/strategies/apple-pay-with-shipping-address/apple-pay-with-shipping-address.strategy.mjs +38 -0
  44. package/esm2022/lib/core/payment/payment-behaviour/strategies/behaviour-strategy.abstract.mjs +20 -0
  45. package/esm2022/lib/core/payment/payment.service.mjs +26 -10
  46. package/esm2022/lib/core/payment/requests/initialize/initialize-request-params.interface.mjs +2 -0
  47. package/esm2022/lib/core/payment/requests/initialize/initialize.service.mjs +89 -0
  48. package/esm2022/lib/core/payment/requests/initialize/is-initialize-response.function.mjs +5 -0
  49. package/esm2022/lib/core/payment/requests/initialize/response/initialize-response.class.mjs +43 -0
  50. package/esm2022/lib/core/payment/requests/initialize/response/initialize-response.token.mjs +8 -0
  51. package/esm2022/lib/core/payment/{submit/response → requests/submit}/is-submit-response.function.mjs +2 -2
  52. package/esm2022/lib/core/payment/requests/submit/request/submit-request.class.mjs +36 -0
  53. package/esm2022/lib/core/payment/requests/submit/request/submit-request.token.mjs +8 -0
  54. package/esm2022/lib/core/payment/requests/submit/response/submit-response.class.mjs +35 -0
  55. package/esm2022/lib/core/payment/requests/submit/response/submit-response.token.mjs +8 -0
  56. package/esm2022/lib/core/payment/requests/submit/response/xsolla-number.interface.mjs +2 -0
  57. package/esm2022/lib/core/payment/requests/submit/submit.service.mjs +82 -0
  58. package/esm2022/lib/core/payment/requests/sync/field-async-validation.interface.mjs +2 -0
  59. package/esm2022/lib/core/payment/requests/sync/field-sync-state.interface.mjs +2 -0
  60. package/esm2022/lib/core/payment/requests/sync/request/sync-request.class.mjs +34 -0
  61. package/esm2022/lib/core/payment/requests/sync/request/sync-request.token.mjs +8 -0
  62. package/esm2022/lib/core/payment/requests/sync/response/sync-response.class.mjs +17 -0
  63. package/esm2022/lib/core/payment/requests/sync/response/sync-response.token.mjs +8 -0
  64. package/esm2022/lib/core/payment/requests/sync/sync.service.mjs +184 -0
  65. package/esm2022/lib/core/payment/status/check-status/check-status.service.mjs +2 -2
  66. package/esm2022/lib/core/payment/status/check-status/request/check-status-request.class.mjs +2 -2
  67. package/esm2022/lib/core/payment/status/status-request/request/status-request.class.mjs +2 -2
  68. package/esm2022/lib/core/payment/status/status-request/status-request.service.mjs +2 -2
  69. package/esm2022/lib/core/payment/three-ds/three-ds.service.mjs +1 -1
  70. package/esm2022/lib/core/payment/xps-api/xps-api-part-request.abstract.mjs +13 -0
  71. package/esm2022/lib/core/payment/xps-api/xps-api-part.abstract.mjs +19 -0
  72. package/esm2022/lib/core/payment/xps-finance.interface.mjs +1 -1
  73. package/esm2022/lib/core/sdk-payment-systems/apple-pay/apple-pay-cart/apple-pay-cart.service.mjs +56 -0
  74. package/esm2022/lib/core/sdk-payment-systems/apple-pay/apple-pay-sdk.service.mjs +95 -0
  75. package/esm2022/lib/core/sdk-payment-systems/apple-pay/apple-pay.service.mjs +46 -18
  76. package/esm2022/lib/core/sdk-payment-systems/apple-pay/session-handlers/apple-pay-session.interface.mjs +1 -1
  77. package/esm2022/lib/core/sdk-payment-systems/apple-pay/session-handlers/braintree.handler.mjs +32 -5
  78. package/esm2022/lib/core/sdk-payment-systems/apple-pay/session-handlers/checkout.handler.mjs +31 -5
  79. package/esm2022/lib/core/sdk-payment-systems/apple-pay/session-handlers/session-handler.abstract.mjs +1 -1
  80. package/esm2022/lib/core/sdk-payment-systems/apple-pay/shipping-address.interface.mjs +2 -0
  81. package/esm2022/lib/core/sdk-payment-systems/apple-pay/updated-price.interface.mjs +2 -0
  82. package/esm2022/lib/core/sdk-payment-systems/google-pay/check-payment-device-data.interface.mjs +1 -1
  83. package/esm2022/lib/core/sdk-payment-systems/sdk-payment-systems-initial-data.interface.mjs +1 -1
  84. package/esm2022/lib/core-library.module.mjs +10 -9
  85. package/esm2022/lib/core-library.service.mjs +1 -1
  86. package/esm2022/public-api.mjs +2 -1
  87. package/fesm2022/xsolla-payment-client-core.mjs +393 -26
  88. package/fesm2022/xsolla-payment-client-core.mjs.map +1 -1
  89. package/lib/core/encrypt-credit-card/encrypt-credit-card.service.d.ts +1 -1
  90. package/lib/core/payment/actions/action.interface.d.ts +1 -1
  91. package/lib/core/payment/actions/check-status/check-status.action.class.d.ts +1 -1
  92. package/lib/core/payment/actions/next-action.service.d.ts +1 -1
  93. package/lib/core/payment/actions/next-actions.d.ts +1 -1
  94. package/lib/core/payment/actions/redirect/redirect.action.class.d.ts +1 -1
  95. package/lib/core/payment/actions/show-cash-payment-instruction/show-cash-payment-instruction.action.class.d.ts +1 -1
  96. package/lib/core/payment/actions/show-errors/show-errors.action.class.d.ts +1 -1
  97. package/lib/core/payment/actions/show-fields/show-fields.action.class.d.ts +1 -1
  98. package/lib/core/payment/actions/show-mobile-payment-screen/show-mobile-payment-screen.action.class.d.ts +1 -1
  99. package/lib/core/payment/actions/show-qr-code/show-qr-code.action.class.d.ts +1 -1
  100. package/lib/core/payment/actions/show-xsolla-number/show-xsolla-number.action.class.d.ts +1 -1
  101. package/lib/core/payment/actions/special-button/special-button.action.class.d.ts +1 -1
  102. package/lib/core/payment/form/converters/birth-date/birth-date.converter.d.ts +1 -1
  103. package/lib/core/payment/form/converters/card-expiration/card-expiration.converter.d.ts +1 -1
  104. package/lib/core/payment/form/converters/card-month/card-month.converter.d.ts +1 -1
  105. package/lib/core/payment/form/converters/card-number/card-number.converter.d.ts +1 -1
  106. package/lib/core/payment/form/converters/card-year/card-year.converter.d.ts +1 -1
  107. package/lib/core/payment/form/converters/cardholder-name/cardholder-name.converter.d.ts +1 -1
  108. package/lib/core/payment/form/converters/checkbox/checkbox.converter.d.ts +1 -1
  109. package/lib/core/payment/form/converters/converter.abstract.d.ts +1 -1
  110. package/lib/core/payment/form/converters/coupon/coupon.converter.d.ts +1 -1
  111. package/lib/core/payment/form/converters/cpf-name/cpf-name.converter.d.ts +1 -1
  112. package/lib/core/payment/form/converters/cpf-number/cpf-number.converter.d.ts +1 -1
  113. package/lib/core/payment/form/converters/cvv/cvv.converter.d.ts +1 -1
  114. package/lib/core/payment/form/converters/email/email.converter.d.ts +1 -1
  115. package/lib/core/payment/form/converters/{phone.converter.d.ts → phone/phone.converter.d.ts} +4 -4
  116. package/lib/core/payment/form/converters/pin/pin.converter.d.ts +1 -1
  117. package/lib/core/payment/form/converters/pricepoint/pricepoint.converter.d.ts +1 -1
  118. package/lib/core/payment/form/converters/radio-group/radio-group.converter.d.ts +1 -1
  119. package/lib/core/payment/form/converters/select/select.converter.d.ts +1 -1
  120. package/lib/core/payment/form/converters/street-number/street-number.converter.d.ts +1 -1
  121. package/lib/core/payment/form/converters/text/text.converter.d.ts +1 -1
  122. package/lib/core/payment/form/converters/zip/zip.converter.d.ts +1 -1
  123. package/lib/core/payment/form-response.interface.d.ts +2 -2
  124. package/lib/core/payment/initialize-actions/action.interface.d.ts +2 -2
  125. package/lib/core/payment/initialize-actions/initialize-next-action.service.d.ts +1 -1
  126. package/lib/core/payment/initialize-actions/initialize-next-actions.d.ts +1 -1
  127. package/lib/core/payment/initialize-actions/special-button/special-button.action.class.d.ts +1 -1
  128. package/lib/core/payment/payment-behaviour/behaviour-strategies.d.ts +5 -0
  129. package/lib/core/payment/payment-behaviour/payment-behaviour.module.d.ts +7 -0
  130. package/lib/core/payment/payment-behaviour/payment-behaviour.service.d.ts +16 -0
  131. package/lib/core/payment/payment-behaviour/strategies/apple-pay-with-shipping-address/apple-pay-with-shipping-address.strategy.d.ts +10 -0
  132. package/lib/core/payment/payment-behaviour/strategies/behaviour-strategy.abstract.d.ts +15 -0
  133. package/lib/core/payment/payment.service.d.ts +10 -6
  134. package/lib/core/payment/{initialize → requests/initialize}/initialize-request-params.interface.d.ts +1 -1
  135. package/lib/core/payment/{initialize → requests/initialize}/initialize.service.d.ts +10 -10
  136. package/lib/core/payment/requests/initialize/is-initialize-response.function.d.ts +2 -0
  137. package/lib/core/payment/{initialize → requests/initialize}/response/initialize-response.class.d.ts +2 -2
  138. package/lib/core/payment/{submit/response → requests/submit}/is-submit-response.function.d.ts +1 -1
  139. package/lib/core/payment/{submit → requests/submit}/request/submit-request.class.d.ts +2 -2
  140. package/lib/core/payment/{submit → requests/submit}/response/submit-response.class.d.ts +4 -4
  141. package/lib/core/payment/{submit → requests/submit}/submit.service.d.ts +9 -9
  142. package/lib/core/payment/{sync → requests/sync}/field-async-validation.interface.d.ts +1 -1
  143. package/lib/core/payment/{sync → requests/sync}/request/sync-request.class.d.ts +2 -2
  144. package/lib/core/payment/{sync → requests/sync}/response/sync-response.class.d.ts +2 -2
  145. package/lib/core/payment/{sync → requests/sync}/sync.service.d.ts +14 -12
  146. package/lib/core/payment/status/check-status/check-status.service.d.ts +1 -1
  147. package/lib/core/payment/status/check-status/request/check-status-request.class.d.ts +1 -1
  148. package/lib/core/payment/status/status-request/request/status-request.class.d.ts +1 -1
  149. package/lib/core/payment/status/status-request/status-request.service.d.ts +1 -1
  150. package/lib/core/payment/three-ds/three-ds.service.d.ts +1 -1
  151. package/lib/core/payment/xps-finance.interface.d.ts +20 -0
  152. package/lib/core/sdk-payment-systems/apple-pay/apple-pay-cart/apple-pay-cart.service.d.ts +21 -0
  153. package/lib/core/sdk-payment-systems/apple-pay/apple-pay-sdk.service.d.ts +24 -0
  154. package/lib/core/sdk-payment-systems/apple-pay/apple-pay.service.d.ts +10 -3
  155. package/lib/core/sdk-payment-systems/apple-pay/session-handlers/apple-pay-session.interface.d.ts +17 -8
  156. package/lib/core/sdk-payment-systems/apple-pay/session-handlers/braintree.handler.d.ts +4 -2
  157. package/lib/core/sdk-payment-systems/apple-pay/session-handlers/checkout.handler.d.ts +4 -2
  158. package/lib/core/sdk-payment-systems/apple-pay/session-handlers/session-handler.abstract.d.ts +1 -1
  159. package/lib/core/sdk-payment-systems/apple-pay/shipping-address.interface.d.ts +4 -0
  160. package/lib/core/sdk-payment-systems/apple-pay/updated-price.interface.d.ts +7 -0
  161. package/lib/core/sdk-payment-systems/google-pay/check-payment-device-data.interface.d.ts +1 -1
  162. package/lib/core/sdk-payment-systems/sdk-payment-systems-initial-data.interface.d.ts +1 -1
  163. package/lib/core-library.module.d.ts +2 -1
  164. package/lib/core-library.service.d.ts +2 -2
  165. package/package.json +1 -1
  166. package/public-api.d.ts +1 -0
  167. package/xsolla-payment-client-core-0.2.54.tgz +0 -0
  168. package/esm2022/lib/core/payment/form/converters/phone.converter.mjs +0 -39
  169. package/esm2022/lib/core/payment/initialize/initialize-request-params.interface.mjs +0 -2
  170. package/esm2022/lib/core/payment/initialize/initialize.service.mjs +0 -89
  171. package/esm2022/lib/core/payment/initialize/response/initialize-response.class.mjs +0 -43
  172. package/esm2022/lib/core/payment/initialize/response/initialize-response.token.mjs +0 -8
  173. package/esm2022/lib/core/payment/submit/request/submit-request.class.mjs +0 -36
  174. package/esm2022/lib/core/payment/submit/request/submit-request.token.mjs +0 -8
  175. package/esm2022/lib/core/payment/submit/response/submit-response.class.mjs +0 -35
  176. package/esm2022/lib/core/payment/submit/response/submit-response.token.mjs +0 -8
  177. package/esm2022/lib/core/payment/submit/response/xsolla-number.interface.mjs +0 -2
  178. package/esm2022/lib/core/payment/submit/submit.service.mjs +0 -82
  179. package/esm2022/lib/core/payment/sync/field-async-validation.interface.mjs +0 -2
  180. package/esm2022/lib/core/payment/sync/field-sync-state.interface.mjs +0 -2
  181. package/esm2022/lib/core/payment/sync/request/sync-request.class.mjs +0 -34
  182. package/esm2022/lib/core/payment/sync/request/sync-request.token.mjs +0 -8
  183. package/esm2022/lib/core/payment/sync/response/sync-response.class.mjs +0 -17
  184. package/esm2022/lib/core/payment/sync/response/sync-response.token.mjs +0 -8
  185. package/esm2022/lib/core/payment/sync/sync.service.mjs +0 -164
  186. package/esm2022/lib/core/payment/xps-api-part-request.abstract.mjs +0 -13
  187. package/esm2022/lib/core/payment/xps-api-part.abstract.mjs +0 -19
  188. package/xsolla-payment-client-core-0.2.52.tgz +0 -0
  189. /package/lib/core/payment/{initialize → requests/initialize}/response/initialize-response.token.d.ts +0 -0
  190. /package/lib/core/payment/{submit → requests/submit}/request/submit-request.token.d.ts +0 -0
  191. /package/lib/core/payment/{submit → requests/submit}/response/submit-response.token.d.ts +0 -0
  192. /package/lib/core/payment/{submit → requests/submit}/response/xsolla-number.interface.d.ts +0 -0
  193. /package/lib/core/payment/{sync → requests/sync}/field-sync-state.interface.d.ts +0 -0
  194. /package/lib/core/payment/{sync → requests/sync}/request/sync-request.token.d.ts +0 -0
  195. /package/lib/core/payment/{sync → requests/sync}/response/sync-response.token.d.ts +0 -0
  196. /package/lib/core/payment/{xps-api-part-request.abstract.d.ts → xps-api/xps-api-part-request.abstract.d.ts} +0 -0
  197. /package/lib/core/payment/{xps-api-part.abstract.d.ts → xps-api/xps-api-part.abstract.d.ts} +0 -0
@@ -1,21 +1,21 @@
1
1
  import { UntypedFormGroup, ValidationErrors } from '@angular/forms';
2
2
  import { Observable } from 'rxjs';
3
- import { SettingsService } from '../../settings/settings.service';
4
- import { EmitDataService } from '../emit-data.service.abstract';
5
- import { Field } from '../field.interface';
6
- import { XpsResponse } from '../xps-response.interface';
3
+ import { SettingsService } from '../../../settings/settings.service';
4
+ import { EmitDataService } from '../../emit-data.service.abstract';
5
+ import { Field } from '../../field.interface';
6
+ import { XpsResponse } from '../../xps-response.interface';
7
7
  import { SyncRequestFactory } from './request/sync-request.token';
8
8
  import { SyncResponse } from './response/sync-response.class';
9
9
  import { SyncResponseFactory } from './response/sync-response.token';
10
- import { NextActionService } from '../actions/next-action.service';
11
- import { ShowErrorsActionCreator } from '../actions/show-errors/show-errors.action.class';
12
- import { XpsApiService } from '../xps-api/xps-api.service';
10
+ import { NextActionService } from '../../actions/next-action.service';
11
+ import { ShowErrorsActionCreator } from '../../actions/show-errors/show-errors.action.class';
12
+ import { XpsApiService } from '../../xps-api/xps-api.service';
13
13
  import { FieldAsyncValidation } from './field-async-validation.interface';
14
- import { EncryptCreditCardService } from '../../encrypt-credit-card/encrypt-credit-card.service';
15
- import { XpsResponseErrorsMappingService } from '../../errors-mapping/xps-response-errors-mapping.service';
16
- import { UserBehaviourAnalyticsService } from '../../user-behaviour-analytics/user-behaviour-analytics.service';
17
- import { PaymentConfiguration } from '../payment-configuration.interface';
18
- import { PaymentSettingsService } from '../payment-settings/payment-settings.service';
14
+ import { EncryptCreditCardService } from '../../../encrypt-credit-card/encrypt-credit-card.service';
15
+ import { XpsResponseErrorsMappingService } from '../../../errors-mapping/xps-response-errors-mapping.service';
16
+ import { UserBehaviourAnalyticsService } from '../../../user-behaviour-analytics/user-behaviour-analytics.service';
17
+ import { PaymentConfiguration } from '../../payment-configuration.interface';
18
+ import { PaymentSettingsService } from '../../payment-settings/payment-settings.service';
19
19
  import * as i0 from "@angular/core";
20
20
  export declare class SyncService extends EmitDataService<XpsResponse> {
21
21
  private readonly requestFactory;
@@ -39,6 +39,8 @@ export declare class SyncService extends EmitDataService<XpsResponse> {
39
39
  setup(form: UntypedFormGroup, fields: Field[], config: PaymentConfiguration): void;
40
40
  reset(): void;
41
41
  validate(field: Field, delay?: number): Promise<ValidationErrors | null>;
42
+ forceValidate(field: Field): Promise<SyncResponse | null>;
43
+ removeField(fieldName: string): void;
42
44
  getSyncValidationErrors(field: Field): ValidationErrors | null;
43
45
  request(field: Field, fields?: Field[], form?: UntypedFormGroup): Promise<SyncResponse>;
44
46
  private isReadyField;
@@ -1,7 +1,7 @@
1
1
  import { SettingsService } from '../../../settings/settings.service';
2
2
  import { CheckStatusRequestFactory } from './request/check-status-request.token';
3
3
  import { CheckStatusResponseFactory } from './response/check-status-response.token';
4
- import { XpsApiPart } from '../../xps-api-part.abstract';
4
+ import { XpsApiPart } from '../../xps-api/xps-api-part.abstract';
5
5
  import { XpsApiService } from '../../xps-api/xps-api.service';
6
6
  import { CheckStatusResponse } from './response/check-status-response.class';
7
7
  import { XpsResponseErrorsMappingService } from '../../../errors-mapping/xps-response-errors-mapping.service';
@@ -1,4 +1,4 @@
1
- import { XpsApiPartRequest } from '../../../xps-api-part-request.abstract';
1
+ import { XpsApiPartRequest } from '../../../xps-api/xps-api-part-request.abstract';
2
2
  export declare class CheckStatusRequest extends XpsApiPartRequest {
3
3
  readonly access_token: string;
4
4
  readonly xps_fix_command = "status";
@@ -1,4 +1,4 @@
1
- import { XpsApiPartRequest } from '../../../xps-api-part-request.abstract';
1
+ import { XpsApiPartRequest } from '../../../xps-api/xps-api-part-request.abstract';
2
2
  import { StatusRequestParams } from '../status-request-params.interface';
3
3
  export declare class StatusRequest extends XpsApiPartRequest {
4
4
  readonly access_token: string;
@@ -1,6 +1,6 @@
1
1
  import { SettingsService } from '../../../settings/settings.service';
2
2
  import { SecureApiClient } from '../../../http/secure-api/secure-api.service';
3
- import { XpsApiPart } from '../../xps-api-part.abstract';
3
+ import { XpsApiPart } from '../../xps-api/xps-api-part.abstract';
4
4
  import { StatusRequestFactory } from './request/status-request.token';
5
5
  import { StatusResponseFactory } from './response/status-response.token';
6
6
  import { StatusRequestParams } from './status-request-params.interface';
@@ -2,7 +2,7 @@ import { NextActionService } from '../actions/next-action.service';
2
2
  import { ThreeDs20Service } from './three-ds-20/three-ds20.service';
3
3
  import { ThreeDsActionCreator } from '../actions/three-ds/three-ds.action.class';
4
4
  import { CheckStatusActionCreator } from '../actions/check-status/check-status.action.class';
5
- import { SubmitResponse } from '../submit/response/submit-response.class';
5
+ import { SubmitResponse } from '../requests/submit/response/submit-response.class';
6
6
  import * as i0 from "@angular/core";
7
7
  export declare class ThreeDsService {
8
8
  private readonly threeDs20Service;
@@ -8,6 +8,12 @@ export interface XpsFinance {
8
8
  payment_amount: number;
9
9
  payment_currency: string;
10
10
  };
11
+ redeem_points?: {
12
+ amount: number;
13
+ currency: string;
14
+ points_value: number;
15
+ points_name: string;
16
+ };
11
17
  discount: {
12
18
  amount: number;
13
19
  currency: string;
@@ -23,11 +29,21 @@ export interface XpsFinance {
23
29
  percent: number;
24
30
  currency: string;
25
31
  };
32
+ city_tax?: {
33
+ amount: number;
34
+ percent: number;
35
+ currency: string;
36
+ };
26
37
  sales_tax_user?: {
27
38
  amount: number;
28
39
  percent: number;
29
40
  currency: string;
30
41
  };
42
+ city_tax_user?: {
43
+ amount: number;
44
+ percent: number;
45
+ currency: string;
46
+ };
31
47
  fee: {
32
48
  amount: number;
33
49
  currency: string;
@@ -50,6 +66,10 @@ export interface XpsFinance {
50
66
  amount: number;
51
67
  currency: string;
52
68
  };
69
+ user_recurrent_balance?: {
70
+ amount: number;
71
+ currency: string;
72
+ };
53
73
  grand_total?: {
54
74
  amount: number;
55
75
  currency: string;
@@ -0,0 +1,21 @@
1
+ import { Observable } from 'rxjs';
2
+ import { ApplePayError, ApplePayShippingContact, ApplePayShippingContactUpdate } from '../session-handlers/apple-pay-session.interface';
3
+ import { ApplePayParams } from '../apple-pay-params.interface';
4
+ import { UpdatedPrice } from '../updated-price.interface';
5
+ import { ShippingAddress } from '../shipping-address.interface';
6
+ import * as i0 from "@angular/core";
7
+ export declare class ApplePayCartService {
8
+ private readonly cartSuccessfulRecalculated;
9
+ private readonly cartErrorRecalculated;
10
+ private readonly cartRecalculationRequest;
11
+ get cartSuccessfulRecalculated$(): Observable<UpdatedPrice>;
12
+ get cartErrorRecalculated$(): Observable<ApplePayError>;
13
+ get cartRecalculationRequest$(): Observable<ShippingAddress>;
14
+ recalculateCartTaxes(shippingContact: ApplePayShippingContact): void;
15
+ buildShippingContactUpdate(paymentParams: ApplePayParams, updatedPrice: UpdatedPrice): ApplePayShippingContactUpdate;
16
+ sendSuccessfulRecalculatedCart(updatedPrice: UpdatedPrice): void;
17
+ sendErrorRecalculatedCart(error: ApplePayError): void;
18
+ isZipCountry(country: string): boolean;
19
+ static ɵfac: i0.ɵɵFactoryDeclaration<ApplePayCartService, never>;
20
+ static ɵprov: i0.ɵɵInjectableDeclaration<ApplePayCartService>;
21
+ }
@@ -0,0 +1,24 @@
1
+ import { ExtendedWindow } from '../../extended-window.interface';
2
+ import { ElkLoggerService } from '../../exceptions-handling/elk/elk-logger.service';
3
+ import { Observable } from 'rxjs';
4
+ import * as i0 from "@angular/core";
5
+ export declare class ApplePaySdkService {
6
+ private readonly window;
7
+ private readonly loggerService;
8
+ readonly needToAddApplePayJs: boolean;
9
+ sdkLoaded: boolean;
10
+ private readonly jsSdk;
11
+ private readonly sdkSuccessfulPayment;
12
+ private readonly windowClosing;
13
+ private readonly successPaymentType;
14
+ private readonly windowClosingType;
15
+ private applePaySdkPostMessagesListener;
16
+ constructor(window: ExtendedWindow, loggerService: ElkLoggerService);
17
+ get windowClosing$(): Observable<void>;
18
+ emitWindowClosing(): void;
19
+ addApplePaySdkJs(): void;
20
+ removeListeners(): void;
21
+ private isAppleSdkExist;
22
+ static ɵfac: i0.ɵɵFactoryDeclaration<ApplePaySdkService, never>;
23
+ static ɵprov: i0.ɵɵInjectableDeclaration<ApplePaySdkService>;
24
+ }
@@ -1,7 +1,6 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { ExtendedWindow } from '../../extended-window.interface';
3
3
  import { SummaryFinanceDetailsAdapterService } from '../../payment/finance-details/summary/summary-finance-details-adapter.service';
4
- import { UserAgentService } from '../../user-agent/user-agent.service';
5
4
  import { ApplePayIntegration } from './apple-pay-integration.type';
6
5
  import { ApplePayParams } from './apple-pay-params.interface';
7
6
  import { ApplePayErrors } from './apple-pay.errors.enum';
@@ -11,18 +10,20 @@ import { PaymentForm } from '../../payment/payment-form.interface';
11
10
  import { ApplePayParamsBuilderService } from './params-builder/apple-pay-params-builder.service';
12
11
  import { ElkLoggerService } from '../../exceptions-handling/elk/elk-logger.service';
13
12
  import { StartSessionParams } from './session-handlers/start-session-params.interface';
13
+ import { ApplePaySdkService } from './apple-pay-sdk.service';
14
14
  import * as i0 from "@angular/core";
15
15
  export declare class ApplePayService {
16
16
  private readonly window;
17
- private readonly userAgentService;
18
17
  private readonly summaryFinanceDetailsAdapterService;
19
18
  private readonly braintreeHandler;
20
19
  private readonly checkoutHandler;
21
20
  private readonly appleParamsBuilder;
22
21
  private readonly elkLoggerService;
22
+ private readonly applePaySdkService;
23
23
  private readonly payment;
24
24
  private readonly error;
25
25
  private readonly integrationType;
26
+ private readonly applePayQrOpened;
26
27
  private paymentClient;
27
28
  private readonly api;
28
29
  private applePayParams;
@@ -30,8 +31,12 @@ export declare class ApplePayService {
30
31
  get paymentParameters(): ApplePayParams | null;
31
32
  get payment$(): Observable<string>;
32
33
  get error$(): Observable<ApplePayErrors>;
34
+ get applePayQrOpened$(): Observable<void>;
35
+ get windowClosing$(): Observable<void>;
33
36
  get integrationType$(): Observable<ApplePayIntegration>;
34
- constructor(window: ExtendedWindow, userAgentService: UserAgentService, summaryFinanceDetailsAdapterService: SummaryFinanceDetailsAdapterService, braintreeHandler: BraintreeHandler, checkoutHandler: CheckoutHandler, appleParamsBuilder: ApplePayParamsBuilderService, elkLoggerService: ElkLoggerService);
37
+ constructor(window: ExtendedWindow, summaryFinanceDetailsAdapterService: SummaryFinanceDetailsAdapterService, braintreeHandler: BraintreeHandler, checkoutHandler: CheckoutHandler, appleParamsBuilder: ApplePayParamsBuilderService, elkLoggerService: ElkLoggerService, applePaySdkService: ApplePaySdkService);
38
+ addApplePaySdkJs(): void;
39
+ removeListeners(): void;
35
40
  setApplePayParams(data: {
36
41
  paymentForm: PaymentForm;
37
42
  }): void;
@@ -53,6 +58,8 @@ export declare class ApplePayService {
53
58
  private emitError;
54
59
  private emitIntegrationType;
55
60
  private subscribeToHandlers;
61
+ private getIntegrationType;
62
+ private emitApplePayOpened;
56
63
  static ɵfac: i0.ɵɵFactoryDeclaration<ApplePayService, never>;
57
64
  static ɵprov: i0.ɵɵInjectableDeclaration<ApplePayService>;
58
65
  }
@@ -15,6 +15,13 @@ export declare class ApplePaySession {
15
15
  abort(): void;
16
16
  begin(): void;
17
17
  }
18
+ export type ApplePayErrorCode = 'shippingContactInvalid' | 'billingContactInvalid' | 'addressUnserviceable' | 'unknown';
19
+ export type ApplePayErrorContactField = 'emailAddress' | 'name' | 'phoneNumber' | 'postalAddress' | 'postalCode' | 'none';
20
+ export interface ApplePayError {
21
+ code: ApplePayErrorCode;
22
+ contactField?: ApplePayErrorContactField;
23
+ message: string;
24
+ }
18
25
  export interface ApplePayValidEvent {
19
26
  validationURL: string;
20
27
  }
@@ -22,13 +29,14 @@ export interface ApplePayPaymentAuthorizedEvent {
22
29
  payment: ApplePayPayment;
23
30
  }
24
31
  export interface ApplePayOnShippingContactSelectedEvent {
25
- shippingContact: {
26
- locality: string;
27
- country: string;
28
- postalCode: string;
29
- administrativeArea: string;
30
- countryCode: string;
31
- };
32
+ shippingContact: ApplePayShippingContact;
33
+ }
34
+ export interface ApplePayShippingContact {
35
+ locality: string;
36
+ country: string;
37
+ postalCode: string;
38
+ administrativeArea: string;
39
+ countryCode: string;
32
40
  }
33
41
  export interface ApplePayOnShippingMethodSelectedEvent {
34
42
  shippingMethod: {
@@ -53,7 +61,8 @@ export interface ApplePayOnShippingMethodSelectedEvent {
53
61
  };
54
62
  }
55
63
  export interface ApplePayShippingContactUpdate {
56
- status: 'STATUS_SUCCESS' | 'STATUS_FAILURE';
64
+ status?: 'STATUS_SUCCESS' | 'STATUS_FAILURE';
65
+ errors?: ApplePayError[];
57
66
  newTotal: ApplePayLineItem;
58
67
  newLineItems?: ApplePayLineItem[];
59
68
  }
@@ -4,14 +4,16 @@ import { ExtendedWindow } from '../../../extended-window.interface';
4
4
  import { ApplePayParams } from '../apple-pay-params.interface';
5
5
  import { ApplePaySessionHandlerAbstract } from './session-handler.abstract';
6
6
  import { StartSessionParams } from './start-session-params.interface';
7
+ import { ApplePayCartService } from '../apple-pay-cart/apple-pay-cart.service';
7
8
  import * as i0 from "@angular/core";
8
9
  export declare class BraintreeHandler extends ApplePaySessionHandlerAbstract {
9
10
  private readonly window;
10
11
  private readonly elkLoggerService;
12
+ private readonly applePayCartService;
11
13
  private paymentClient;
12
- constructor(window: ExtendedWindow, elkLoggerService: ElkLoggerService);
14
+ constructor(window: ExtendedWindow, elkLoggerService: ElkLoggerService, applePayCartService: ApplePayCartService);
13
15
  setClient(client: ApplePay): void;
14
- startSession(params: ApplePayParams, additionalParams: StartSessionParams): void;
16
+ startSession(params: ApplePayParams, additionalParams: StartSessionParams, applePayFinallyCallback: () => void): void;
15
17
  static ɵfac: i0.ɵɵFactoryDeclaration<BraintreeHandler, never>;
16
18
  static ɵprov: i0.ɵɵInjectableDeclaration<BraintreeHandler>;
17
19
  }
@@ -3,12 +3,14 @@ import { ExtendedWindow } from '../../../extended-window.interface';
3
3
  import { ApplePayParams } from '../apple-pay-params.interface';
4
4
  import { ApplePaySessionHandlerAbstract } from './session-handler.abstract';
5
5
  import { StartSessionParams } from './start-session-params.interface';
6
+ import { ApplePayCartService } from '../apple-pay-cart/apple-pay-cart.service';
6
7
  import * as i0 from "@angular/core";
7
8
  export declare class CheckoutHandler extends ApplePaySessionHandlerAbstract {
8
9
  private readonly window;
9
10
  private readonly http;
10
- constructor(window: ExtendedWindow, http: HttpClient);
11
- startSession(params: ApplePayParams, additionalParams: StartSessionParams): void;
11
+ private readonly applePayCartService;
12
+ constructor(window: ExtendedWindow, http: HttpClient, applePayCartService: ApplePayCartService);
13
+ startSession(params: ApplePayParams, additionalParams: StartSessionParams, applePayFinallyCallback: () => void): void;
12
14
  static ɵfac: i0.ɵɵFactoryDeclaration<CheckoutHandler, never>;
13
15
  static ɵprov: i0.ɵɵInjectableDeclaration<CheckoutHandler>;
14
16
  }
@@ -8,7 +8,7 @@ export declare abstract class ApplePaySessionHandlerAbstract {
8
8
  private readonly _errorSubject;
9
9
  get error$(): Observable<ApplePayErrors>;
10
10
  get payment$(): Observable<string>;
11
- abstract startSession(params: ApplePayParams, additionalParams: StartSessionParams): void;
11
+ abstract startSession(params: ApplePayParams, additionalParams: StartSessionParams, applePayFinallyCallback: () => void): void;
12
12
  protected emitError(error: ApplePayErrors): void;
13
13
  protected buildPaymentRequest(params: ApplePayParams): ApplePayPaymentRequest;
14
14
  }
@@ -0,0 +1,4 @@
1
+ export interface ShippingAddress {
2
+ zip: string;
3
+ country: string;
4
+ }
@@ -0,0 +1,7 @@
1
+ import { CartLine } from '../../payment/finance-details/cart-line.interface';
2
+ export interface UpdatedPrice {
3
+ total: number;
4
+ subtotalPayment?: CartLine | null;
5
+ subtotalDetails?: CartLine[];
6
+ totalDetails?: CartLine[];
7
+ }
@@ -1,5 +1,5 @@
1
1
  import { Field } from '../../payment/field.interface';
2
- import { SubmitResponse } from '../../payment/submit/response/submit-response.class';
2
+ import { SubmitResponse } from '../../payment/requests/submit/response/submit-response.class';
3
3
  import { XpsSummary } from '../../payment/xps-summary.interface';
4
4
  export interface CheckPaymentDeviceData {
5
5
  base64checkoutData: string | null;
@@ -1,5 +1,5 @@
1
1
  import { Field } from '../payment/field.interface';
2
- import { SubmitResponse } from '../payment/submit/response/submit-response.class';
2
+ import { SubmitResponse } from '../payment/requests/submit/response/submit-response.class';
3
3
  import { XpsSummary } from '../payment/xps-summary.interface';
4
4
  import { XpsBoolean } from '../xps-boolean.enum';
5
5
  export interface SdkPaymentSystemsInitialData {
@@ -2,8 +2,9 @@ import * as i0 from "@angular/core";
2
2
  import * as i1 from "@angular/common/http";
3
3
  import * as i2 from "./core/payment/form/form.module";
4
4
  import * as i3 from "./shared/pipes/pipes.module";
5
+ import * as i4 from "./core/payment/payment-behaviour/payment-behaviour.module";
5
6
  export declare class CoreLibraryModule {
6
7
  static ɵfac: i0.ɵɵFactoryDeclaration<CoreLibraryModule, never>;
7
- static ɵmod: i0.ɵɵNgModuleDeclaration<CoreLibraryModule, never, [typeof i1.HttpClientModule, typeof i2.FormModule, typeof i3.PipesModule], never>;
8
+ static ɵmod: i0.ɵɵNgModuleDeclaration<CoreLibraryModule, never, [typeof i1.HttpClientModule, typeof i2.FormModule, typeof i3.PipesModule, typeof i4.PaymentBehaviourModule], never>;
8
9
  static ɵinj: i0.ɵɵInjectorDeclaration<CoreLibraryModule>;
9
10
  }
@@ -45,9 +45,9 @@ import { SendInstructionService } from './core/xsolla-number/api/send-instructio
45
45
  import { SendInstructionResponseInterface } from './core/xsolla-number/api/send-instruction/response/send-instruction-response.interface';
46
46
  import { SendInstructionParametersInterface } from './core/xsolla-number/api/send-instruction/send-instruction-parameters.interface';
47
47
  import { ScriptTrackerService } from './core/script-tracker/script-tracker.service';
48
- import { SyncResponse } from './core/payment/sync/response/sync-response.class';
48
+ import { SyncResponse } from './core/payment/requests/sync/response/sync-response.class';
49
49
  import { XpsSummary } from './core/payment/xps-summary.interface';
50
- import { SubmitResponse } from './core/payment/submit/response/submit-response.class';
50
+ import { SubmitResponse } from './core/payment/requests/submit/response/submit-response.class';
51
51
  import * as i0 from "@angular/core";
52
52
  export declare class CoreLibraryService {
53
53
  private readonly settingsService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xsolla/payment-client-core",
3
- "version": "0.2.52",
3
+ "version": "0.2.54",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^17.3.3",
6
6
  "@angular/core": "^17.3.3",
package/public-api.d.ts CHANGED
@@ -4,6 +4,7 @@ export * from './lib/core/legal/legal.component.config';
4
4
  export * from './lib/core/sdk-payment-systems/payment-systems/payment-system-processing.service';
5
5
  export * from './lib/core/sdk-payment-systems/google-pay/google-pay.service';
6
6
  export * from './lib/core/sdk-payment-systems/apple-pay/apple-pay.service';
7
+ export * from './lib/core/sdk-payment-systems/apple-pay/apple-pay-cart/apple-pay-cart.service';
7
8
  export * from './lib/core/sdk-payment-systems/apple-pay/apple-pay-params.interface';
8
9
  export * from './lib/core/user-behaviour-analytics/user-behaviour-event/user-behaviour-event-types';
9
10
  export * from './lib/core/payment/form/control-status.interface';
@@ -1,39 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
- import { Converter } from './converter.abstract';
3
- import { phoneValidator } from '../validators/phone-validator';
4
- import { minLengthValidator } from '../validators/min-length-validator';
5
- import { maxLengthValidator } from '../validators/max-length-validator';
6
- import { PhoneControlConfig } from '../controls/phone-control.config';
7
- import { convertedRequiredValidator } from '../validators/required/required.validator';
8
- import * as i0 from "@angular/core";
9
- import * as i1 from "../../sync/sync.service";
10
- export class PhoneConverter extends Converter {
11
- constructor(syncService) {
12
- super(syncService);
13
- }
14
- getValidators(field) {
15
- if (field.isMandatory === "0" /* XpsBoolean.false */)
16
- return [];
17
- const minLength = 10;
18
- const maxLength = 15;
19
- return super
20
- .getValidators(field)
21
- .concat([
22
- convertedRequiredValidator(),
23
- phoneValidator(),
24
- minLengthValidator(minLength),
25
- maxLengthValidator(maxLength),
26
- ]);
27
- }
28
- createControlConfig(field) {
29
- const config = this.createDefaultControlConfig(PhoneControlConfig, field);
30
- config.inputMode = 'numeric';
31
- return config;
32
- }
33
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PhoneConverter, deps: [{ token: i1.SyncService }], target: i0.ɵɵFactoryTarget.Injectable }); }
34
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PhoneConverter }); }
35
- }
36
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PhoneConverter, decorators: [{
37
- type: Injectable
38
- }], ctorParameters: () => [{ type: i1.SyncService }] });
39
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGhvbmUuY29udmVydGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvcGF5bWVudC1jbGllbnQtY29yZS9zcmMvbGliL2NvcmUvcGF5bWVudC9mb3JtL2NvbnZlcnRlcnMvcGhvbmUuY29udmVydGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFFM0MsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBR2pELE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUMvRCxPQUFPLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSxvQ0FBb0MsQ0FBQztBQUN4RSxPQUFPLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSxvQ0FBb0MsQ0FBQztBQUN4RSxPQUFPLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSxrQ0F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jvb2xlYW4uZmFsc2UpIHJldHVybiBbXTtcblxuICAgIGNvbnN0IG1pbkxlbmd0aCA9IDEwO1xuICAgIGNvbnN0IG1heExlbmd0aCA9IDE1O1xuXG4gICAgcmV0dXJuIHN1cGVyXG4gICAgICAuZ2V0VmFsaWRhdG9ycyhmaWVsZClcbiAgICAgIC5jb25jYXQoW1xuICAgICAgICBjb252ZXJ0ZWRSZXF1aXJlZFZhbGlkYXRvcigpLFxuICAgICAgICBwaG9uZVZhbGlkYXRvcigpLFxuICAgICAgICBtaW5MZW5ndGhWYWxpZGF0b3IobWluTGVuZ3RoKSxcbiAgICAgICAgbWF4TGVuZ3RoVmFsaWRhdG9yKG1heExlbmd0aCksXG4gICAgICBdKTtcbiAgfVxuXG4gIHByb3RlY3RlZCBjcmVhdGVDb250cm9sQ29uZmlnKGZpZWxkOiBGaWVsZCk6IFBob25lQ29udHJvbENvbmZpZyB7XG4gICAgY29uc3QgY29uZmlnID0gdGhpcy5jcmVhdGVEZWZhdWx0Q29udHJvbENvbmZpZyhQaG9uZUNvbnRyb2xDb25maWcsIGZpZWxkKTtcbiAgICBjb25maWcuaW5wdXRNb2RlID0gJ251bWVyaWMnO1xuXG4gICAgcmV0dXJuIGNvbmZpZztcbiAgfVxufVxuIl19
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5pdGlhbGl6ZS1yZXF1ZXN0LXBhcmFtcy5pbnRlcmZhY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9wYXltZW50LWNsaWVudC1jb3JlL3NyYy9saWIvY29yZS9wYXltZW50L2luaXRpYWxpemUvaW5pdGlhbGl6ZS1yZXF1ZXN0LXBhcmFtcy5pbnRlcmZhY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IFhwc0Jvb2xlYW4gfSBmcm9tICcuLi8uLi94cHMtYm9vbGVhbi5lbnVtJztcblxuZXhwb3J0IGludGVyZmFjZSBJbml0aWFsaXplUmVxdWVzdFBhcmFtcyB7XG4gIFtmaWVsZE5hbWU6IGB4cHNfJHtzdHJpbmd9YF06IHVua25vd247XG5cbiAgYWNjZXNzX3Rva2VuOiBzdHJpbmc7XG4gIHBpZDogc3RyaW5nO1xuICBjb3VudHJ5Pzogc3RyaW5nO1xuICByZXR1cm5Vcmw/OiBzdHJpbmc7XG4gIHBheW1lbnRXaXRoU2F2ZWRNZXRob2Q6IFhwc0Jvb2xlYW47XG4gIHNhdmVkX21ldGhvZF9pZD86IG51bWJlcjtcbiAgc2F2ZV9wYXltZW50X2FjY291bnRfb25seTogWHBzQm9vbGVhbjtcbiAgbW9iaWxlPzogWHBzQm9vbGVhbjtcbn1cbiJdfQ==
@@ -1,89 +0,0 @@
1
- import { Inject, Injectable } from '@angular/core';
2
- import { ResponseError } from '../../exceptions-handling/errors/response-error.class';
3
- import { initializeResponseFactoryToken, } from './response/initialize-response.token';
4
- import { UserBehaviourEventName } from '../../user-behaviour-analytics/user-behaviour-event-name.enum';
5
- import { userBehaviourEventTypes } from '../../user-behaviour-analytics/user-behaviour-event/user-behaviour-event-types';
6
- import * as i0 from "@angular/core";
7
- import * as i1 from "../xps-api/xps-api.service";
8
- import * as i2 from "../../settings/settings.service";
9
- import * as i3 from "../../country/country.service";
10
- import * as i4 from "../actions/next-action.service";
11
- import * as i5 from "../../errors-mapping/xps-response-errors-mapping.service";
12
- import * as i6 from "../../encrypt-credit-card/encrypt-credit-card.service";
13
- import * as i7 from "../actions/show-errors/show-errors.action.class";
14
- import * as i8 from "../../user-behaviour-analytics/user-behaviour-analytics.service";
15
- import * as i9 from "../payment-settings/payment-settings.service";
16
- export class InitializeService {
17
- constructor(responseFactory, xpsApiService, settingsService, countryService, nextActionService, xpsResponseErrorsMappingService, encryptCreditCardService, showErrorsActionCreator, userBehaviourAnalyticsService, paymentSettingsService) {
18
- this.responseFactory = responseFactory;
19
- this.xpsApiService = xpsApiService;
20
- this.settingsService = settingsService;
21
- this.countryService = countryService;
22
- this.nextActionService = nextActionService;
23
- this.xpsResponseErrorsMappingService = xpsResponseErrorsMappingService;
24
- this.encryptCreditCardService = encryptCreditCardService;
25
- this.showErrorsActionCreator = showErrorsActionCreator;
26
- this.userBehaviourAnalyticsService = userBehaviourAnalyticsService;
27
- this.paymentSettingsService = paymentSettingsService;
28
- }
29
- async request(config) {
30
- const paymentSettingsParams = this.paymentSettingsService.getPaymentSettingsParams(config);
31
- const requestParams = {
32
- access_token: this.settingsService.token,
33
- pid: String(config.paymentMethodId),
34
- country: this.countryService.getCountry(),
35
- returnUrl: config.returnUrl,
36
- paymentWithSavedMethod: config.paymentWithSavedMethod === true
37
- ? "1" /* XpsBoolean.true */
38
- : "0" /* XpsBoolean.false */,
39
- save_payment_account_only: config.savePaymentMethod
40
- ? "1" /* XpsBoolean.true */
41
- : "0" /* XpsBoolean.false */,
42
- ...paymentSettingsParams,
43
- };
44
- if (config.savedMethodId) {
45
- requestParams.saved_method_id = config.savedMethodId;
46
- }
47
- return this.xpsApiService
48
- .directPaymentRequest(requestParams)
49
- .then((xpsResponse) => {
50
- const response = this.xpsResponseErrorsMappingService.mapErrors(xpsResponse);
51
- const initializeResponse = this.responseFactory(response);
52
- if (!initializeResponse.paymentForm) {
53
- return initializeResponse;
54
- }
55
- this.setCreditCardEncryptKey(initializeResponse.paymentForm);
56
- this.userBehaviourAnalyticsService.fillUserSession(initializeResponse.paymentForm);
57
- if (initializeResponse.paymentForm?.errors?.length) {
58
- const logError = (error) => {
59
- this.userBehaviourAnalyticsService.send(UserBehaviourEventName.showErrorMessage, userBehaviourEventTypes.manual, { value: String(error.code), extraValue: error.message });
60
- };
61
- initializeResponse.paymentForm.errors.forEach(logError);
62
- this.nextActionService.emitFlowUpdates(this.showErrorsActionCreator.getActionData(initializeResponse.paymentForm.errors));
63
- }
64
- return initializeResponse;
65
- })
66
- .catch((error) => {
67
- throw new ResponseError(error.message);
68
- });
69
- }
70
- setCreditCardEncryptKey(paymentForm) {
71
- const publicKeyField = paymentForm.fields.find((field) => field.name === 'public_key');
72
- if (!publicKeyField) {
73
- return;
74
- }
75
- this.encryptCreditCardService.setPublicKey(atob(publicKeyField.value));
76
- }
77
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: InitializeService, deps: [{ token: initializeResponseFactoryToken }, { token: i1.XpsApiService }, { token: i2.SettingsService }, { token: i3.CountryService }, { token: i4.NextActionService }, { token: i5.XpsResponseErrorsMappingService }, { token: i6.EncryptCreditCardService }, { token: i7.ShowErrorsActionCreator }, { token: i8.UserBehaviourAnalyticsService }, { token: i9.PaymentSettingsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
78
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: InitializeService, providedIn: 'root' }); }
79
- }
80
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: InitializeService, decorators: [{
81
- type: Injectable,
82
- args: [{
83
- providedIn: 'root',
84
- }]
85
- }], ctorParameters: () => [{ type: undefined, decorators: [{
86
- type: Inject,
87
- args: [initializeResponseFactoryToken]
88
- }] }, { type: i1.XpsApiService }, { type: i2.SettingsService }, { type: i3.CountryService }, { type: i4.NextActionService }, { type: i5.XpsResponseErrorsMappingService }, { type: i6.EncryptCreditCardService }, { type: i7.ShowErrorsActionCreator }, { type: i8.UserBehaviourAnalyticsService }, { type: i9.PaymentSettingsService }] });
89
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5pdGlhbGl6ZS5zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZX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bnNlKTtcblxuICAgICAgICBpZiAoIWluaXRpYWxpemVSZXNwb25zZS5wYXltZW50Rm9ybSkge1xuICAgICAgICAgIHJldHVybiBpbml0aWFsaXplUmVzcG9uc2U7XG4gICAgICAgIH1cblxuICAgICAgICB0aGlzLnNldENyZWRpdENhcmRFbmNyeXB0S2V5KGluaXRpYWxpemVSZXNwb25zZS5wYXltZW50Rm9ybSk7XG4gICAgICAgIHRoaXMudXNlckJlaGF2aW91ckFuYWx5dGljc1NlcnZpY2UuZmlsbFVzZXJTZXNzaW9uKFxuICAgICAgICAgIGluaXRpYWxpemVSZXNwb25zZS5wYXltZW50Rm9ybVxuICAgICAgICApO1xuXG4gICAgICAgIGlmIChpbml0aWFsaXplUmVzcG9uc2UucGF5bWVudEZvcm0/LmVycm9ycz8ubGVuZ3RoKSB7XG4gICAgICAgICAgY29uc3QgbG9nRXJyb3IgPSAoZXJyb3I6IHsgY29kZTogbnVtYmVyOyBtZXNzYWdlOiBzdHJpbmcgfSk6IHZvaWQgPT4ge1xuICAgICAgICAgICAgdGhpcy51c2VyQmVoYXZpb3VyQW5hbHl0aWNzU2VydmljZS5zZW5kKFxuICAgICAgICAgICAgICBVc2VyQmVoYXZpb3VyRXZlbnROYW1lLnNob3dFcnJvck1lc3NhZ2UsXG4gICAgICAgICAgICAgIHVzZXJCZWhhdmlvdXJFdmVudFR5cGVzLm1hbnVhbCxcbiAgICAgICAgICAgICAgeyB2YWx1ZTogU3RyaW5nKGVycm9yLmNvZGUpLCBleHRyYVZhbHVlOiBlcnJvci5tZXNzYWdlIH1cbiAgICAgICAgICAgICk7XG4gICAgICAgICAgfTtcblxuICAgICAgICAgIGluaXRpYWxpemVSZXNwb25zZS5wYXltZW50Rm9ybS5lcnJvcnMuZm9yRWFjaChsb2dFcnJvcik7XG5cbiAgICAgICAgICB0aGlzLm5leHRBY3Rpb25TZXJ2aWNlLmVtaXRGbG93VXBkYXRlcyhcbiAgICAgICAgICAgIHRoaXMuc2hvd0Vycm9yc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