react-native-payengine 2.0.16 → 2.0.18-alpha.1

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 (155) hide show
  1. package/README.md +96 -65
  2. package/android/.gradle/checksums/checksums.lock +0 -0
  3. package/android/.gradle/checksums/md5-checksums.bin +0 -0
  4. package/android/.gradle/checksums/sha1-checksums.bin +0 -0
  5. package/android/build.gradle +2 -2
  6. package/android/src/main/java/com/reactnativepayengine/v2/RNPayEngineNative.kt +65 -3
  7. package/android/src/main/java/com/reactnativepayengine/v2/securefields/RNPEEvents.kt +1 -0
  8. package/android/src/main/java/com/reactnativepayengine/v2/securefields/bankaccount/RNBankAccountViewManager.kt +16 -3
  9. package/android/src/main/java/com/reactnativepayengine/v2/securefields/creditcard/RNPECreditCardViewManager.kt +15 -4
  10. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/KDataCollector.h +4 -25
  11. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/KountAnalyticsViewController.h +0 -20
  12. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/KountPrivate.h +61 -0
  13. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/PayEngineSDK-Swift.h +430 -133
  14. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Info.plist +0 -0
  15. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.abi.json +1848 -5121
  16. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +35 -117
  17. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.private.swiftinterface-e +35 -117
  18. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  19. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.swiftinterface +35 -117
  20. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.swiftinterface-e +35 -117
  21. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/PayEngineSDK +0 -0
  22. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/VGSCollectSDK_VGSCollectSDK.bundle/Info.plist +0 -0
  23. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/KDataCollector.h +4 -25
  24. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/KountAnalyticsViewController.h +0 -20
  25. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/KountPrivate.h +61 -0
  26. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/PayEngineSDK-Swift.h +860 -266
  27. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Info.plist +0 -0
  28. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +1848 -5121
  29. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +35 -117
  30. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface-e +35 -117
  31. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  32. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +35 -117
  33. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface-e +35 -117
  34. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +1848 -5121
  35. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +35 -117
  36. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface-e +35 -117
  37. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  38. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +35 -117
  39. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface-e +35 -117
  40. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/PayEngineSDK +0 -0
  41. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/VGSCollectSDK_VGSCollectSDK.bundle/Info.plist +0 -0
  42. package/ios/Sources/Classes/RNPEEventEmitter.swift +1 -1
  43. package/ios/Sources/Classes/RNPayEngineNative.swift +125 -64
  44. package/ios/Sources/Classes/SecureFields/RNPEEvents.swift +1 -0
  45. package/ios/Sources/Payengine.m +6 -0
  46. package/lib/commonjs/components/PayEngine.js +1 -1
  47. package/lib/commonjs/components/PayEngine.js.map +1 -1
  48. package/lib/commonjs/components/v2/ApplePay/PEApplePayButton.js +124 -0
  49. package/lib/commonjs/components/v2/ApplePay/PEApplePayButton.js.map +1 -1
  50. package/lib/commonjs/components/v2/ApplePay/PEApplePayInterfaces.js +78 -0
  51. package/lib/commonjs/components/v2/ApplePay/PEApplePayInterfaces.js.map +1 -1
  52. package/lib/commonjs/components/v2/GooglePay/PEGooglePayAddress.js.map +1 -1
  53. package/lib/commonjs/components/v2/GooglePay/PEGooglePayButton.js +53 -0
  54. package/lib/commonjs/components/v2/GooglePay/PEGooglePayButton.js.map +1 -1
  55. package/lib/commonjs/components/v2/PEPaymentRequest.js +121 -0
  56. package/lib/commonjs/components/v2/PEPaymentRequest.js.map +1 -1
  57. package/lib/commonjs/components/v2/PayEngineNative.js +182 -4
  58. package/lib/commonjs/components/v2/PayEngineNative.js.map +1 -1
  59. package/lib/commonjs/components/v2/PayEngineProvider.js +52 -0
  60. package/lib/commonjs/components/v2/PayEngineProvider.js.map +1 -1
  61. package/lib/commonjs/components/v2/SecureFields/BankAccountView.js +71 -0
  62. package/lib/commonjs/components/v2/SecureFields/BankAccountView.js.map +1 -1
  63. package/lib/commonjs/components/v2/SecureFields/CreditCardView.js +82 -0
  64. package/lib/commonjs/components/v2/SecureFields/CreditCardView.js.map +1 -1
  65. package/lib/commonjs/components/v2/SecureFields/IPEField.js.map +1 -1
  66. package/lib/commonjs/components/v2/SecureFields/ITokenizationData.js.map +1 -1
  67. package/lib/commonjs/components/v2/SecureFields/PEBankAccount.js.map +1 -1
  68. package/lib/commonjs/components/v2/SecureFields/PECard.js.map +1 -1
  69. package/lib/commonjs/components/v2/SecureFields/PEKeyboardType.js +20 -3
  70. package/lib/commonjs/components/v2/SecureFields/PEKeyboardType.js.map +1 -1
  71. package/lib/commonjs/index.js +17 -13
  72. package/lib/commonjs/index.js.map +1 -1
  73. package/lib/commonjs/interfaces/index.js +20 -0
  74. package/lib/commonjs/interfaces/index.js.map +1 -1
  75. package/lib/commonjs/utils/index.js +26 -0
  76. package/lib/commonjs/utils/index.js.map +1 -1
  77. package/lib/module/components/PayEngine.js +1 -1
  78. package/lib/module/components/PayEngine.js.map +1 -1
  79. package/lib/module/components/v2/ApplePay/PEApplePayButton.js +124 -0
  80. package/lib/module/components/v2/ApplePay/PEApplePayButton.js.map +1 -1
  81. package/lib/module/components/v2/ApplePay/PEApplePayInterfaces.js +75 -0
  82. package/lib/module/components/v2/ApplePay/PEApplePayInterfaces.js.map +1 -1
  83. package/lib/module/components/v2/GooglePay/PEGooglePayAddress.js.map +1 -1
  84. package/lib/module/components/v2/GooglePay/PEGooglePayButton.js +53 -0
  85. package/lib/module/components/v2/GooglePay/PEGooglePayButton.js.map +1 -1
  86. package/lib/module/components/v2/PEPaymentRequest.js +119 -0
  87. package/lib/module/components/v2/PEPaymentRequest.js.map +1 -1
  88. package/lib/module/components/v2/PayEngineNative.js +184 -5
  89. package/lib/module/components/v2/PayEngineNative.js.map +1 -1
  90. package/lib/module/components/v2/PayEngineProvider.js +51 -0
  91. package/lib/module/components/v2/PayEngineProvider.js.map +1 -1
  92. package/lib/module/components/v2/SecureFields/BankAccountView.js +71 -0
  93. package/lib/module/components/v2/SecureFields/BankAccountView.js.map +1 -1
  94. package/lib/module/components/v2/SecureFields/CreditCardView.js +82 -0
  95. package/lib/module/components/v2/SecureFields/CreditCardView.js.map +1 -1
  96. package/lib/module/components/v2/SecureFields/IPEField.js.map +1 -1
  97. package/lib/module/components/v2/SecureFields/ITokenizationData.js.map +1 -1
  98. package/lib/module/components/v2/SecureFields/PEBankAccount.js.map +1 -1
  99. package/lib/module/components/v2/SecureFields/PECard.js.map +1 -1
  100. package/lib/module/components/v2/SecureFields/PEKeyboardType.js +16 -1
  101. package/lib/module/components/v2/SecureFields/PEKeyboardType.js.map +1 -1
  102. package/lib/module/index.js +10 -5
  103. package/lib/module/index.js.map +1 -1
  104. package/lib/module/interfaces/index.js +19 -0
  105. package/lib/module/interfaces/index.js.map +1 -1
  106. package/lib/module/utils/index.js +27 -0
  107. package/lib/module/utils/index.js.map +1 -1
  108. package/lib/typescript/components/PayEngine.d.ts +1 -1
  109. package/lib/typescript/components/v2/ApplePay/PEApplePayButton.d.ts +217 -12
  110. package/lib/typescript/components/v2/ApplePay/PEApplePayInterfaces.d.ts +180 -1
  111. package/lib/typescript/components/v2/GooglePay/PEGooglePayAddress.d.ts +30 -0
  112. package/lib/typescript/components/v2/GooglePay/PEGooglePayButton.d.ts +99 -0
  113. package/lib/typescript/components/v2/PEPaymentRequest.d.ts +130 -9
  114. package/lib/typescript/components/v2/PayEngineNative.d.ts +165 -7
  115. package/lib/typescript/components/v2/PayEngineProvider.d.ts +51 -0
  116. package/lib/typescript/components/v2/SecureFields/BankAccountView.d.ts +103 -0
  117. package/lib/typescript/components/v2/SecureFields/CreditCardView.d.ts +114 -0
  118. package/lib/typescript/components/v2/SecureFields/IPEField.d.ts +49 -0
  119. package/lib/typescript/components/v2/SecureFields/ITokenizationData.d.ts +14 -0
  120. package/lib/typescript/components/v2/SecureFields/PEBankAccount.d.ts +36 -0
  121. package/lib/typescript/components/v2/SecureFields/PECard.d.ts +44 -0
  122. package/lib/typescript/components/v2/SecureFields/PEKeyboardType.d.ts +16 -1
  123. package/lib/typescript/index.d.ts +11 -5
  124. package/lib/typescript/interfaces/index.d.ts +35 -1
  125. package/lib/typescript/utils/index.d.ts +21 -0
  126. package/package.json +6 -3
  127. package/react-native-payengine.podspec +1 -1
  128. package/src/components/PayEngine.tsx +1 -1
  129. package/src/components/v2/ApplePay/PEApplePayButton.tsx +225 -12
  130. package/src/components/v2/ApplePay/PEApplePayInterfaces.ts +221 -8
  131. package/src/components/v2/GooglePay/PEGooglePayAddress.ts +39 -1
  132. package/src/components/v2/GooglePay/PEGooglePayButton.tsx +113 -9
  133. package/src/components/v2/PEPaymentRequest.ts +151 -13
  134. package/src/components/v2/PayEngineNative.tsx +196 -9
  135. package/src/components/v2/PayEngineProvider.tsx +52 -1
  136. package/src/components/v2/SecureFields/BankAccountView.tsx +108 -1
  137. package/src/components/v2/SecureFields/CreditCardView.tsx +118 -1
  138. package/src/components/v2/SecureFields/IPEField.ts +55 -0
  139. package/src/components/v2/SecureFields/ITokenizationData.ts +17 -2
  140. package/src/components/v2/SecureFields/PEBankAccount.ts +42 -0
  141. package/src/components/v2/SecureFields/PECard.ts +52 -0
  142. package/src/components/v2/SecureFields/PEKeyboardType.ts +18 -1
  143. package/src/index.tsx +23 -5
  144. package/src/interfaces/index.ts +40 -2
  145. package/src/utils/index.ts +21 -0
  146. package/android/.gradle/6.1.1/executionHistory/executionHistory.lock +0 -0
  147. package/android/.gradle/6.1.1/fileChanges/last-build.bin +0 -0
  148. package/android/.gradle/6.1.1/fileHashes/fileHashes.lock +0 -0
  149. package/android/.gradle/6.1.1/gc.properties +0 -0
  150. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/CustomWindow.h +0 -25
  151. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/UIControl+CustomControl.h +0 -33
  152. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/UIViewController+TouchControl.h +0 -27
  153. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/CustomWindow.h +0 -25
  154. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/UIControl+CustomControl.h +0 -33
  155. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/UIViewController+TouchControl.h +0 -27
@@ -1,63 +1,276 @@
1
+ /**
2
+ * A model representing a contact associated with Apple Pay.
3
+ *
4
+ * This interface defines the contact details that can be associated with an Apple Pay transaction,
5
+ * including personal and address information such as the contact's name, address, email, and phone number.
6
+ * The fields are optional, meaning not all fields need to be provided when creating an instance.
7
+ *
8
+ * ## Example Usage:
9
+ * ```ts
10
+ * const contact: PEApplePayContact = {
11
+ * givenName: 'John',
12
+ * familyName: 'Doe',
13
+ * addressLines: ['123 Main St', 'Suite 400'],
14
+ * locality: 'Anytown',
15
+ * administrativeArea: 'CA',
16
+ * postalCode: '12345',
17
+ * country: 'USA',
18
+ * countryCode: 'US',
19
+ * subAdministrativeArea: 'SubArea',
20
+ * subLocality: 'Locality',
21
+ * emailAddress: 'john.doe@example.com',
22
+ * phoneNumber: '+1234567890',
23
+ * };
24
+ * ```
25
+ *
26
+ * @category Apple Pay
27
+ */
1
28
  export interface PEApplePayContact {
29
+ /**
30
+ * The given (first) name of the contact.
31
+ *
32
+ * Example: "John"
33
+ */
2
34
  givenName?: string;
35
+
36
+ /**
37
+ * The family (last) name of the contact.
38
+ *
39
+ * Example: "Doe"
40
+ */
3
41
  familyName?: string;
42
+
43
+ /**
44
+ * The contact's address lines, typically representing street addresses.
45
+ *
46
+ * Example: ["123 Main St", "Suite 400"]
47
+ */
4
48
  addressLines?: string[];
49
+
50
+ /**
51
+ * The city or locality of the contact's address.
52
+ *
53
+ * Example: "Anytown"
54
+ */
5
55
  locality?: string;
56
+
57
+ /**
58
+ * The state, province, or administrative area of the contact's address.
59
+ *
60
+ * Example: "CA"
61
+ */
6
62
  administrativeArea?: string;
63
+
64
+ /**
65
+ * The postal code (ZIP code) of the contact's address.
66
+ *
67
+ * Example: "12345"
68
+ */
7
69
  postalCode?: string;
70
+
71
+ /**
72
+ * The full country name of the contact's address.
73
+ *
74
+ * Example: "USA"
75
+ */
8
76
  country?: string;
77
+
78
+ /**
79
+ * The ISO country code (e.g., "US" for the United States).
80
+ *
81
+ * Example: "US"
82
+ */
9
83
  countryCode?: string;
84
+
85
+ /**
86
+ * A more specific administrative area within the main administrative area.
87
+ *
88
+ * Example: "SubArea"
89
+ */
10
90
  subAdministrativeArea?: string;
91
+
92
+ /**
93
+ * A more specific locality within the main locality.
94
+ *
95
+ * Example: "Locality"
96
+ */
11
97
  subLocality?: string;
98
+
99
+ /**
100
+ * The contact's email address.
101
+ *
102
+ * Example: "john.doe@example.com"
103
+ */
12
104
  emailAddress?: string;
105
+
106
+ /**
107
+ * The contact's phone number.
108
+ *
109
+ * Example: "+1234567890"
110
+ */
13
111
  phoneNumber?: string;
14
112
  }
15
113
 
114
+
115
+ /**
116
+ * A model representing the selected Apple Pay payment method.
117
+ *
118
+ * This interface provides details about the payment method chosen by the user
119
+ * during an Apple Pay transaction. It includes the method's display name,
120
+ * payment network (e.g., Visa, MasterCard), and the type of payment method.
121
+ *
122
+ * ## Example Usage:
123
+ * ```ts
124
+ * const paymentMethod: PEApplePayPaymentMethod = {
125
+ * displayName: 'Visa 1234',
126
+ * network: 'Visa',
127
+ * type: 'credit', // or 'debit', depending on your enum or string literal type
128
+ * };
129
+ * ```
130
+ *
131
+ * @category Apple Pay
132
+ */
16
133
  export interface PEApplePayPaymentMethod {
134
+ /**
135
+ * A user-facing description of the payment method.
136
+ *
137
+ * This typically includes the card type and last few digits, e.g., "Visa 1234".
138
+ */
17
139
  displayName?: string;
140
+
141
+ /**
142
+ * The network associated with the payment method.
143
+ *
144
+ * Common examples include "Visa", "MasterCard", "Amex", etc.
145
+ */
18
146
  network?: string;
147
+
148
+ /**
149
+ * The type of payment method.
150
+ *
151
+ * This is a required field indicating whether the method is a credit card, debit card, etc.
152
+ */
19
153
  type: PEApplePayPaymentMethodType;
20
154
  }
21
155
 
156
+
157
+ /**
158
+ * Enum representing the different types of payment methods supported by Apple Pay.
159
+ * Each value corresponds to a specific payment method category.
160
+ *
161
+ * @category Apple Pay
162
+ */
22
163
  export enum PEApplePayPaymentMethodType {
164
+ /** Unknown payment method type. */
23
165
  unknown = 0,
166
+
167
+ /** Debit card payment method. */
24
168
  debit = 1,
169
+
170
+ /** Credit card payment method. */
25
171
  credit = 2,
172
+
173
+ /** Prepaid card payment method. */
26
174
  prepaid = 3,
175
+
176
+ /** Store card payment method. */
27
177
  store = 4,
178
+
179
+ /** Electronic money (e-money) payment method. */
28
180
  eMoney = 5
29
181
  }
30
182
 
183
+
184
+ /**
185
+ * Represents a shipping method available during Apple Pay checkout.
186
+ *
187
+ * Includes label, amount, and identifier.
188
+ *
189
+ * @category Apple Pay
190
+ */
31
191
  export interface PEApplePayShippingMethod {
192
+ /** Unique identifier for the shipping method. */
32
193
  identifier: string;
194
+
195
+ /** Cost associated with this shipping method. */
33
196
  amount: number;
197
+
198
+ /** Display label (e.g., "Express Delivery"). */
34
199
  label: string;
35
200
  }
36
201
 
202
+ /**
203
+ * Type representing the possible errors that can occur during the Apple Pay
204
+ * sheet process. This includes issues related to invalid or unserviceable
205
+ * shipping addresses.
206
+ *
207
+ * * @category Apple Pay
208
+ */
37
209
  export type PEApplePaySheetError =
38
210
  | {
39
- errorType: PEApplePaySheetErrorType.InvalidShippingAddress;
40
- field: PEApplePayInvalidShippingField;
41
- message?: string;
42
- }
211
+ /** The error occurs due to an invalid shipping address. */
212
+ errorType: PEApplePaySheetErrorType.InvalidShippingAddress;
213
+
214
+ /** The specific field in the shipping address that caused the error. */
215
+ field: PEApplePayInvalidShippingField;
216
+
217
+ /** An optional message providing more details about the error. */
218
+ message?: string;
219
+ }
43
220
  | {
44
- errorType:
45
- | PEApplePaySheetErrorType.UnserviceableShippingAddress
46
- message?: string;
47
- };
221
+ /** The error occurs due to an unserviceable shipping address. */
222
+ errorType: PEApplePaySheetErrorType.UnserviceableShippingAddress;
48
223
 
224
+ /** An optional message providing more details about the error. */
225
+ message?: string;
226
+ };
227
+
228
+ /**
229
+ * Enum representing the types of errors that can occur during the Apple Pay
230
+ * sheet process. These errors typically relate to issues with the shipping
231
+ * address provided by the user.
232
+ *
233
+ * @category Apple Pay
234
+ */
49
235
  export enum PEApplePaySheetErrorType {
236
+ /** The shipping address provided is invalid. */
50
237
  InvalidShippingAddress = 'InvalidShippingAddress',
238
+
239
+ /** The shipping address provided is unserviceable (e.g., the address cannot be delivered to). */
51
240
  UnserviceableShippingAddress = 'UnserviceableShippingAddress',
52
241
  }
53
242
 
243
+ /**
244
+ *
245
+ * Enum representing the fields of shipping address that may be invalid
246
+ * during Apple Pay transactions. These values can be used to identify
247
+ * which part of the shipping address is incorrect or missing.
248
+ *
249
+ * @category Apple Pay
250
+ */
54
251
  export enum PEApplePayInvalidShippingField {
252
+ /** The street address is invalid or missing. */
55
253
  Street = 'street',
254
+
255
+ /** The city is invalid or missing. */
56
256
  City = 'city',
257
+
258
+ /** The sub-administrative area (e.g., district) is invalid or missing. */
57
259
  SubAdministrativeArea = 'subAdministrativeArea',
260
+
261
+ /** The state or province is invalid or missing. */
58
262
  State = 'state',
263
+
264
+ /** The postal code is invalid or missing. */
59
265
  PostalCode = 'postalCode',
266
+
267
+ /** The country is invalid or missing. */
60
268
  Country = 'country',
269
+
270
+ /** The country code is invalid or missing. */
61
271
  CountryCode = 'countryCode',
272
+
273
+ /** The sub-locality (e.g., neighborhood) is invalid or missing. */
62
274
  SubLocality = 'subLocality',
63
275
  }
276
+
@@ -1,11 +1,49 @@
1
+ /**
2
+ * Represents a Google Pay address containing structured user information.
3
+ *
4
+ * This model holds address details returned from Google Pay, including
5
+ * name, street address lines, locality, country code, phone number, and postal code.
6
+ *
7
+ * ## Example Usage:
8
+ * ```ts
9
+ * const address: PEGooglePayAddress = {
10
+ * address1: "1600 Amphitheatre Parkway",
11
+ * administrativeArea: "CA",
12
+ * countryCode: "US",
13
+ * locality: "Mountain View",
14
+ * name: "John Doe",
15
+ * phoneNumber: "+1 123-456-7890",
16
+ * postalCode: "94043",
17
+ * };
18
+ * ```
19
+ *
20
+ * @category Google Pay
21
+ */
1
22
  export interface PEGooglePayAddress {
23
+ /** The first line of the street address (e.g., "123 Main St"). */
2
24
  address1?: string;
25
+
26
+ /** The second line of the street address (e.g., apartment, suite, or unit number). */
3
27
  address2?: string;
28
+
29
+ /** The third line of the street address (if applicable). */
4
30
  address3?: string;
31
+
32
+ /** The state, province, or region of the address. */
5
33
  administrativeArea?: string;
34
+
35
+ /** The two-letter country code in ISO 3166-1 alpha-2 format (e.g., "US", "CA"). */
6
36
  countryCode?: string;
37
+
38
+ /** The city or town of the address. */
7
39
  locality?: string;
40
+
41
+ /** The full name of the recipient. */
8
42
  name?: string;
43
+
44
+ /** The phone number associated with the address. */
9
45
  phoneNumber?: string;
46
+
47
+ /** The ZIP or postal code. */
10
48
  postalCode?: string;
11
- }
49
+ }
@@ -16,18 +16,122 @@ interface NativePEGooglePayViewProps extends ViewProps {
16
16
 
17
17
  const peEventEmitter = new NativeEventEmitter(RNPEEventEmitter);
18
18
 
19
+ /**
20
+ * Props for rendering the Google Pay payment button.
21
+ *
22
+ * This interface defines the configuration and callback handlers
23
+ * used when initiating a Google Pay transaction.
24
+ *
25
+ * @category Google Pay
26
+ */
19
27
  export interface PEGooglePayButtonProps extends ViewProps {
28
+ /**
29
+ * The payment request containing merchant details, amount, currency,
30
+ * and optional payment item breakdown.
31
+ *
32
+ * This object defines the core transaction that will be processed.
33
+ */
20
34
  paymentRequest: PEPaymentRequest;
21
- onTokenDidReturn?: (token: string, metadata?: any, billingAddress?: PEGooglePayAddress, shippingAddress?: PEGooglePayAddress) => void;
35
+
36
+ /**
37
+ * Callback triggered when a Google Pay token is successfully returned.
38
+ *
39
+ * @param token - The Google Pay payment token as a string.
40
+ * @param metadata - Additional transaction metadata (if available).
41
+ * @param billingAddress - The billing address provided by Google Pay (optional).
42
+ * @param shippingAddress - The shipping address provided by Google Pay (optional).
43
+ *
44
+ * Example usage:
45
+ * ```ts
46
+ * onTokenDidReturn: (token, metadata, billingAddress, shippingAddress) => {
47
+ * console.log("Token:", token);
48
+ * }
49
+ * ```
50
+ */
51
+ onTokenDidReturn?: (
52
+ token: string,
53
+ metadata?: any,
54
+ billingAddress?: PEGooglePayAddress,
55
+ shippingAddress?: PEGooglePayAddress
56
+ ) => void;
57
+
58
+ /**
59
+ * Callback triggered when the Google Pay sheet is dismissed
60
+ * without completing the payment.
61
+ *
62
+ * Useful for UI updates or restoring state.
63
+ */
22
64
  onPaymentSheetDismissed?: () => void;
23
- onPaymentFailed?: (error: Error) => void;
24
- }
25
65
 
26
- export interface PEGooglePayButtonMethods {
27
-
66
+ /**
67
+ * Callback triggered when a payment fails during processing.
68
+ *
69
+ * @param error - An error object describing the cause of the failure.
70
+ *
71
+ * Example:
72
+ * ```ts
73
+ * onPaymentFailed: (error) => {
74
+ * console.error("Payment failed:", error.message);
75
+ * }
76
+ * ```
77
+ */
78
+ onPaymentFailed?: (error: Error) => void;
28
79
  }
29
80
 
30
-
81
+ /**
82
+ * Interface for defining methods related to the Google Pay button.
83
+ *
84
+ * Currently empty, this interface serves as a placeholder for any
85
+ * platform-specific Google Pay button methods that may be added in the future.
86
+ *
87
+ * @category Google Pay
88
+ */
89
+ export interface PEGooglePayButtonMethods { }
90
+
91
+ /**
92
+ * A React Native component for rendering a Google Pay button.
93
+ *
94
+ * This button allows users to initiate a Google Pay transaction using the
95
+ * provided `paymentRequest`. The component communicates with native code
96
+ * and emits events through a shared event emitter (`peEventEmitter`) to
97
+ * notify the JavaScript layer about the payment result.
98
+ *
99
+ * ## Example Usage:
100
+ * ```tsx
101
+ * const paymentRequest = {
102
+ * merchantId: 'your-merchant-id',
103
+ * paymentAmount: 10.00,
104
+ * paymentItems: [
105
+ * { label: 'Test Item', amount: 10.00 }
106
+ * ],
107
+ * platformOptions: {
108
+ * billingAddressRequired: true,
109
+ * shippingAddressRequired: true,
110
+ * },
111
+ * };
112
+ *
113
+ * <PEGooglePayButton
114
+ * paymentRequest={paymentRequest}
115
+ * onPaymentFailed={(error) => {
116
+ * console.log("Payment failed", error);
117
+ * }}
118
+ * onPaymentSheetDismissed={() => {
119
+ * console.log("Payment sheet dismissed");
120
+ * }}
121
+ * onTokenDidReturn={(token, metadata, billingAddress, shippingAddress) => {
122
+ * console.log("Payment successful", token, metadata, billingAddress, shippingAddress);
123
+ * }}
124
+ * />
125
+ * ```
126
+ *
127
+ * ## Platform Support:
128
+ * - **Android only**: On iOS, this component renders a fallback message.
129
+ *
130
+ * @param props - See {@link PEGooglePayButtonProps}
131
+ * @returns A Google Pay button on Android or a fallback message on iOS.
132
+ *
133
+ * @category Google Pay
134
+ */
31
135
  export const PEGooglePayButton = React.forwardRef<
32
136
  PEGooglePayButtonMethods,
33
137
  PEGooglePayButtonProps
@@ -68,10 +172,10 @@ export const PEGooglePayButton = React.forwardRef<
68
172
  if (Platform.OS !== 'android') {
69
173
  return <Text>Google Pay is not supported on this platform</Text>
70
174
  }
71
-
175
+
72
176
  return (
73
- <RNPEGooglePayButton
74
- style={{ height: 32, width: '100%', ...(props.style as object) }}
177
+ <RNPEGooglePayButton
178
+ style={{ height: 32, width: '100%', ...(props.style as object) }}
75
179
  // amount={props.paymentRequest.paymentAmount}
76
180
  // merchantId={props.paymentRequest.merchantId}
77
181
  paymentRequest={JSON.stringify({
@@ -1,22 +1,62 @@
1
1
  import type { PEApplePayShippingMethod } from "./ApplePay/PEApplePayInterfaces";
2
2
 
3
- type RNPEPaymentOptions = RNPEGooglePayOptions | RNPEApplePayOptions;
3
+ /**
4
+ * A union type that represents platform-specific payment options.
5
+ *
6
+ * This can either be `RNPEGooglePayOptions` or `RNPEApplePayOptions`, depending
7
+ * on the platform.
8
+ *
9
+ */
10
+ export type RNPEPaymentOptions = RNPEGooglePayOptions | RNPEApplePayOptions;
4
11
 
12
+ /**
13
+ * A class representing a payment request containing all necessary transaction details.
14
+ *
15
+ * This includes merchant identifier, total payment amount, currency code,
16
+ * individual payment items, and optional platform-specific configurations
17
+ * such as Apple Pay or Google Pay options.
18
+ */
5
19
  export class PEPaymentRequest {
20
+ /**
21
+ * The unique identifier for the merchant initiating the transaction.
22
+ */
6
23
  merchantId: string;
24
+
25
+ /**
26
+ * The total amount to be charged for the transaction.
27
+ */
7
28
  paymentAmount: number;
29
+
30
+ /**
31
+ * The currency code used for the transaction. Defaults to `'USD'`.
32
+ */
8
33
  currencyCode?: 'USD' | 'CAD' = 'USD';
34
+
35
+ /**
36
+ * List of items representing the breakdown of the transaction.
37
+ */
9
38
  paymentItems?: PESummaryItem[] = [];
39
+
40
+ /**
41
+ * Platform-specific options for customizing the payment experience
42
+ * (e.g., Apple Pay or Google Pay settings).
43
+ */
10
44
  platformOptions?: RNPEPaymentOptions;
11
45
 
46
+ /**
47
+ * Constructs a new instance of [PEPaymentRequest].
48
+ *
49
+ * @param merchantId - The merchant's unique identifier.
50
+ * @param paymentAmount - The total transaction amount.
51
+ * @param currencyCode - The currency code (either `'USD'` or `'CAD'`).
52
+ * @param paymentItems - An array of individual summary items.
53
+ * @param platformOptions - Optional platform-specific payment configuration.
54
+ */
12
55
  constructor(
13
56
  merchantId: string,
14
57
  paymentAmount: number,
15
58
  currencyCode: 'USD' | 'CAD' = 'USD',
16
- paymentItems: {
17
- amount: number;
18
- label: string;
19
- }[] = [],
59
+ paymentItems: PESummaryItem[] = [],
20
60
  platformOptions?: RNPEPaymentOptions
21
61
  ) {
22
62
  this.merchantId = merchantId;
@@ -27,23 +67,67 @@ export class PEPaymentRequest {
27
67
  }
28
68
  }
29
69
 
70
+ /**
71
+ * Represents an individual item in a payment transaction.
72
+ *
73
+ * Each item includes a label and an associated amount.
74
+ *
75
+ */
30
76
  export interface PESummaryItem {
31
- amount: number;
77
+ /** A descriptive label for the payment item (e.g., "Item 1"). */
32
78
  label: string;
79
+
80
+ /** The monetary amount for this item. */
81
+ amount: number;
33
82
  }
34
83
 
84
+ /**
85
+ * Contact fields that can be requested from the user during Apple Pay transactions.
86
+ *
87
+ * These fields specify what customer information (e.g., name, email, address) is required.
88
+ *
89
+ * @category Apple Pay
90
+ */
35
91
  export enum RNPEContactField {
92
+ /** The customer's full name. */
36
93
  name = 'name',
94
+
95
+ /** The customer's postal address. */
37
96
  postalAddress = 'postalAddress',
97
+
98
+ /** The customer's email address. */
38
99
  emailAddress = 'emailAddress',
100
+
101
+ /** The customer's phone number. */
39
102
  phoneNumber = 'phoneNumber',
103
+
104
+ /** The phonetic spelling of the customer's name. */
40
105
  phoneticName = 'phoneticName',
41
106
  }
42
107
 
43
108
 
109
+ /**
110
+ * Options specific to Apple Pay payment flow.
111
+ *
112
+ * Includes configuration for required billing and shipping contact fields,
113
+ * as well as available shipping methods.
114
+ *
115
+ * @category Apple Pay
116
+ */
44
117
  export class RNPEApplePayOptions {
118
+ /**
119
+ * Contact fields required for billing (e.g., name, address).
120
+ */
45
121
  requiredBillingContactFields?: RNPEContactField[] = [];
122
+
123
+ /**
124
+ * Contact fields required for shipping (e.g., phone number, address).
125
+ */
46
126
  requiredShippingContactFields?: RNPEContactField[] = [];
127
+
128
+ /**
129
+ * List of available shipping methods shown to the user.
130
+ */
47
131
  shippingMethods?: PEApplePayShippingMethod[] = [];
48
132
 
49
133
  constructor(params: {
@@ -53,26 +137,80 @@ export class RNPEApplePayOptions {
53
137
  }) {
54
138
  this.requiredBillingContactFields = params.requiredBillingContactFields;
55
139
  this.requiredShippingContactFields = params.requiredShippingContactFields;
56
- this.shippingMethods = params.shippingMethods
140
+ this.shippingMethods = params.shippingMethods;
57
141
  }
58
142
  }
59
143
 
144
+ /**
145
+ * Represents the billing address parameters for Google Pay in React Native.
146
+ *
147
+ * Specifies the address format and whether a phone number is required.
148
+ *
149
+ * @category Google Pay
150
+ */
60
151
  export class RNPEGooglePayBillingAddressParameters {
61
- format: 'FULL' | 'MIN' = 'FULL'
62
- phoneNumberRequired: boolean = false
152
+ /**
153
+ * The format of the billing address.
154
+ *
155
+ * - `'FULL'`: Includes street, city, state, and postal code.
156
+ * - `'MIN'`: Minimal format with limited address details.
157
+ */
158
+ format: 'FULL' | 'MIN' = 'FULL';
159
+
160
+ /**
161
+ * Whether a phone number is required in the billing address.
162
+ */
163
+ phoneNumberRequired: boolean = false;
63
164
  }
64
165
 
166
+ /**
167
+ * Represents the shipping address parameters for Google Pay in React Native.
168
+ *
169
+ * Specifies the allowed countries and whether a phone number is required.
170
+ *
171
+ * @category Google Pay
172
+ */
65
173
  export class RNPEGooglePayShippingAddressParameters {
66
- allowedCountryCodes?: string[] = undefined
67
- phoneNumberRequired: boolean = false
174
+ /**
175
+ * A list of allowed country codes for shipping (e.g., `["US", "CA"]`).
176
+ */
177
+ allowedCountryCodes?: string[] = undefined;
178
+
179
+ /**
180
+ * Whether a phone number is required in the shipping address.
181
+ */
182
+ phoneNumberRequired: boolean = false;
68
183
  }
69
184
 
185
+ /**
186
+ * A class representing Google Pay-specific payment options for React Native.
187
+ *
188
+ * This includes flags and parameters for requiring billing and shipping addresses.
189
+ *
190
+ * @category Google Pay
191
+ */
70
192
  export class RNPEGooglePayOptions {
193
+ /** Whether a billing address is required for the transaction. */
71
194
  billingAddressRequired: boolean;
72
- billingAddressParameters?: any;
195
+
196
+ /** Additional parameters for billing address collection (platform-specific). */
197
+ billingAddressParameters?: RNPEGooglePayBillingAddressParameters;
198
+
199
+ /** Whether a shipping address is required for the transaction. */
73
200
  shippingAddressRequired: boolean;
74
- shippingAddressParameters?: any;
75
201
 
202
+ /** Additional parameters for shipping address collection (platform-specific). */
203
+ shippingAddressParameters?: RNPEGooglePayShippingAddressParameters;
204
+
205
+ /**
206
+ * Creates a new instance of `RNPEGooglePayOptions`.
207
+ *
208
+ * @param params - The configuration object for Google Pay options.
209
+ * @param params.billingAddressRequired - Whether billing address is required.
210
+ * @param params.shippingAddressRequired - Whether shipping address is required.
211
+ * @param params.billingAddressParameters - Optional parameters for billing address.
212
+ * @param params.shippingAddressParameters - Optional parameters for shipping address.
213
+ */
76
214
  constructor(params: {
77
215
  billingAddressRequired: boolean;
78
216
  shippingAddressRequired: boolean;