@internetarchive/donation-form 1.0.3-alpha-webdev7960.0 → 1.0.3-webdev-8122.0

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 (210) hide show
  1. package/LICENSE +661 -661
  2. package/README.md +115 -115
  3. package/dist/demo/braintree-endpoint-manager.js.map +1 -1
  4. package/dist/demo/demo-analytics-handler.js.map +1 -1
  5. package/dist/demo/submit-form-with.js.map +1 -1
  6. package/dist/index.js.map +1 -1
  7. package/dist/src/braintree-manager/braintree-interfaces.js.map +1 -1
  8. package/dist/src/braintree-manager/braintree-manager.js.map +1 -1
  9. package/dist/src/braintree-manager/payment-clients.js.map +1 -1
  10. package/dist/src/braintree-manager/payment-providers/apple-pay/apple-pay-interface.js.map +1 -1
  11. package/dist/src/braintree-manager/payment-providers/apple-pay/apple-pay-session-datasource-delegate.js.map +1 -1
  12. package/dist/src/braintree-manager/payment-providers/apple-pay/apple-pay-session-datasource-interface.js.map +1 -1
  13. package/dist/src/braintree-manager/payment-providers/apple-pay/apple-pay-session-datasource.js.map +1 -1
  14. package/dist/src/braintree-manager/payment-providers/apple-pay/apple-pay-session-manager.js.map +1 -1
  15. package/dist/src/braintree-manager/payment-providers/apple-pay/apple-pay.js.map +1 -1
  16. package/dist/src/braintree-manager/payment-providers/credit-card/credit-card-interface.js.map +1 -1
  17. package/dist/src/braintree-manager/payment-providers/credit-card/credit-card.js.map +1 -1
  18. package/dist/src/braintree-manager/payment-providers/credit-card/hosted-field-configuration.js.map +1 -1
  19. package/dist/src/braintree-manager/payment-providers/credit-card/hosted-field-container.js.map +1 -1
  20. package/dist/src/braintree-manager/payment-providers/google-pay-interface.js.map +1 -1
  21. package/dist/src/braintree-manager/payment-providers/google-pay.js.map +1 -1
  22. package/dist/src/braintree-manager/payment-providers/paypal/paypal-button-datasource.js.map +1 -1
  23. package/dist/src/braintree-manager/payment-providers/paypal/paypal-interface.js.map +1 -1
  24. package/dist/src/braintree-manager/payment-providers/paypal/paypal.js.map +1 -1
  25. package/dist/src/braintree-manager/payment-providers/venmo-interface.js.map +1 -1
  26. package/dist/src/braintree-manager/payment-providers/venmo.js.map +1 -1
  27. package/dist/src/braintree-manager/payment-providers-interface.js.map +1 -1
  28. package/dist/src/braintree-manager/payment-providers.js.map +1 -1
  29. package/dist/src/donation-form-controller.js +123 -123
  30. package/dist/src/donation-form-controller.js.map +1 -1
  31. package/dist/src/donation-form-error.js.map +1 -1
  32. package/dist/src/donation-form.js +107 -107
  33. package/dist/src/donation-form.js.map +1 -1
  34. package/dist/src/form-elements/badged-input.js +47 -47
  35. package/dist/src/form-elements/badged-input.js.map +1 -1
  36. package/dist/src/form-elements/contact-form/autocomplete-field-options.js.map +1 -1
  37. package/dist/src/form-elements/contact-form/contact-form.js +159 -157
  38. package/dist/src/form-elements/contact-form/contact-form.js.map +1 -1
  39. package/dist/src/form-elements/contact-form/countries.js.map +1 -1
  40. package/dist/src/form-elements/header/donation-form-header.js +14 -14
  41. package/dist/src/form-elements/header/donation-form-header.js.map +1 -1
  42. package/dist/src/form-elements/header/donation-summary.js +15 -15
  43. package/dist/src/form-elements/header/donation-summary.js.map +1 -1
  44. package/dist/src/form-elements/payment-selector.js +164 -164
  45. package/dist/src/form-elements/payment-selector.js.map +1 -1
  46. package/dist/src/form-elements/total-amount.js +16 -16
  47. package/dist/src/form-elements/total-amount.js.map +1 -1
  48. package/dist/src/modals/confirm-donation-modal-content.js +51 -51
  49. package/dist/src/modals/confirm-donation-modal-content.js.map +1 -1
  50. package/dist/src/modals/error-modal-content.js +22 -22
  51. package/dist/src/modals/error-modal-content.js.map +1 -1
  52. package/dist/src/modals/upsell-modal-content.js +182 -182
  53. package/dist/src/modals/upsell-modal-content.js.map +1 -1
  54. package/dist/src/payment-flow-handlers/donation-flow-modal-manager.js +20 -20
  55. package/dist/src/payment-flow-handlers/donation-flow-modal-manager.js.map +1 -1
  56. package/dist/src/payment-flow-handlers/handlers/applepay-flow-handler.js.map +1 -1
  57. package/dist/src/payment-flow-handlers/handlers/creditcard-flow-handler.js.map +1 -1
  58. package/dist/src/payment-flow-handlers/handlers/googlepay-flow-handler.js +2 -0
  59. package/dist/src/payment-flow-handlers/handlers/googlepay-flow-handler.js.map +1 -1
  60. package/dist/src/payment-flow-handlers/handlers/paypal-flow-handler.js +2 -0
  61. package/dist/src/payment-flow-handlers/handlers/paypal-flow-handler.js.map +1 -1
  62. package/dist/src/payment-flow-handlers/handlers/venmo-flow-handler.js.map +1 -1
  63. package/dist/src/payment-flow-handlers/handlers/venmo-restoration-state-handler.js.map +1 -1
  64. package/dist/src/payment-flow-handlers/payment-flow-handlers.js.map +1 -1
  65. package/dist/src/recaptcha-manager/recaptcha-manager.js.map +1 -1
  66. package/dist/src/util/promisedSleep.js.map +1 -1
  67. package/dist/test/helpers/fillInContactForm.js.map +1 -1
  68. package/dist/test/mocks/flow-handlers/individual-handlers/mock-applepay-flow-handler.js.map +1 -1
  69. package/dist/test/mocks/flow-handlers/individual-handlers/mock-creditcard-flow-handler.js.map +1 -1
  70. package/dist/test/mocks/flow-handlers/individual-handlers/mock-googlepay-flow-handler.js.map +1 -1
  71. package/dist/test/mocks/flow-handlers/individual-handlers/mock-paypal-flow-handler.js.map +1 -1
  72. package/dist/test/mocks/flow-handlers/individual-handlers/mock-venmo-flow-handler.js.map +1 -1
  73. package/dist/test/mocks/flow-handlers/mock-payment-flow-handlers.js.map +1 -1
  74. package/dist/test/mocks/mock-braintree-manager.js.map +1 -1
  75. package/dist/test/mocks/mock-donation-info.js.map +1 -1
  76. package/dist/test/mocks/mock-endpoint-manager.js.map +1 -1
  77. package/dist/test/mocks/mock-hosted-fields-config.js.map +1 -1
  78. package/dist/test/mocks/mock-hosted-fields-container.js.map +1 -1
  79. package/dist/test/mocks/mock-lazy-loader.js.map +1 -1
  80. package/dist/test/mocks/mock-modal-manager.js.map +1 -1
  81. package/dist/test/mocks/mock-payment-clients.js.map +1 -1
  82. package/dist/test/mocks/mock-paypal-button-renderer.js.map +1 -1
  83. package/dist/test/mocks/mock-recaptcha-manager.js.map +1 -1
  84. package/dist/test/mocks/models/mock-billing-info.js +2 -0
  85. package/dist/test/mocks/models/mock-billing-info.js.map +1 -1
  86. package/dist/test/mocks/models/mock-custom-fields.js.map +1 -1
  87. package/dist/test/mocks/models/mock-customer-info.js.map +1 -1
  88. package/dist/test/mocks/models/mock-donation-request.js.map +1 -1
  89. package/dist/test/mocks/models/mock-success-response.js.map +1 -1
  90. package/dist/test/mocks/payment-clients/mock-applepay-client.js.map +1 -1
  91. package/dist/test/mocks/payment-clients/mock-applepay-payment.js.map +1 -1
  92. package/dist/test/mocks/payment-clients/mock-applepay-paymentauthorizedevent.js.map +1 -1
  93. package/dist/test/mocks/payment-clients/mock-applepay-session.js.map +1 -1
  94. package/dist/test/mocks/payment-clients/mock-applepay-sessionmanager.js.map +1 -1
  95. package/dist/test/mocks/payment-clients/mock-applepay-validatemerchantevent.js.map +1 -1
  96. package/dist/test/mocks/payment-clients/mock-braintree-client.js.map +1 -1
  97. package/dist/test/mocks/payment-clients/mock-data-collector.js.map +1 -1
  98. package/dist/test/mocks/payment-clients/mock-googlepay-client.js.map +1 -1
  99. package/dist/test/mocks/payment-clients/mock-googlepay-library.js.map +1 -1
  100. package/dist/test/mocks/payment-clients/mock-grecaptcha.js.map +1 -1
  101. package/dist/test/mocks/payment-clients/mock-hostedfields-client.js.map +1 -1
  102. package/dist/test/mocks/payment-clients/mock-hostedfieldstateobject-generator.js.map +1 -1
  103. package/dist/test/mocks/payment-clients/mock-hostedfieldtokenizepayload.js.map +1 -1
  104. package/dist/test/mocks/payment-clients/mock-paypal-client.js.map +1 -1
  105. package/dist/test/mocks/payment-clients/mock-paypal-library.js.map +1 -1
  106. package/dist/test/mocks/payment-clients/mock-venmo-client.js.map +1 -1
  107. package/dist/test/mocks/payment-providers/individual-providers/mock-applepay-datasource-delegate.js.map +1 -1
  108. package/dist/test/mocks/payment-providers/individual-providers/mock-applepay-handler.js.map +1 -1
  109. package/dist/test/mocks/payment-providers/individual-providers/mock-creditcard-handler.js.map +1 -1
  110. package/dist/test/mocks/payment-providers/individual-providers/mock-googlepay-handler.js.map +1 -1
  111. package/dist/test/mocks/payment-providers/individual-providers/mock-paypal-button-datasource-delegate.js.map +1 -1
  112. package/dist/test/mocks/payment-providers/individual-providers/mock-paypal-button-datasource.js.map +1 -1
  113. package/dist/test/mocks/payment-providers/individual-providers/mock-paypal-handler.js.map +1 -1
  114. package/dist/test/mocks/payment-providers/individual-providers/mock-venmo-handler.js.map +1 -1
  115. package/dist/test/mocks/payment-providers/mock-payment-providers.js.map +1 -1
  116. package/dist/test/tests/braintree-manager.test.js.map +1 -1
  117. package/dist/test/tests/donation-form-controller.test.js +39 -39
  118. package/dist/test/tests/donation-form-controller.test.js.map +1 -1
  119. package/dist/test/tests/donation-form.test.js +4 -4
  120. package/dist/test/tests/donation-form.test.js.map +1 -1
  121. package/dist/test/tests/flow-handlers/donation-flow-modal-manager.test.js +16 -14
  122. package/dist/test/tests/flow-handlers/donation-flow-modal-manager.test.js.map +1 -1
  123. package/dist/test/tests/form-elements/donation-summary.test.js.map +1 -1
  124. package/dist/test/tests/form-elements/payment-selector.test.js.map +1 -1
  125. package/dist/test/tests/modals/error-modal-content.test.js +2 -2
  126. package/dist/test/tests/modals/error-modal-content.test.js.map +1 -1
  127. package/dist/test/tests/modals/upsell-modal-content.test.js +31 -31
  128. package/dist/test/tests/modals/upsell-modal-content.test.js.map +1 -1
  129. package/dist/test/tests/models/donation-payment-info.test.js.map +1 -1
  130. package/dist/test/tests/payment-clients.test.js.map +1 -1
  131. package/dist/test/tests/payment-providers/applepay-sessiondatasource.test.js.map +1 -1
  132. package/dist/test/tests/payment-providers/applepay-sessionmanager.test.js.map +1 -1
  133. package/dist/test/tests/payment-providers/applepay.test.js.map +1 -1
  134. package/dist/test/tests/payment-providers/creditcard.test.js.map +1 -1
  135. package/dist/test/tests/payment-providers/googlepay.test.js.map +1 -1
  136. package/dist/test/tests/payment-providers/payment-providers.test.js.map +1 -1
  137. package/dist/test/tests/payment-providers/paypal-button-datasource.test.js.map +1 -1
  138. package/dist/test/tests/payment-providers/paypal.test.js.map +1 -1
  139. package/dist/test/tests/payment-providers/venmo.test.js.map +1 -1
  140. package/dist/test/tests/recaptcha-manager.test.js.map +1 -1
  141. package/package.json +107 -107
  142. package/src/@types/analytics-handler/index.d.ts +8 -8
  143. package/src/@types/braintree-web/LICENSE +21 -21
  144. package/src/@types/braintree-web/index.d.ts +93 -93
  145. package/src/@types/braintree-web/modules/american-express.d.ts +50 -50
  146. package/src/@types/braintree-web/modules/apple-pay.d.ts +213 -213
  147. package/src/@types/braintree-web/modules/client.d.ts +103 -103
  148. package/src/@types/braintree-web/modules/core.d.ts +34 -34
  149. package/src/@types/braintree-web/modules/data-collector.d.ts +13 -13
  150. package/src/@types/braintree-web/modules/google-payment.d.ts +269 -269
  151. package/src/@types/braintree-web/modules/hosted-fields.d.ts +366 -366
  152. package/src/@types/braintree-web/modules/paypal-checkout.d.ts +262 -262
  153. package/src/@types/braintree-web/modules/paypal.d.ts +177 -177
  154. package/src/@types/braintree-web/modules/three-d-secure.d.ts +141 -141
  155. package/src/@types/braintree-web/modules/unionpay.d.ts +224 -224
  156. package/src/@types/braintree-web/modules/us-bank-account.d.ts +81 -81
  157. package/src/@types/braintree-web/modules/venmo.d.ts +110 -110
  158. package/src/@types/braintree-web/package.json +64 -64
  159. package/src/@types/paypal-checkout-components/LICENSE +21 -21
  160. package/src/@types/paypal-checkout-components/index.d.ts +67 -67
  161. package/src/@types/paypal-checkout-components/modules/button.d.ts +50 -50
  162. package/src/@types/paypal-checkout-components/modules/callback-data.d.ts +244 -244
  163. package/src/@types/paypal-checkout-components/modules/configuration.d.ts +114 -114
  164. package/src/@types/paypal-checkout-components/package.json +58 -58
  165. package/src/braintree-manager/braintree-interfaces.ts +172 -172
  166. package/src/braintree-manager/braintree-manager.ts +281 -281
  167. package/src/braintree-manager/payment-clients.ts +146 -146
  168. package/src/braintree-manager/payment-providers/apple-pay/apple-pay-interface.ts +13 -13
  169. package/src/braintree-manager/payment-providers/apple-pay/apple-pay-session-datasource-delegate.ts +8 -8
  170. package/src/braintree-manager/payment-providers/apple-pay/apple-pay-session-datasource-interface.ts +10 -10
  171. package/src/braintree-manager/payment-providers/apple-pay/apple-pay-session-datasource.ts +119 -119
  172. package/src/braintree-manager/payment-providers/apple-pay/apple-pay-session-manager.ts +21 -21
  173. package/src/braintree-manager/payment-providers/apple-pay/apple-pay.ts +97 -97
  174. package/src/braintree-manager/payment-providers/credit-card/credit-card-interface.ts +21 -21
  175. package/src/braintree-manager/payment-providers/credit-card/credit-card.ts +130 -130
  176. package/src/braintree-manager/payment-providers/credit-card/hosted-field-configuration.ts +19 -19
  177. package/src/braintree-manager/payment-providers/credit-card/hosted-field-container.ts +85 -85
  178. package/src/braintree-manager/payment-providers/google-pay-interface.ts +8 -8
  179. package/src/braintree-manager/payment-providers/google-pay.ts +59 -59
  180. package/src/braintree-manager/payment-providers/paypal/paypal-button-datasource.ts +218 -218
  181. package/src/braintree-manager/payment-providers/paypal/paypal-interface.ts +13 -13
  182. package/src/braintree-manager/payment-providers/paypal/paypal.ts +78 -78
  183. package/src/braintree-manager/payment-providers/venmo-interface.ts +8 -8
  184. package/src/braintree-manager/payment-providers/venmo.ts +67 -67
  185. package/src/braintree-manager/payment-providers-interface.ts +25 -25
  186. package/src/braintree-manager/payment-providers.ts +147 -147
  187. package/src/donation-form-controller.ts +623 -623
  188. package/src/donation-form-error.ts +6 -6
  189. package/src/donation-form.ts +576 -576
  190. package/src/form-elements/badged-input.ts +109 -109
  191. package/src/form-elements/contact-form/autocomplete-field-options.ts +63 -63
  192. package/src/form-elements/contact-form/contact-form.ts +436 -434
  193. package/src/form-elements/contact-form/countries.ts +252 -252
  194. package/src/form-elements/header/donation-form-header.ts +98 -98
  195. package/src/form-elements/header/donation-summary.ts +61 -61
  196. package/src/form-elements/payment-selector.ts +365 -365
  197. package/src/form-elements/total-amount.ts +46 -46
  198. package/src/modals/confirm-donation-modal-content.ts +168 -168
  199. package/src/modals/error-modal-content.ts +48 -48
  200. package/src/modals/upsell-modal-content.ts +284 -284
  201. package/src/payment-flow-handlers/donation-flow-modal-manager.ts +439 -439
  202. package/src/payment-flow-handlers/handlers/applepay-flow-handler.ts +109 -109
  203. package/src/payment-flow-handlers/handlers/creditcard-flow-handler.ts +232 -232
  204. package/src/payment-flow-handlers/handlers/googlepay-flow-handler.ts +113 -111
  205. package/src/payment-flow-handlers/handlers/paypal-flow-handler.ts +333 -331
  206. package/src/payment-flow-handlers/handlers/venmo-flow-handler.ts +119 -119
  207. package/src/payment-flow-handlers/handlers/venmo-restoration-state-handler.ts +127 -127
  208. package/src/payment-flow-handlers/payment-flow-handlers.ts +218 -218
  209. package/src/recaptcha-manager/recaptcha-manager.ts +123 -123
  210. package/src/util/promisedSleep.ts +3 -3
@@ -1,244 +1,244 @@
1
- export type LineItemKind = 'debit' | 'credit';
2
-
3
- export interface LineItem {
4
- /**
5
- * Number of units of the item purchased. This value must be a whole number and can't be negative or zero.
6
- */
7
- quantity: string;
8
-
9
- /**
10
- * Per-unit price of the item. Can include up to 2 decimal places. This value can't be negative or zero.
11
- */
12
- unitAmount: string;
13
-
14
- /**
15
- * Item name. Maximum 127 characters.
16
- */
17
- name: string;
18
-
19
- /**
20
- * Indicates whether the line item is a debit (sale) or credit (refund) to the customer. Accepted values: `debit` and `credit`.
21
- */
22
- kind: LineItemKind;
23
-
24
- /**
25
- * Per-unit tax price of the item. Can include up to 2 decimal places. This value can't be negative or zero.
26
- */
27
- unitTaxAmount: string | undefined;
28
-
29
- /**
30
- * Item description. Maximum 127 characters.
31
- */
32
- description: string | undefined;
33
-
34
- /**
35
- * Product or UPC code for the item. Maximum 127 characters.
36
- */
37
- productCode: string | undefined;
38
-
39
- /**
40
- * The URL to product information.
41
- */
42
- url: string | undefined;
43
- }
44
-
45
- export type ShippingOptionType = 'SHIPPING' | 'PICKUP';
46
-
47
- export interface CurrencyAmount {
48
- /**
49
- * The three-character ISO-4217 currency code. PayPal does not support all currencies.
50
- */
51
- currency: string;
52
-
53
- /**
54
- * The amount the shipping option will cost. Includes the specified number of digits after
55
- * decimal separator for the ISO-4217 currency code.
56
- */
57
- value: string;
58
- }
59
-
60
- export interface ShippingOption {
61
- /**
62
- * A unique ID that identifies a payer-selected shipping option.
63
- */
64
- id: string;
65
-
66
- /**
67
- * A description that the payer sees, which helps them choose an appropriate shipping option.
68
- * For example, `Free Shipping`, `USPS Priority Shipping`, `Expédition prioritaire USPS`,
69
- * or `USPS yōuxiān fā huò`. Localize this description to the payer's locale.
70
- */
71
- label: string;
72
-
73
- /**
74
- * If `selected = true` is specified as part of the API request it represents the shipping
75
- * option that the payee/merchant expects to be pre-selected for the payer when they first view
76
- * the shipping options within the PayPal checkout experience. As part of the response if a
77
- * shipping option has `selected = true` it represents the shipping option that the payer
78
- * selected during the course of checkout with PayPal. Only 1 `shippingOption` can be set
79
- * to `selected = true`.
80
- */
81
- selected: boolean;
82
-
83
- /**
84
- * The method by which the payer wants to get their items.
85
- */
86
- type: ShippingOptionType;
87
-
88
- /**
89
- * The shipping cost for the selected option.
90
- */
91
- amount: CurrencyAmount;
92
- }
93
-
94
- export interface Address {
95
- /**
96
- * Street number and name.
97
- */
98
- line1: string;
99
-
100
- /**
101
- * Extended address.
102
- */
103
- line2?: string;
104
-
105
- /**
106
- * City or locality.
107
- */
108
- city: string;
109
-
110
- /**
111
- * State or region.
112
- */
113
- state: string;
114
-
115
- /**
116
- * Postal code.
117
- */
118
- postalCode: string;
119
-
120
- /**
121
- * 2 character country code (e.g. US).
122
- */
123
- countryCode: string;
124
-
125
- /**
126
- * Phone number.
127
- */
128
- phone?: string;
129
-
130
- /**
131
- * Recipient of postage.
132
- */
133
- recipientName?: string;
134
- }
135
-
136
- export interface CreditFinancingOptions {
137
- /**
138
- * This is the estimated total payment amount including interest and fees the user will pay during the lifetime of the loan.
139
- */
140
- totalCost: CurrencyAmount;
141
-
142
- /**
143
- * Length of financing terms in months.
144
- */
145
- term: number;
146
-
147
- /**
148
- * This is the estimated amount per month that the customer will need to pay including fees and interest.
149
- */
150
- monthlyPayment: CurrencyAmount;
151
-
152
- /**
153
- * Estimated interest or fees amount the payer will have to pay during the lifetime of the loan.
154
- */
155
- totalInterest: CurrencyAmount;
156
-
157
- /**
158
- * Status of whether the customer ultimately was approved for and chose to make the payment using the approved installment credit.
159
- */
160
- payerAcceptance: boolean;
161
-
162
- /**
163
- * Indicates whether the cart amount is editable after payer's acceptance on PayPal side.
164
- */
165
- cartAmountImmutable: boolean;
166
- }
167
-
168
- export interface TokenizePayloadDetails {
169
- email: string;
170
- payerId: string;
171
- firstName: string;
172
- lastName: string;
173
- countryCode?: string;
174
- phone?: string;
175
-
176
- /**
177
- * User's shipping address details, only available if shipping address is enabled.
178
- */
179
- shippingAddress?: Address;
180
-
181
- /**
182
- * User's billing address details.
183
- */
184
- billingAddress?: Address;
185
-
186
- /**
187
- * This property will only be present when the customer pays with PayPal Credit.
188
- */
189
- creditFinancingOffered?: CreditFinancingOptions;
190
- }
191
-
192
- export interface TokenizePayload {
193
- /**
194
- * The payment method nonce.
195
- */
196
- nonce: string;
197
-
198
- /**
199
- * The payment method type, always `PayPalAccount`.
200
- */
201
- type: string;
202
-
203
- /**
204
- * Additional PayPal account details.
205
- */
206
- details: TokenizePayloadDetails;
207
- }
208
-
209
- export type FlowType = 'checkout' | 'vault';
210
-
211
- export type Intent = 'authorize' | 'order' | 'capture';
212
-
213
- export interface AuthorizationData {
214
- payerId: string;
215
- paymentId?: string;
216
- billingToken?: string;
217
- vault?: boolean;
218
- }
219
-
220
- export interface CancellationData {
221
- billingID: string;
222
- button_version: string;
223
- cancelUrl: string;
224
- intent: string;
225
- paymentID: string;
226
- paymentToken: string;
227
- }
228
-
229
- export interface AuthorizationTokenizePayload {
230
- /**
231
- * The payment method nonce.
232
- */
233
- nonce: string;
234
-
235
- /**
236
- * The payment method type, always `PayPalAccount`.
237
- */
238
- type: string;
239
-
240
- /**
241
- * Additional PayPal account details.
242
- */
243
- details: TokenizePayloadDetails;
244
- }
1
+ export type LineItemKind = 'debit' | 'credit';
2
+
3
+ export interface LineItem {
4
+ /**
5
+ * Number of units of the item purchased. This value must be a whole number and can't be negative or zero.
6
+ */
7
+ quantity: string;
8
+
9
+ /**
10
+ * Per-unit price of the item. Can include up to 2 decimal places. This value can't be negative or zero.
11
+ */
12
+ unitAmount: string;
13
+
14
+ /**
15
+ * Item name. Maximum 127 characters.
16
+ */
17
+ name: string;
18
+
19
+ /**
20
+ * Indicates whether the line item is a debit (sale) or credit (refund) to the customer. Accepted values: `debit` and `credit`.
21
+ */
22
+ kind: LineItemKind;
23
+
24
+ /**
25
+ * Per-unit tax price of the item. Can include up to 2 decimal places. This value can't be negative or zero.
26
+ */
27
+ unitTaxAmount: string | undefined;
28
+
29
+ /**
30
+ * Item description. Maximum 127 characters.
31
+ */
32
+ description: string | undefined;
33
+
34
+ /**
35
+ * Product or UPC code for the item. Maximum 127 characters.
36
+ */
37
+ productCode: string | undefined;
38
+
39
+ /**
40
+ * The URL to product information.
41
+ */
42
+ url: string | undefined;
43
+ }
44
+
45
+ export type ShippingOptionType = 'SHIPPING' | 'PICKUP';
46
+
47
+ export interface CurrencyAmount {
48
+ /**
49
+ * The three-character ISO-4217 currency code. PayPal does not support all currencies.
50
+ */
51
+ currency: string;
52
+
53
+ /**
54
+ * The amount the shipping option will cost. Includes the specified number of digits after
55
+ * decimal separator for the ISO-4217 currency code.
56
+ */
57
+ value: string;
58
+ }
59
+
60
+ export interface ShippingOption {
61
+ /**
62
+ * A unique ID that identifies a payer-selected shipping option.
63
+ */
64
+ id: string;
65
+
66
+ /**
67
+ * A description that the payer sees, which helps them choose an appropriate shipping option.
68
+ * For example, `Free Shipping`, `USPS Priority Shipping`, `Expédition prioritaire USPS`,
69
+ * or `USPS yōuxiān fā huò`. Localize this description to the payer's locale.
70
+ */
71
+ label: string;
72
+
73
+ /**
74
+ * If `selected = true` is specified as part of the API request it represents the shipping
75
+ * option that the payee/merchant expects to be pre-selected for the payer when they first view
76
+ * the shipping options within the PayPal checkout experience. As part of the response if a
77
+ * shipping option has `selected = true` it represents the shipping option that the payer
78
+ * selected during the course of checkout with PayPal. Only 1 `shippingOption` can be set
79
+ * to `selected = true`.
80
+ */
81
+ selected: boolean;
82
+
83
+ /**
84
+ * The method by which the payer wants to get their items.
85
+ */
86
+ type: ShippingOptionType;
87
+
88
+ /**
89
+ * The shipping cost for the selected option.
90
+ */
91
+ amount: CurrencyAmount;
92
+ }
93
+
94
+ export interface Address {
95
+ /**
96
+ * Street number and name.
97
+ */
98
+ line1: string;
99
+
100
+ /**
101
+ * Extended address.
102
+ */
103
+ line2?: string;
104
+
105
+ /**
106
+ * City or locality.
107
+ */
108
+ city: string;
109
+
110
+ /**
111
+ * State or region.
112
+ */
113
+ state: string;
114
+
115
+ /**
116
+ * Postal code.
117
+ */
118
+ postalCode: string;
119
+
120
+ /**
121
+ * 2 character country code (e.g. US).
122
+ */
123
+ countryCode: string;
124
+
125
+ /**
126
+ * Phone number.
127
+ */
128
+ phone?: string;
129
+
130
+ /**
131
+ * Recipient of postage.
132
+ */
133
+ recipientName?: string;
134
+ }
135
+
136
+ export interface CreditFinancingOptions {
137
+ /**
138
+ * This is the estimated total payment amount including interest and fees the user will pay during the lifetime of the loan.
139
+ */
140
+ totalCost: CurrencyAmount;
141
+
142
+ /**
143
+ * Length of financing terms in months.
144
+ */
145
+ term: number;
146
+
147
+ /**
148
+ * This is the estimated amount per month that the customer will need to pay including fees and interest.
149
+ */
150
+ monthlyPayment: CurrencyAmount;
151
+
152
+ /**
153
+ * Estimated interest or fees amount the payer will have to pay during the lifetime of the loan.
154
+ */
155
+ totalInterest: CurrencyAmount;
156
+
157
+ /**
158
+ * Status of whether the customer ultimately was approved for and chose to make the payment using the approved installment credit.
159
+ */
160
+ payerAcceptance: boolean;
161
+
162
+ /**
163
+ * Indicates whether the cart amount is editable after payer's acceptance on PayPal side.
164
+ */
165
+ cartAmountImmutable: boolean;
166
+ }
167
+
168
+ export interface TokenizePayloadDetails {
169
+ email: string;
170
+ payerId: string;
171
+ firstName: string;
172
+ lastName: string;
173
+ countryCode?: string;
174
+ phone?: string;
175
+
176
+ /**
177
+ * User's shipping address details, only available if shipping address is enabled.
178
+ */
179
+ shippingAddress?: Address;
180
+
181
+ /**
182
+ * User's billing address details.
183
+ */
184
+ billingAddress?: Address;
185
+
186
+ /**
187
+ * This property will only be present when the customer pays with PayPal Credit.
188
+ */
189
+ creditFinancingOffered?: CreditFinancingOptions;
190
+ }
191
+
192
+ export interface TokenizePayload {
193
+ /**
194
+ * The payment method nonce.
195
+ */
196
+ nonce: string;
197
+
198
+ /**
199
+ * The payment method type, always `PayPalAccount`.
200
+ */
201
+ type: string;
202
+
203
+ /**
204
+ * Additional PayPal account details.
205
+ */
206
+ details: TokenizePayloadDetails;
207
+ }
208
+
209
+ export type FlowType = 'checkout' | 'vault';
210
+
211
+ export type Intent = 'authorize' | 'order' | 'capture';
212
+
213
+ export interface AuthorizationData {
214
+ payerId: string;
215
+ paymentId?: string;
216
+ billingToken?: string;
217
+ vault?: boolean;
218
+ }
219
+
220
+ export interface CancellationData {
221
+ billingID: string;
222
+ button_version: string;
223
+ cancelUrl: string;
224
+ intent: string;
225
+ paymentID: string;
226
+ paymentToken: string;
227
+ }
228
+
229
+ export interface AuthorizationTokenizePayload {
230
+ /**
231
+ * The payment method nonce.
232
+ */
233
+ nonce: string;
234
+
235
+ /**
236
+ * The payment method type, always `PayPalAccount`.
237
+ */
238
+ type: string;
239
+
240
+ /**
241
+ * Additional PayPal account details.
242
+ */
243
+ details: TokenizePayloadDetails;
244
+ }