react-native-payengine 2.0.11 → 2.0.13

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 (184) hide show
  1. package/README.md +137 -0
  2. package/android/.gradle/6.1.1/executionHistory/executionHistory.lock +0 -0
  3. package/android/.gradle/6.1.1/fileHashes/fileHashes.lock +0 -0
  4. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  5. package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
  6. package/android/.gradle/checksums/checksums.lock +0 -0
  7. package/android/.gradle/checksums/md5-checksums.bin +0 -0
  8. package/android/.gradle/checksums/sha1-checksums.bin +0 -0
  9. package/android/.idea/gradle.xml +2 -2
  10. package/android/.idea/jarRepositories.xml +0 -5
  11. package/android/.idea/libraries/Gradle__android_arch_core_common_1_0_0.xml +11 -0
  12. package/android/.idea/libraries/Gradle__android_arch_lifecycle_common_1_0_0.xml +11 -0
  13. package/android/.idea/libraries/Gradle__android_arch_lifecycle_runtime_1_0_0_aar.xml +13 -0
  14. package/android/.idea/libraries/Gradle__androidx_annotation_annotation_1_1_0.xml +13 -0
  15. package/android/.idea/libraries/Gradle__androidx_appcompat_appcompat_1_0_2_aar.xml +16 -0
  16. package/android/.idea/libraries/Gradle__androidx_arch_core_core_common_2_0_0.xml +11 -0
  17. package/android/.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_0_0_aar.xml +13 -0
  18. package/android/.idea/libraries/Gradle__androidx_asynclayoutinflater_asynclayoutinflater_1_0_0_aar.xml +13 -0
  19. package/android/.idea/libraries/Gradle__androidx_autofill_autofill_1_1_0_aar.xml +16 -0
  20. package/android/.idea/libraries/Gradle__androidx_collection_collection_1_0_0.xml +11 -0
  21. package/android/.idea/libraries/Gradle__androidx_coordinatorlayout_coordinatorlayout_1_0_0_aar.xml +16 -0
  22. package/android/.idea/libraries/Gradle__androidx_core_core_1_1_0_aar.xml +16 -0
  23. package/android/.idea/libraries/Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml +13 -0
  24. package/android/.idea/libraries/Gradle__androidx_customview_customview_1_0_0_aar.xml +13 -0
  25. package/android/.idea/libraries/Gradle__androidx_documentfile_documentfile_1_0_0_aar.xml +13 -0
  26. package/android/.idea/libraries/Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml +16 -0
  27. package/android/.idea/libraries/Gradle__androidx_fragment_fragment_1_0_0_aar.xml +16 -0
  28. package/android/.idea/libraries/Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml +13 -0
  29. package/android/.idea/libraries/Gradle__androidx_legacy_legacy_support_core_ui_1_0_0_aar.xml +13 -0
  30. package/android/.idea/libraries/Gradle__androidx_legacy_legacy_support_core_utils_1_0_0_aar.xml +13 -0
  31. package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_0_0.xml +11 -0
  32. package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_2_0_0_aar.xml +13 -0
  33. package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_0_0_aar.xml +13 -0
  34. package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_0_0_aar.xml +13 -0
  35. package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_0_0_aar.xml +13 -0
  36. package/android/.idea/libraries/Gradle__androidx_loader_loader_1_0_0_aar.xml +13 -0
  37. package/android/.idea/libraries/Gradle__androidx_localbroadcastmanager_localbroadcastmanager_1_0_0_aar.xml +13 -0
  38. package/android/.idea/libraries/Gradle__androidx_print_print_1_0_0_aar.xml +16 -0
  39. package/android/.idea/libraries/Gradle__androidx_slidingpanelayout_slidingpanelayout_1_0_0_aar.xml +13 -0
  40. package/android/.idea/libraries/Gradle__androidx_swiperefreshlayout_swiperefreshlayout_1_0_0_aar.xml +16 -0
  41. package/android/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_1_0_1_aar.xml +13 -0
  42. package/android/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_animated_1_0_0_aar.xml +13 -0
  43. package/android/.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_0_aar.xml +13 -0
  44. package/android/.idea/libraries/Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml +13 -0
  45. package/android/.idea/libraries/Gradle__com_android_support_support_annotations_26_1_0.xml +13 -0
  46. package/android/.idea/libraries/Gradle__com_android_support_support_compat_26_1_0_aar.xml +13 -0
  47. package/android/.idea/libraries/Gradle__com_android_support_support_core_ui_26_1_0_aar.xml +13 -0
  48. package/android/.idea/libraries/Gradle__com_android_support_support_core_utils_26_1_0_aar.xml +13 -0
  49. package/android/.idea/libraries/Gradle__com_android_support_support_fragment_26_1_0_aar.xml +13 -0
  50. package/android/.idea/libraries/Gradle__com_android_support_support_media_compat_26_1_0_aar.xml +13 -0
  51. package/android/.idea/libraries/Gradle__com_android_support_support_v4_26_1_0_aar.xml +13 -0
  52. package/android/.idea/libraries/Gradle__com_facebook_fbjni_fbjni_java_only_0_2_2.xml +13 -0
  53. package/android/.idea/libraries/Gradle__com_facebook_fresco_drawee_2_5_0_aar.xml +15 -0
  54. package/android/.idea/libraries/Gradle__com_facebook_fresco_fbcore_2_5_0_aar.xml +18 -0
  55. package/android/.idea/libraries/Gradle__com_facebook_fresco_fresco_2_5_0_aar.xml +18 -0
  56. package/android/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_2_5_0_aar.xml +18 -0
  57. package/android/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_base_2_5_0_aar.xml +18 -0
  58. package/android/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_native_2_5_0_aar.xml +15 -0
  59. package/android/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_okhttp3_2_5_0_aar.xml +15 -0
  60. package/android/.idea/libraries/Gradle__com_facebook_fresco_memory_type_ashmem_2_5_0_aar.xml +15 -0
  61. package/android/.idea/libraries/Gradle__com_facebook_fresco_memory_type_java_2_5_0_aar.xml +15 -0
  62. package/android/.idea/libraries/Gradle__com_facebook_fresco_memory_type_native_2_5_0_aar.xml +15 -0
  63. package/android/.idea/libraries/Gradle__com_facebook_fresco_nativeimagefilters_2_5_0_aar.xml +15 -0
  64. package/android/.idea/libraries/Gradle__com_facebook_fresco_nativeimagetranscoder_2_5_0_aar.xml +15 -0
  65. package/android/.idea/libraries/Gradle__com_facebook_fresco_ui_common_2_5_0_aar.xml +15 -0
  66. package/android/.idea/libraries/Gradle__com_facebook_infer_annotation_infer_annotation_0_18_0.xml +13 -0
  67. package/android/.idea/libraries/Gradle__com_facebook_react_react_native_0_68_2_aar.xml +16 -0
  68. package/android/.idea/libraries/Gradle__com_facebook_soloader_annotation_0_10_3.xml +13 -0
  69. package/android/.idea/libraries/Gradle__com_facebook_soloader_nativeloader_0_10_3.xml +13 -0
  70. package/android/.idea/libraries/Gradle__com_facebook_soloader_soloader_0_10_3_aar.xml +15 -0
  71. package/android/.idea/libraries/Gradle__com_facebook_yoga_proguard_annotations_1_19_0.xml +13 -0
  72. package/android/.idea/libraries/Gradle__com_google_android_gms_play_services_base_15_0_1_aar.xml +11 -0
  73. package/android/.idea/libraries/Gradle__com_google_android_gms_play_services_basement_15_0_1_aar.xml +11 -0
  74. package/android/.idea/libraries/Gradle__com_google_android_gms_play_services_identity_15_0_1_aar.xml +11 -0
  75. package/android/.idea/libraries/Gradle__com_google_android_gms_play_services_maps_15_0_1_aar.xml +11 -0
  76. package/android/.idea/libraries/Gradle__com_google_android_gms_play_services_tasks_15_0_1_aar.xml +11 -0
  77. package/android/.idea/libraries/Gradle__com_google_android_gms_play_services_wallet_16_0_0_aar.xml +11 -0
  78. package/android/.idea/libraries/Gradle__com_google_code_findbugs_jsr305_3_0_2.xml +13 -0
  79. package/android/.idea/libraries/Gradle__com_squareup_okhttp3_okhttp_4_9_2.xml +13 -0
  80. package/android/.idea/libraries/Gradle__com_squareup_okhttp3_okhttp_urlconnection_4_9_2.xml +13 -0
  81. package/android/.idea/libraries/Gradle__com_squareup_okio_okio_2_9_0.xml +13 -0
  82. package/android/.idea/libraries/Gradle__javax_inject_javax_inject_1.xml +13 -0
  83. package/android/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml +13 -0
  84. package/android/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_annotations_jvm_1_3_72.xml +13 -0
  85. package/android/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_4_10.xml +13 -0
  86. package/android/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_common_1_4_10.xml +13 -0
  87. package/android/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_jdk7_1_4_10.xml +13 -0
  88. package/android/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_jdk8_1_4_10.xml +13 -0
  89. package/android/.idea/misc.xml +1 -2
  90. package/android/.idea/modules/android.androidTest.iml +114 -0
  91. package/android/.idea/modules/android.iml +40 -0
  92. package/android/.idea/modules/android.main.iml +122 -0
  93. package/android/.idea/modules/android.unitTest.iml +109 -0
  94. package/android/.idea/modules.xml +11 -0
  95. package/android/build.gradle +16 -12
  96. package/android/local.properties +2 -2
  97. package/android/src/main/java/com/reactnativepayengine/v2/features/googlepay/RNPEGooglePayButton.kt +2 -3
  98. package/android/src/main/java/com/reactnativepayengine/v2/features/googlepay/RNPEPaymentRequest.kt +1 -1
  99. package/android/src/main/java/com/reactnativepayengine/v2/securefields/bankaccount/RNPEBankAccountView.kt +1 -1
  100. package/android/src/main/java/com/reactnativepayengine/v2/securefields/creditcard/RNPECreditCardView.kt +1 -1
  101. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/PayEngineSDK-Swift.h +19 -3
  102. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Info.plist +0 -0
  103. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.abi.json +1367 -3704
  104. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +68 -59
  105. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.private.swiftinterface-e +68 -59
  106. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  107. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.swiftinterface +68 -59
  108. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.swiftinterface-e +68 -59
  109. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/PayEngineSDK +0 -0
  110. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/VGSCollectSDK_VGSCollectSDK.bundle/Assets.car +0 -0
  111. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/VGSCollectSDK_VGSCollectSDK.bundle/Info.plist +0 -0
  112. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/PayEngineSDK-Swift.h +38 -6
  113. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Info.plist +0 -0
  114. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +1367 -3704
  115. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +68 -59
  116. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface-e +68 -59
  117. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  118. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +68 -59
  119. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface-e +68 -59
  120. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +1367 -3704
  121. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +68 -59
  122. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface-e +68 -59
  123. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  124. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +68 -59
  125. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface-e +68 -59
  126. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/PayEngineSDK +0 -0
  127. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/VGSCollectSDK_VGSCollectSDK.bundle/Assets.car +0 -0
  128. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/VGSCollectSDK_VGSCollectSDK.bundle/Info.plist +0 -0
  129. package/ios/Payengine.xcodeproj/project.xcworkspace/xcuserdata/trinvh.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  130. package/ios/Payengine.xcworkspace/xcuserdata/trinvh.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  131. package/ios/Sources/Classes/ApplePay/ApplePayUtils.swift +220 -0
  132. package/ios/Sources/Classes/ApplePay/RNPEApplePayButton.swift +232 -139
  133. package/ios/Sources/Classes/ApplePay/RNPEApplePayPaymentRequest.swift +83 -61
  134. package/ios/Sources/Classes/RNPEEventEmitter.swift +1 -1
  135. package/ios/Sources/Payengine.m +8 -1
  136. package/lib/commonjs/components/v2/ApplePay/PEApplePayButton.js +52 -3
  137. package/lib/commonjs/components/v2/ApplePay/PEApplePayButton.js.map +1 -1
  138. package/lib/commonjs/components/v2/ApplePay/PEApplePayInterfaces.js +40 -0
  139. package/lib/commonjs/components/v2/ApplePay/PEApplePayInterfaces.js.map +1 -0
  140. package/lib/commonjs/components/v2/PEPaymentRequest.js +3 -0
  141. package/lib/commonjs/components/v2/PEPaymentRequest.js.map +1 -1
  142. package/lib/commonjs/index.js +43 -32
  143. package/lib/commonjs/index.js.map +1 -1
  144. package/lib/module/components/v2/ApplePay/PEApplePayButton.js +53 -4
  145. package/lib/module/components/v2/ApplePay/PEApplePayButton.js.map +1 -1
  146. package/lib/module/components/v2/ApplePay/PEApplePayInterfaces.js +31 -0
  147. package/lib/module/components/v2/ApplePay/PEApplePayInterfaces.js.map +1 -0
  148. package/lib/module/components/v2/PEPaymentRequest.js +3 -0
  149. package/lib/module/components/v2/PEPaymentRequest.js.map +1 -1
  150. package/lib/module/index.js +6 -2
  151. package/lib/module/index.js.map +1 -1
  152. package/lib/typescript/components/v2/ApplePay/PEApplePayButton.d.ts +38 -2
  153. package/lib/typescript/components/v2/ApplePay/PEApplePayInterfaces.d.ts +54 -0
  154. package/lib/typescript/components/v2/PEPaymentRequest.d.ts +8 -4
  155. package/lib/typescript/index.d.ts +4 -3
  156. package/package.json +1 -1
  157. package/src/components/v2/ApplePay/PEApplePayButton.tsx +181 -24
  158. package/src/components/v2/ApplePay/PEApplePayInterfaces.ts +63 -0
  159. package/src/components/v2/PEPaymentRequest.ts +12 -4
  160. package/src/index.tsx +11 -7
  161. package/android/.gradle/6.1.1/fileHashes/fileHashes.bin +0 -0
  162. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  163. package/android/.gradle/config.properties +0 -2
  164. package/android/.idea/caches/deviceStreaming.xml +0 -329
  165. package/android/.idea/kotlinc.xml +0 -6
  166. package/android/.idea/migrations.xml +0 -10
  167. package/android/payment-sdk-debug-1.0.4.aar +0 -0
  168. package/android/payment-sdk-release-1.0.4.aar +0 -0
  169. package/android/securefields-1.7.2-debug.aar +0 -0
  170. package/ios/Payengine.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +0 -34
  171. package/ios/Payengine.xcodeproj/project.xcworkspace/xcuserdata/tringuyen.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  172. package/ios/Payengine.xcodeproj/xcuserdata/tringuyen.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +0 -24
  173. package/ios/Payengine.xcworkspace/xcuserdata/tringuyen.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  174. package/ios/Pods/Pods.xcodeproj/xcuserdata/tringuyen.xcuserdatad/xcschemes/Pods-Payengine.xcscheme +0 -58
  175. package/ios/Pods/Pods.xcodeproj/xcuserdata/tringuyen.xcuserdatad/xcschemes/VGSCollectSDK-CardIcon.xcscheme +0 -58
  176. package/ios/Pods/Pods.xcodeproj/xcuserdata/tringuyen.xcuserdatad/xcschemes/VGSCollectSDK.xcscheme +0 -58
  177. package/ios/Pods/Pods.xcodeproj/xcuserdata/tringuyen.xcuserdatad/xcschemes/xcschememanagement.plist +0 -32
  178. package/lib/commonjs/components/v2/ApplePay/PEApplePayContact.js +0 -2
  179. package/lib/commonjs/components/v2/ApplePay/PEApplePayContact.js.map +0 -1
  180. package/lib/module/components/v2/ApplePay/PEApplePayContact.js +0 -2
  181. package/lib/module/components/v2/ApplePay/PEApplePayContact.js.map +0 -1
  182. package/lib/typescript/components/v2/ApplePay/PEApplePayContact.d.ts +0 -14
  183. package/src/components/v2/ApplePay/PEApplePayContact.ts +0 -14
  184. /package/ios/Payengine.xcodeproj/xcuserdata/{tringuyen.xcuserdatad → trinvh.xcuserdatad}/xcschemes/xcschememanagement.plist +0 -0
@@ -1 +1 @@
1
- {"version":3,"names":["React","Platform","requireNativeComponent","Text","RNPEApplePayButton","PEApplePayButton","forwardRef","props","ref","useImperativeHandle","pmError","event","onPaymentFailed","Error","nativeEvent","error","pmTokenDidReturn","onTokenDidReturn","token","metadata","metadataString","billingContact","billingContactString","shippingContact","shippingContactString","console","log","JSON","parse","undefined","pmSheetDidDismiss","onPaymentSheetDismissed","OS","height","width","style","stringify","paymentRequest","platformOptions"],"sources":["PEApplePayButton.tsx"],"sourcesContent":["\nimport * as React from 'react';\nimport { Platform, requireNativeComponent, Text, ViewProps } from 'react-native';\nimport type { PEPaymentRequest } from '../PEPaymentRequest';\nimport type { PEApplePayContact } from './PEApplePayContact';\n\n\nconst RNPEApplePayButton = requireNativeComponent<NativePEApplePayViewProps>('RNPEApplePayButton');\n\ntype NativePEApplePayEvent = {\n nativeEvent: {\n error?: string;\n token?: string;\n metadata?: any;\n billingContact?: string;\n shippingContact?: string;\n };\n};\n\ninterface NativePEApplePayViewProps extends ViewProps {\n paymentRequest: string;\n onPmSheetDidDismiss: (event: NativePEApplePayEvent) => void;\n onPmTokenDidReturn: (event: NativePEApplePayEvent) => void;\n onPmError: (event: NativePEApplePayEvent) => void;\n}\n\nexport interface PEApplePayButtonProps extends ViewProps {\n paymentRequest: PEPaymentRequest;\n onTokenDidReturn?: (token: string, metadata?: any, billingContact?: PEApplePayContact, shippingContact?: PEApplePayContact) => void;\n onPaymentSheetDismissed?: () => void;\n onPaymentFailed?: (error: Error) => void;\n}\n\nexport interface PEApplePayButtonMethods {\n \n}\n\n\nexport const PEApplePayButton = React.forwardRef<\nPEApplePayButtonMethods,\n PEApplePayButtonProps\n>((props, ref) => {\n\n React.useImperativeHandle(ref, () => ({\n }));\n\n const pmError = (event: NativePEApplePayEvent) => {\n if (props.onPaymentFailed) {\n props.onPaymentFailed(new Error(event.nativeEvent.error));\n }\n };\n\n const pmTokenDidReturn = (event: NativePEApplePayEvent) => {\n if (props.onTokenDidReturn) {\n const { token, metadata: metadataString, billingContact: billingContactString, shippingContact: shippingContactString } = event.nativeEvent;\n console.log('ON token', token, metadataString, billingContactString, shippingContactString)\n const metadata = metadataString ? JSON.parse(metadataString) : null;\n const billingContact = billingContactString ? JSON.parse(billingContactString) as PEApplePayContact : null;\n const shippingContact = shippingContactString ? JSON.parse(shippingContactString) as PEApplePayContact : null;\n\n props.onTokenDidReturn(token!, metadata, billingContact ?? undefined, shippingContact ?? undefined);\n }\n };\n\n const pmSheetDidDismiss = () => {\n if (props.onPaymentSheetDismissed) {\n props.onPaymentSheetDismissed();\n }\n }\n\n if (Platform.OS !== 'ios') {\n return <Text>Apple Pay is not supported on this platform</Text>\n }\n \n return (\n <RNPEApplePayButton \n style={{ height: 32, width: '100%', ...(props.style as object) }} \n paymentRequest={JSON.stringify({\n ...props.paymentRequest,\n ...props.paymentRequest.platformOptions\n })} \n onPmError={pmError} \n onPmTokenDidReturn={pmTokenDidReturn} \n onPmSheetDidDismiss={pmSheetDidDismiss} \n />\n );\n});\n"],"mappings":"AACA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,QAAT,EAAmBC,sBAAnB,EAA2CC,IAA3C,QAAkE,cAAlE;AAKA,MAAMC,kBAAkB,GAAGF,sBAAsB,CAA4B,oBAA5B,CAAjD;AA+BA,OAAO,MAAMG,gBAAgB,gBAAGL,KAAK,CAACM,UAAN,CAG9B,CAACC,KAAD,EAAQC,GAAR,KAAgB;EAEhBR,KAAK,CAACS,mBAAN,CAA0BD,GAA1B,EAA+B,OAAO,EAAP,CAA/B;;EAGA,MAAME,OAAO,GAAIC,KAAD,IAAkC;IAChD,IAAIJ,KAAK,CAACK,eAAV,EAA2B;MACzBL,KAAK,CAACK,eAAN,CAAsB,IAAIC,KAAJ,CAAUF,KAAK,CAACG,WAAN,CAAkBC,KAA5B,CAAtB;IACD;EACF,CAJD;;EAMA,MAAMC,gBAAgB,GAAIL,KAAD,IAAkC;IACzD,IAAIJ,KAAK,CAACU,gBAAV,EAA4B;MAC1B,MAAM;QAAEC,KAAF;QAASC,QAAQ,EAAEC,cAAnB;QAAmCC,cAAc,EAAEC,oBAAnD;QAAyEC,eAAe,EAAEC;MAA1F,IAAoHb,KAAK,CAACG,WAAhI;MACAW,OAAO,CAACC,GAAR,CAAY,UAAZ,EAAwBR,KAAxB,EAA+BE,cAA/B,EAA+CE,oBAA/C,EAAqEE,qBAArE;MACA,MAAML,QAAQ,GAAGC,cAAc,GAAGO,IAAI,CAACC,KAAL,CAAWR,cAAX,CAAH,GAAgC,IAA/D;MACA,MAAMC,cAAc,GAAGC,oBAAoB,GAAGK,IAAI,CAACC,KAAL,CAAWN,oBAAX,CAAH,GAA2D,IAAtG;MACA,MAAMC,eAAe,GAAGC,qBAAqB,GAAGG,IAAI,CAACC,KAAL,CAAWJ,qBAAX,CAAH,GAA4D,IAAzG;MAEAjB,KAAK,CAACU,gBAAN,CAAuBC,KAAvB,EAA+BC,QAA/B,EAAyCE,cAAc,IAAIQ,SAA3D,EAAsEN,eAAe,IAAIM,SAAzF;IACD;EACF,CAVD;;EAYA,MAAMC,iBAAiB,GAAG,MAAM;IAC9B,IAAIvB,KAAK,CAACwB,uBAAV,EAAmC;MACjCxB,KAAK,CAACwB,uBAAN;IACD;EACF,CAJD;;EAMA,IAAI9B,QAAQ,CAAC+B,EAAT,KAAgB,KAApB,EAA2B;IACzB,oBAAO,oBAAC,IAAD,sDAAP;EACD;;EAED,oBACE,oBAAC,kBAAD;IACE,KAAK,EAAE;MAAEC,MAAM,EAAE,EAAV;MAAcC,KAAK,EAAE,MAArB;MAA6B,GAAI3B,KAAK,CAAC4B;IAAvC,CADT;IAEE,cAAc,EAAER,IAAI,CAACS,SAAL,CAAe,EAC7B,GAAG7B,KAAK,CAAC8B,cADoB;MAE7B,GAAG9B,KAAK,CAAC8B,cAAN,CAAqBC;IAFK,CAAf,CAFlB;IAME,SAAS,EAAE5B,OANb;IAOE,kBAAkB,EAAEM,gBAPtB;IAQE,mBAAmB,EAAEc;EARvB,EADF;AAYD,CAhD+B,CAAzB"}
1
+ {"version":3,"names":["React","findNodeHandle","NativeEventEmitter","NativeModules","Platform","requireNativeComponent","Text","UIManager","RNPEEventEmitter","peEventEmitter","COMPONENT_NAME","RNPEApplePayButton","RNPEApplePayButtonManager","PEApplePayButton","forwardRef","props","ref","buttonRef","useRef","useImperativeHandle","updatePaymentSheet","summaryItems","shippingMethods","errors","Promise","resolve","reject","listener","addListener","args","remove","error","Error","callNativeMethod","useEffect","console","log","useCallback","methodName","params","viewId","current","commandId","Commands","toString","OS","Number","dispatchViewManagerCommand","pmError","event","onPaymentFailed","nativeEvent","pmTokenDidReturn","onTokenDidReturn","token","metadata","metadataString","billingContact","billingContactString","shippingContact","shippingContactString","JSON","parse","undefined","pmSheetDidDismiss","onPaymentSheetDismissed","height","width","style","stringify","paymentRequest","platformOptions","onPaymentMethodSelected","onShippingContactSelected","onShippingMethodSelected"],"sources":["PEApplePayButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n findNodeHandle,\n NativeEventEmitter,\n NativeModules,\n Platform,\n requireNativeComponent,\n Text,\n UIManager,\n ViewProps,\n} from 'react-native';\nimport type { PEPaymentRequest, PESummaryItem } from '../PEPaymentRequest';\nimport type {\n PEApplePayContact,\n PEApplePayPaymentMethod,\n PEApplePaySheetError,\n PEApplePayShippingMethod,\n} from './PEApplePayInterfaces';\n\nconst { RNPEEventEmitter } = NativeModules;\n\nconst peEventEmitter = new NativeEventEmitter(RNPEEventEmitter);\n\nconst COMPONENT_NAME = 'RNPEApplePayButton';\nconst RNPEApplePayButton =\n requireNativeComponent<NativePEApplePayViewProps>(COMPONENT_NAME);\n\n// @ts-ignore\nconst RNPEApplePayButtonManager = UIManager[COMPONENT_NAME];\n\ntype NativePEApplePayEvent = {\n nativeEvent: {\n error?: string;\n token?: string;\n metadata?: any;\n billingContact?: string;\n shippingContact?: string;\n paymentMethod?: string;\n contact?: string;\n shippingMethod?: string;\n };\n};\n\ninterface NativePEApplePayViewProps extends ViewProps {\n paymentRequest: string;\n onPmSheetDidDismiss: (event: NativePEApplePayEvent) => void;\n onPmTokenDidReturn: (event: NativePEApplePayEvent) => void;\n onPmError: (event: NativePEApplePayEvent) => void;\n onPaymentMethodSelected?: (event: {\n nativeEvent: {\n paymentMethod: PEApplePayPaymentMethod;\n };\n }) => void;\n onShippingContactSelected?: (event: {\n nativeEvent: {\n contact: PEApplePayContact;\n };\n }) => void;\n onShippingMethodSelected?: (event: {\n nativeEvent: {\n shippingMethod: PEApplePayShippingMethod;\n };\n }) => void;\n}\n\nexport interface PEApplePayButtonProps extends ViewProps {\n paymentRequest: PEPaymentRequest;\n onTokenDidReturn?: (\n token: string,\n metadata?: any,\n billingContact?: PEApplePayContact,\n shippingContact?: PEApplePayContact\n ) => void;\n onPaymentSheetDismissed?: () => void;\n onPaymentFailed?: (error: Error) => void;\n /**\n * This callback is triggered whenever the payment method changes in the Apple Pay sheet.\n * You MUST update the Apple Pay sheet in your callback using the updatePaymentSheet function,\n * otherwise the Apple Pay sheet will hang and the payment flow will automatically cancel.\n */\n onPaymentMethodSelected?: (event: {\n nativeEvent: {\n paymentMethod: PEApplePayPaymentMethod;\n };\n }) => void;\n /**\n * This callback is triggered whenever the user selects a shipping method in the Apple Pay sheet.\n * You MUST update the Apple Pay sheet in your callback using the updatePaymentSheet function,\n * otherwise the Apple Pay sheet will hang and the payment flow will automatically cancel.\n */\n onShippingContactSelected?: (event: {\n nativeEvent: {\n contact: PEApplePayContact;\n };\n }) => void;\n /**\n * This callback is triggered whenever the user selects a shipping contact in the Apple Pay sheet.\n * You MUST update the Apple Pay sheet in your callback using the updatePaymentSheet function,\n * otherwise the Apple Pay sheet will hang and the payment flow will automatically cancel.\n */\n onShippingMethodSelected?: (event: {\n nativeEvent: {\n shippingMethod: PEApplePayShippingMethod;\n };\n }) => void;\n}\n\nexport interface PEApplePayButtonMethods {\n /**\n * This method must be called after either onPaymentMethodSelected, onShippingContactSelected or\n * onShippingMethodSelected callbacks are triggered.\n * `shippingMethods` and `errors` are only applicable for onShippingContactSelected callback\n */\n updatePaymentSheet: (\n summaryItems: PESummaryItem[],\n shippingMethods: PEApplePayShippingMethod[],\n errors: PEApplePaySheetError[]\n ) => Promise<boolean>;\n}\n\nexport const PEApplePayButton = React.forwardRef<\n PEApplePayButtonMethods,\n PEApplePayButtonProps\n>((props, ref) => {\n const buttonRef = React.useRef<any>();\n\n React.useImperativeHandle(ref, () => ({\n updatePaymentSheet: async (\n summaryItems: PESummaryItem[],\n shippingMethods: PEApplePayShippingMethod[],\n errors: PEApplePaySheetError[]\n ): Promise<boolean> => {\n return new Promise((resolve, reject) => {\n const listener = peEventEmitter.addListener(\n 'onUpdatePaymentSheetResult',\n (args) => {\n listener.remove();\n\n const { error } = args;\n if (error) {\n reject(new Error(error));\n } else {\n resolve(true);\n }\n }\n );\n callNativeMethod('updatePaymentSheet', [\n summaryItems,\n shippingMethods,\n errors,\n ]);\n });\n },\n }));\n\n React.useEffect(() => {\n const listener = peEventEmitter.addListener(\n 'onUpdatePaymentSheetResult',\n (args) => {\n console.log('Received event onUpdatePaymentSheetResult', args);\n }\n );\n return () => {\n listener.remove();\n };\n }, []);\n\n const callNativeMethod = React.useCallback(\n (methodName: string, params: any[] = []) => {\n const viewId = findNodeHandle(buttonRef.current);\n let commandId = RNPEApplePayButtonManager.Commands[methodName].toString();\n if (Platform.OS === 'ios') {\n commandId = Number(commandId);\n }\n UIManager.dispatchViewManagerCommand(viewId, commandId, params);\n },\n [buttonRef.current]\n );\n\n const pmError = (event: NativePEApplePayEvent) => {\n if (props.onPaymentFailed) {\n props.onPaymentFailed(new Error(event.nativeEvent.error));\n }\n };\n\n const pmTokenDidReturn = (event: NativePEApplePayEvent) => {\n if (props.onTokenDidReturn) {\n const {\n token,\n metadata: metadataString,\n billingContact: billingContactString,\n shippingContact: shippingContactString,\n } = event.nativeEvent;\n console.log(\n 'ON token',\n token,\n metadataString,\n billingContactString,\n shippingContactString\n );\n const metadata = metadataString ? JSON.parse(metadataString) : null;\n const billingContact = billingContactString\n ? (JSON.parse(billingContactString) as PEApplePayContact)\n : null;\n const shippingContact = shippingContactString\n ? (JSON.parse(shippingContactString) as PEApplePayContact)\n : null;\n\n props.onTokenDidReturn(\n token!,\n metadata,\n billingContact ?? undefined,\n shippingContact ?? undefined\n );\n }\n };\n\n const pmSheetDidDismiss = () => {\n if (props.onPaymentSheetDismissed) {\n props.onPaymentSheetDismissed();\n }\n };\n\n if (Platform.OS !== 'ios') {\n return <Text>Apple Pay is not supported on this platform</Text>;\n }\n\n return (\n <RNPEApplePayButton\n ref={buttonRef}\n style={{ height: 32, width: '100%', ...(props.style as object) }}\n paymentRequest={JSON.stringify({\n ...props.paymentRequest,\n ...props.paymentRequest.platformOptions,\n })}\n onPmError={pmError}\n onPmTokenDidReturn={pmTokenDidReturn}\n onPmSheetDidDismiss={pmSheetDidDismiss}\n onPaymentMethodSelected={props.onPaymentMethodSelected}\n onShippingContactSelected={props.onShippingContactSelected}\n onShippingMethodSelected={props.onShippingMethodSelected}\n />\n );\n});\n"],"mappings":"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"}
@@ -0,0 +1,31 @@
1
+ export let PEApplePayPaymentMethodType;
2
+
3
+ (function (PEApplePayPaymentMethodType) {
4
+ PEApplePayPaymentMethodType[PEApplePayPaymentMethodType["unknown"] = 0] = "unknown";
5
+ PEApplePayPaymentMethodType[PEApplePayPaymentMethodType["debit"] = 1] = "debit";
6
+ PEApplePayPaymentMethodType[PEApplePayPaymentMethodType["credit"] = 2] = "credit";
7
+ PEApplePayPaymentMethodType[PEApplePayPaymentMethodType["prepaid"] = 3] = "prepaid";
8
+ PEApplePayPaymentMethodType[PEApplePayPaymentMethodType["store"] = 4] = "store";
9
+ PEApplePayPaymentMethodType[PEApplePayPaymentMethodType["eMoney"] = 5] = "eMoney";
10
+ })(PEApplePayPaymentMethodType || (PEApplePayPaymentMethodType = {}));
11
+
12
+ export let PEApplePaySheetErrorType;
13
+
14
+ (function (PEApplePaySheetErrorType) {
15
+ PEApplePaySheetErrorType["InvalidShippingAddress"] = "InvalidShippingAddress";
16
+ PEApplePaySheetErrorType["UnserviceableShippingAddress"] = "UnserviceableShippingAddress";
17
+ })(PEApplePaySheetErrorType || (PEApplePaySheetErrorType = {}));
18
+
19
+ export let PEApplePayInvalidShippingField;
20
+
21
+ (function (PEApplePayInvalidShippingField) {
22
+ PEApplePayInvalidShippingField["Street"] = "street";
23
+ PEApplePayInvalidShippingField["City"] = "city";
24
+ PEApplePayInvalidShippingField["SubAdministrativeArea"] = "subAdministrativeArea";
25
+ PEApplePayInvalidShippingField["State"] = "state";
26
+ PEApplePayInvalidShippingField["PostalCode"] = "postalCode";
27
+ PEApplePayInvalidShippingField["Country"] = "country";
28
+ PEApplePayInvalidShippingField["CountryCode"] = "countryCode";
29
+ PEApplePayInvalidShippingField["SubLocality"] = "subLocality";
30
+ })(PEApplePayInvalidShippingField || (PEApplePayInvalidShippingField = {}));
31
+ //# sourceMappingURL=PEApplePayInterfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["PEApplePayPaymentMethodType","PEApplePaySheetErrorType","PEApplePayInvalidShippingField"],"sources":["PEApplePayInterfaces.ts"],"sourcesContent":["export interface PEApplePayContact {\n givenName?: string;\n familyName?: string;\n addressLines?: string[];\n locality?: string;\n administrativeArea?: string;\n postalCode?: string;\n country?: string;\n countryCode?: string;\n subAdministrativeArea?: string;\n subLocality?: string;\n emailAddress?: string;\n phoneNumber?: string;\n}\n\nexport interface PEApplePayPaymentMethod {\n displayName?: string;\n network?: string;\n type: PEApplePayPaymentMethodType;\n}\n\nexport enum PEApplePayPaymentMethodType {\n unknown = 0,\n debit = 1,\n credit = 2,\n prepaid = 3,\n store = 4,\n eMoney = 5\n}\n\nexport interface PEApplePayShippingMethod {\n identifier: string;\n amount: number;\n label: string;\n}\n\nexport type PEApplePaySheetError =\n | {\n errorType: PEApplePaySheetErrorType.InvalidShippingAddress;\n field: PEApplePayInvalidShippingField;\n message?: string;\n }\n | {\n errorType:\n | PEApplePaySheetErrorType.UnserviceableShippingAddress\n message?: string;\n };\n\nexport enum PEApplePaySheetErrorType {\n InvalidShippingAddress = 'InvalidShippingAddress',\n UnserviceableShippingAddress = 'UnserviceableShippingAddress',\n}\n\nexport enum PEApplePayInvalidShippingField {\n Street = 'street',\n City = 'city',\n SubAdministrativeArea = 'subAdministrativeArea',\n State = 'state',\n PostalCode = 'postalCode',\n Country = 'country',\n CountryCode = 'countryCode',\n SubLocality = 'subLocality',\n}\n"],"mappings":"AAqBA,WAAYA,2BAAZ;;WAAYA,2B;EAAAA,2B,CAAAA,2B;EAAAA,2B,CAAAA,2B;EAAAA,2B,CAAAA,2B;EAAAA,2B,CAAAA,2B;EAAAA,2B,CAAAA,2B;EAAAA,2B,CAAAA,2B;GAAAA,2B,KAAAA,2B;;AA2BZ,WAAYC,wBAAZ;;WAAYA,wB;EAAAA,wB;EAAAA,wB;GAAAA,wB,KAAAA,wB;;AAKZ,WAAYC,8BAAZ;;WAAYA,8B;EAAAA,8B;EAAAA,8B;EAAAA,8B;EAAAA,8B;EAAAA,8B;EAAAA,8B;EAAAA,8B;EAAAA,8B;GAAAA,8B,KAAAA,8B"}
@@ -40,8 +40,11 @@ export class RNPEApplePayOptions {
40
40
 
41
41
  _defineProperty(this, "requiredShippingContactFields", []);
42
42
 
43
+ _defineProperty(this, "shippingMethods", []);
44
+
43
45
  this.requiredBillingContactFields = params.requiredBillingContactFields;
44
46
  this.requiredShippingContactFields = params.requiredShippingContactFields;
47
+ this.shippingMethods = params.shippingMethods;
45
48
  }
46
49
 
47
50
  }
@@ -1 +1 @@
1
- {"version":3,"names":["PEPaymentRequest","constructor","merchantId","paymentAmount","currencyCode","paymentItems","platformOptions","RNPEContactField","RNPEApplePayOptions","params","requiredBillingContactFields","requiredShippingContactFields","RNPEGooglePayBillingAddressParameters","RNPEGooglePayShippingAddressParameters","undefined","RNPEGooglePayOptions","billingAddressRequired","billingAddressParameters","shippingAddressRequired","shippingAddressParameters"],"sources":["PEPaymentRequest.ts"],"sourcesContent":["type RNPEPaymentOptions = RNPEGooglePayOptions | RNPEApplePayOptions;\n\nexport class PEPaymentRequest {\n merchantId: string;\n paymentAmount: number;\n currencyCode?: 'USD' | 'CAD' = 'USD';\n paymentItems?: {\n amount: number;\n label: string;\n }[] = [];\n platformOptions?: RNPEPaymentOptions;\n\n constructor(\n merchantId: string,\n paymentAmount: number,\n currencyCode: 'USD' | 'CAD' = 'USD',\n paymentItems: {\n amount: number;\n label: string;\n }[] = [],\n platformOptions?: RNPEPaymentOptions\n ) {\n this.merchantId = merchantId;\n this.paymentAmount = paymentAmount;\n this.currencyCode = currencyCode;\n this.paymentItems = paymentItems;\n this.platformOptions = platformOptions;\n }\n}\n\nexport enum RNPEContactField {\n name = 'name',\n postalAddress = 'postalAddress',\n emailAddress = 'emailAddress',\n phoneNumber = 'phoneNumber',\n phoneticName = 'phoneticName',\n}\n\nexport class RNPEApplePayOptions {\n requiredBillingContactFields?: RNPEContactField[] = [];\n requiredShippingContactFields?: RNPEContactField[] = [];\n\n constructor(params: {\n requiredBillingContactFields: RNPEContactField[];\n requiredShippingContactFields: RNPEContactField[];\n }) {\n this.requiredBillingContactFields = params.requiredBillingContactFields;\n this.requiredShippingContactFields = params.requiredShippingContactFields;\n }\n}\n\nexport class RNPEGooglePayBillingAddressParameters {\n format: 'FULL' | 'MIN' = 'FULL'\n phoneNumberRequired: boolean = false\n}\n\nexport class RNPEGooglePayShippingAddressParameters {\n allowedCountryCodes?: string[] = undefined\n phoneNumberRequired: boolean = false\n}\n\nexport class RNPEGooglePayOptions {\n billingAddressRequired: boolean;\n billingAddressParameters?: any;\n shippingAddressRequired: boolean;\n shippingAddressParameters?: any;\n\n constructor(params: {\n billingAddressRequired: boolean;\n shippingAddressRequired: boolean;\n billingAddressParameters?: RNPEGooglePayBillingAddressParameters;\n shippingAddressParameters?: RNPEGooglePayShippingAddressParameters;\n }) {\n this.billingAddressRequired = params.billingAddressRequired;\n this.billingAddressParameters = params.billingAddressParameters;\n this.shippingAddressRequired = params.shippingAddressRequired;\n this.shippingAddressParameters = params.shippingAddressParameters;\n }\n}\n"],"mappings":";;AAEA,OAAO,MAAMA,gBAAN,CAAuB;EAU5BC,WAAW,CACTC,UADS,EAETC,aAFS,EAST;IAAA,IANAC,YAMA,uEAN8B,KAM9B;IAAA,IALAC,YAKA,uEAFM,EAEN;IAAA,IADAC,eACA;;IAAA;;IAAA;;IAAA,sCAhB6B,KAgB7B;;IAAA,sCAZI,EAYJ;;IAAA;;IACA,KAAKJ,UAAL,GAAkBA,UAAlB;IACA,KAAKC,aAAL,GAAqBA,aAArB;IACA,KAAKC,YAAL,GAAoBA,YAApB;IACA,KAAKC,YAAL,GAAoBA,YAApB;IACA,KAAKC,eAAL,GAAuBA,eAAvB;EACD;;AAzB2B;AA4B9B,WAAYC,gBAAZ;;WAAYA,gB;EAAAA,gB;EAAAA,gB;EAAAA,gB;EAAAA,gB;EAAAA,gB;GAAAA,gB,KAAAA,gB;;AAQZ,OAAO,MAAMC,mBAAN,CAA0B;EAI/BP,WAAW,CAACQ,MAAD,EAGR;IAAA,sDANiD,EAMjD;;IAAA,uDALkD,EAKlD;;IACD,KAAKC,4BAAL,GAAoCD,MAAM,CAACC,4BAA3C;IACA,KAAKC,6BAAL,GAAqCF,MAAM,CAACE,6BAA5C;EACD;;AAV8B;AAajC,OAAO,MAAMC,qCAAN,CAA4C;EAAA;IAAA,gCACxB,MADwB;;IAAA,6CAElB,KAFkB;EAAA;;AAAA;AAKnD,OAAO,MAAMC,sCAAN,CAA6C;EAAA;IAAA,6CACjBC,SADiB;;IAAA,6CAEnB,KAFmB;EAAA;;AAAA;AAKpD,OAAO,MAAMC,oBAAN,CAA2B;EAMhCd,WAAW,CAACQ,MAAD,EAKR;IAAA;;IAAA;;IAAA;;IAAA;;IACD,KAAKO,sBAAL,GAA8BP,MAAM,CAACO,sBAArC;IACA,KAAKC,wBAAL,GAAgCR,MAAM,CAACQ,wBAAvC;IACA,KAAKC,uBAAL,GAA+BT,MAAM,CAACS,uBAAtC;IACA,KAAKC,yBAAL,GAAiCV,MAAM,CAACU,yBAAxC;EACD;;AAhB+B"}
1
+ {"version":3,"names":["PEPaymentRequest","constructor","merchantId","paymentAmount","currencyCode","paymentItems","platformOptions","RNPEContactField","RNPEApplePayOptions","params","requiredBillingContactFields","requiredShippingContactFields","shippingMethods","RNPEGooglePayBillingAddressParameters","RNPEGooglePayShippingAddressParameters","undefined","RNPEGooglePayOptions","billingAddressRequired","billingAddressParameters","shippingAddressRequired","shippingAddressParameters"],"sources":["PEPaymentRequest.ts"],"sourcesContent":["import type { PEApplePayShippingMethod } from \"./ApplePay/PEApplePayInterfaces\";\n\ntype RNPEPaymentOptions = RNPEGooglePayOptions | RNPEApplePayOptions;\n\nexport class PEPaymentRequest {\n merchantId: string;\n paymentAmount: number;\n currencyCode?: 'USD' | 'CAD' = 'USD';\n paymentItems?: PESummaryItem[] = [];\n platformOptions?: RNPEPaymentOptions;\n\n constructor(\n merchantId: string,\n paymentAmount: number,\n currencyCode: 'USD' | 'CAD' = 'USD',\n paymentItems: {\n amount: number;\n label: string;\n }[] = [],\n platformOptions?: RNPEPaymentOptions\n ) {\n this.merchantId = merchantId;\n this.paymentAmount = paymentAmount;\n this.currencyCode = currencyCode;\n this.paymentItems = paymentItems;\n this.platformOptions = platformOptions;\n }\n}\n\nexport interface PESummaryItem {\n amount: number;\n label: string;\n}\n\nexport enum RNPEContactField {\n name = 'name',\n postalAddress = 'postalAddress',\n emailAddress = 'emailAddress',\n phoneNumber = 'phoneNumber',\n phoneticName = 'phoneticName',\n}\n\n\nexport class RNPEApplePayOptions {\n requiredBillingContactFields?: RNPEContactField[] = [];\n requiredShippingContactFields?: RNPEContactField[] = [];\n shippingMethods?: PEApplePayShippingMethod[] = [];\n\n constructor(params: {\n requiredBillingContactFields: RNPEContactField[];\n requiredShippingContactFields: RNPEContactField[];\n shippingMethods: PEApplePayShippingMethod[];\n }) {\n this.requiredBillingContactFields = params.requiredBillingContactFields;\n this.requiredShippingContactFields = params.requiredShippingContactFields;\n this.shippingMethods = params.shippingMethods\n }\n}\n\nexport class RNPEGooglePayBillingAddressParameters {\n format: 'FULL' | 'MIN' = 'FULL'\n phoneNumberRequired: boolean = false\n}\n\nexport class RNPEGooglePayShippingAddressParameters {\n allowedCountryCodes?: string[] = undefined\n phoneNumberRequired: boolean = false\n}\n\nexport class RNPEGooglePayOptions {\n billingAddressRequired: boolean;\n billingAddressParameters?: any;\n shippingAddressRequired: boolean;\n shippingAddressParameters?: any;\n\n constructor(params: {\n billingAddressRequired: boolean;\n shippingAddressRequired: boolean;\n billingAddressParameters?: RNPEGooglePayBillingAddressParameters;\n shippingAddressParameters?: RNPEGooglePayShippingAddressParameters;\n }) {\n this.billingAddressRequired = params.billingAddressRequired;\n this.billingAddressParameters = params.billingAddressParameters;\n this.shippingAddressRequired = params.shippingAddressRequired;\n this.shippingAddressParameters = params.shippingAddressParameters;\n }\n}\n"],"mappings":";;AAIA,OAAO,MAAMA,gBAAN,CAAuB;EAO5BC,WAAW,CACTC,UADS,EAETC,aAFS,EAST;IAAA,IANAC,YAMA,uEAN8B,KAM9B;IAAA,IALAC,YAKA,uEAFM,EAEN;IAAA,IADAC,eACA;;IAAA;;IAAA;;IAAA,sCAb6B,KAa7B;;IAAA,sCAZ+B,EAY/B;;IAAA;;IACA,KAAKJ,UAAL,GAAkBA,UAAlB;IACA,KAAKC,aAAL,GAAqBA,aAArB;IACA,KAAKC,YAAL,GAAoBA,YAApB;IACA,KAAKC,YAAL,GAAoBA,YAApB;IACA,KAAKC,eAAL,GAAuBA,eAAvB;EACD;;AAtB2B;AA8B9B,WAAYC,gBAAZ;;WAAYA,gB;EAAAA,gB;EAAAA,gB;EAAAA,gB;EAAAA,gB;EAAAA,gB;GAAAA,gB,KAAAA,gB;;AASZ,OAAO,MAAMC,mBAAN,CAA0B;EAK/BP,WAAW,CAACQ,MAAD,EAIR;IAAA,sDARiD,EAQjD;;IAAA,uDAPkD,EAOlD;;IAAA,yCAN4C,EAM5C;;IACD,KAAKC,4BAAL,GAAoCD,MAAM,CAACC,4BAA3C;IACA,KAAKC,6BAAL,GAAqCF,MAAM,CAACE,6BAA5C;IACA,KAAKC,eAAL,GAAuBH,MAAM,CAACG,eAA9B;EACD;;AAb8B;AAgBjC,OAAO,MAAMC,qCAAN,CAA4C;EAAA;IAAA,gCACxB,MADwB;;IAAA,6CAElB,KAFkB;EAAA;;AAAA;AAKnD,OAAO,MAAMC,sCAAN,CAA6C;EAAA;IAAA,6CACjBC,SADiB;;IAAA,6CAEnB,KAFmB;EAAA;;AAAA;AAKpD,OAAO,MAAMC,oBAAN,CAA2B;EAMhCf,WAAW,CAACQ,MAAD,EAKR;IAAA;;IAAA;;IAAA;;IAAA;;IACD,KAAKQ,sBAAL,GAA8BR,MAAM,CAACQ,sBAArC;IACA,KAAKC,wBAAL,GAAgCT,MAAM,CAACS,wBAAvC;IACA,KAAKC,uBAAL,GAA+BV,MAAM,CAACU,uBAAtC;IACA,KAAKC,yBAAL,GAAiCX,MAAM,CAACW,yBAAxC;EACD;;AAhB+B"}
@@ -6,10 +6,11 @@ import { PEBankAccountView, PEBankAccountViewMethods } from './components/v2/Sec
6
6
  import { PayEngineProvider } from './components/v2/PayEngineProvider';
7
7
  import PayEngineNative from './components/v2/PayEngineNative';
8
8
  import { PEApplePayButton } from './components/v2/ApplePay/PEApplePayButton';
9
- import { PEPaymentRequest, RNPEApplePayOptions, RNPEContactField, RNPEGooglePayBillingAddressParameters, RNPEGooglePayShippingAddressParameters } from './components/v2/PEPaymentRequest';
10
9
  import { PEGooglePayButton } from './components/v2/GooglePay/PEGooglePayButton';
11
10
  import * as PayEngineUtils from './utils/index';
12
11
  import PEKeyboardType from './components/v2/SecureFields/PEKeyboardType';
12
+ export * from './components/v2/PEPaymentRequest';
13
+ export * from './components/v2/ApplePay/PEApplePayInterfaces';
13
14
  const LINKING_ERROR = `The package 'react-native-payengine' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
14
15
  ios: "- You have run 'pod install'\n",
15
16
  default: ''
@@ -25,5 +26,8 @@ PayEngineUtils, PayEngineProvider, PayEngineNative, // securefields
25
26
  PEKeyboardType, // credit card
26
27
  PECreditCardView, PECreditCardViewMethods, // bank account
27
28
  PEBankAccountView, PEBankAccountViewMethods, // Apple Pay
28
- PEApplePayButton, RNPEApplePayOptions, RNPEContactField, RNPEGooglePayBillingAddressParameters, RNPEGooglePayShippingAddressParameters, PEPaymentRequest, PEGooglePayButton };
29
+ PEApplePayButton, // RNPEGooglePayBillingAddressParameters,
30
+ // RNPEGooglePayShippingAddressParameters,
31
+ // PEPaymentRequest,
32
+ PEGooglePayButton };
29
33
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["PayEngine","NativeModules","Platform","PayProvider","PECreditCardView","PECreditCardViewMethods","PEBankAccountView","PEBankAccountViewMethods","PayEngineProvider","PayEngineNative","PEApplePayButton","PEPaymentRequest","RNPEApplePayOptions","RNPEContactField","RNPEGooglePayBillingAddressParameters","RNPEGooglePayShippingAddressParameters","PEGooglePayButton","PayEngineUtils","PEKeyboardType","LINKING_ERROR","select","ios","default","PayEngineStatic","Payengine","Proxy","get","Error"],"sources":["index.tsx"],"sourcesContent":["import PayEngine from './components/PayEngine';\nimport { NativeModules, Platform } from 'react-native';\nimport type { IPayEngineConfig } from './interfaces/index';\nimport { PayProvider } from './interfaces/index';\nimport {\n PECreditCardView,\n PECreditCardViewMethods,\n} from './components/v2/SecureFields/CreditCardView';\nimport {\n PEBankAccountView,\n PEBankAccountViewMethods,\n} from './components/v2/SecureFields/BankAccountView';\nimport type IPEField from './components/v2/SecureFields/IPEField';\nimport type PECard from './components/v2/SecureFields/PECard';\nimport type PEBankAccount from './components/v2/SecureFields/PEBankAccount';\nimport { PayEngineProvider } from './components/v2/PayEngineProvider';\nimport PayEngineNative from './components/v2/PayEngineNative';\nimport { PEApplePayButton } from './components/v2/ApplePay/PEApplePayButton';\nimport { PEPaymentRequest, RNPEApplePayOptions, RNPEContactField, RNPEGooglePayBillingAddressParameters, RNPEGooglePayShippingAddressParameters } from './components/v2/PEPaymentRequest';\nimport { PEGooglePayButton } from './components/v2/GooglePay/PEGooglePayButton';\nimport * as PayEngineUtils from './utils/index';\nimport PEKeyboardType from './components/v2/SecureFields/PEKeyboardType';\nimport type { PEGooglePayAddress } from './components/v2/GooglePay/PEGooglePayAddress';\nimport type { PEApplePayContact } from './components/v2/ApplePay/PEApplePayContact';\n\nconst LINKING_ERROR =\n `The package 'react-native-payengine' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst PayEngineStatic = NativeModules.Payengine\n ? NativeModules.Payengine\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport {\n PayEngineStatic,\n PayEngine,\n IPayEngineConfig,\n PayProvider,\n // v2 starting here\n PayEngineUtils,\n PayEngineProvider,\n PayEngineNative,\n // securefields\n PEKeyboardType,\n IPEField,\n // credit card\n PECreditCardView,\n PECreditCardViewMethods,\n PECard,\n // bank account\n PEBankAccountView,\n PEBankAccountViewMethods,\n PEBankAccount,\n // Apple Pay\n PEApplePayButton,\n RNPEApplePayOptions, \n RNPEContactField,\n PEApplePayContact,\n RNPEGooglePayBillingAddressParameters, \n RNPEGooglePayShippingAddressParameters,\n PEPaymentRequest,\n PEGooglePayButton,\n PEGooglePayAddress\n};\n"],"mappings":"AAAA,OAAOA,SAAP,MAAsB,wBAAtB;AACA,SAASC,aAAT,EAAwBC,QAAxB,QAAwC,cAAxC;AAEA,SAASC,WAAT,QAA4B,oBAA5B;AACA,SACEC,gBADF,EAEEC,uBAFF,QAGO,6CAHP;AAIA,SACEC,iBADF,EAEEC,wBAFF,QAGO,8CAHP;AAOA,SAASC,iBAAT,QAAkC,mCAAlC;AACA,OAAOC,eAAP,MAA4B,iCAA5B;AACA,SAASC,gBAAT,QAAiC,2CAAjC;AACA,SAASC,gBAAT,EAA2BC,mBAA3B,EAAgDC,gBAAhD,EAAkEC,qCAAlE,EAAyGC,sCAAzG,QAAuJ,kCAAvJ;AACA,SAASC,iBAAT,QAAkC,6CAAlC;AACA,OAAO,KAAKC,cAAZ,MAAgC,eAAhC;AACA,OAAOC,cAAP,MAA2B,6CAA3B;AAIA,MAAMC,aAAa,GAChB,iFAAD,GACAjB,QAAQ,CAACkB,MAAT,CAAgB;EAAEC,GAAG,EAAE,gCAAP;EAAyCC,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAMA,MAAMC,eAAe,GAAGtB,aAAa,CAACuB,SAAd,GACpBvB,aAAa,CAACuB,SADM,GAEpB,IAAIC,KAAJ,CACE,EADF,EAEE;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAJ,CAAUR,aAAV,CAAN;EACD;;AAHH,CAFF,CAFJ;AAWA,SACEI,eADF,EAEEvB,SAFF,EAIEG,WAJF,EAKE;AACAc,cANF,EAOET,iBAPF,EAQEC,eARF,EASE;AACAS,cAVF,EAYE;AACAd,gBAbF,EAcEC,uBAdF,EAgBE;AACAC,iBAjBF,EAkBEC,wBAlBF,EAoBE;AACAG,gBArBF,EAsBEE,mBAtBF,EAuBEC,gBAvBF,EAyBEC,qCAzBF,EA0BEC,sCA1BF,EA2BEJ,gBA3BF,EA4BEK,iBA5BF"}
1
+ {"version":3,"names":["PayEngine","NativeModules","Platform","PayProvider","PECreditCardView","PECreditCardViewMethods","PEBankAccountView","PEBankAccountViewMethods","PayEngineProvider","PayEngineNative","PEApplePayButton","PEGooglePayButton","PayEngineUtils","PEKeyboardType","LINKING_ERROR","select","ios","default","PayEngineStatic","Payengine","Proxy","get","Error"],"sources":["index.tsx"],"sourcesContent":["import PayEngine from './components/PayEngine';\nimport { NativeModules, Platform } from 'react-native';\nimport type { IPayEngineConfig } from './interfaces/index';\nimport { PayProvider } from './interfaces/index';\nimport {\n PECreditCardView,\n PECreditCardViewMethods,\n} from './components/v2/SecureFields/CreditCardView';\nimport {\n PEBankAccountView,\n PEBankAccountViewMethods,\n} from './components/v2/SecureFields/BankAccountView';\nimport type IPEField from './components/v2/SecureFields/IPEField';\nimport type PECard from './components/v2/SecureFields/PECard';\nimport type PEBankAccount from './components/v2/SecureFields/PEBankAccount';\nimport { PayEngineProvider } from './components/v2/PayEngineProvider';\nimport PayEngineNative from './components/v2/PayEngineNative';\nimport { PEApplePayButton } from './components/v2/ApplePay/PEApplePayButton';\n\nimport { PEGooglePayButton } from './components/v2/GooglePay/PEGooglePayButton';\nimport * as PayEngineUtils from './utils/index';\nimport PEKeyboardType from './components/v2/SecureFields/PEKeyboardType';\nimport type { PEGooglePayAddress } from './components/v2/GooglePay/PEGooglePayAddress';\nimport type { PEApplePayContact } from './components/v2/ApplePay/PEApplePayInterfaces';\n\nexport * from './components/v2/PEPaymentRequest';\nexport * from './components/v2/ApplePay/PEApplePayInterfaces';\n\n\nconst LINKING_ERROR =\n `The package 'react-native-payengine' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst PayEngineStatic = NativeModules.Payengine\n ? NativeModules.Payengine\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport {\n PayEngineStatic,\n PayEngine,\n IPayEngineConfig,\n PayProvider,\n // v2 starting here\n PayEngineUtils,\n PayEngineProvider,\n PayEngineNative,\n // securefields\n PEKeyboardType,\n IPEField,\n // credit card\n PECreditCardView,\n PECreditCardViewMethods,\n PECard,\n // bank account\n PEBankAccountView,\n PEBankAccountViewMethods,\n PEBankAccount,\n // Apple Pay\n PEApplePayButton,\n // RNPEApplePayOptions,\n // RNPEContactField,\n PEApplePayContact,\n // RNPEGooglePayBillingAddressParameters,\n // RNPEGooglePayShippingAddressParameters,\n // PEPaymentRequest,\n PEGooglePayButton,\n PEGooglePayAddress\n};\n"],"mappings":"AAAA,OAAOA,SAAP,MAAsB,wBAAtB;AACA,SAASC,aAAT,EAAwBC,QAAxB,QAAwC,cAAxC;AAEA,SAASC,WAAT,QAA4B,oBAA5B;AACA,SACEC,gBADF,EAEEC,uBAFF,QAGO,6CAHP;AAIA,SACEC,iBADF,EAEEC,wBAFF,QAGO,8CAHP;AAOA,SAASC,iBAAT,QAAkC,mCAAlC;AACA,OAAOC,eAAP,MAA4B,iCAA5B;AACA,SAASC,gBAAT,QAAiC,2CAAjC;AAEA,SAASC,iBAAT,QAAkC,6CAAlC;AACA,OAAO,KAAKC,cAAZ,MAAgC,eAAhC;AACA,OAAOC,cAAP,MAA2B,6CAA3B;AAIA,cAAc,kCAAd;AACA,cAAc,+CAAd;AAGA,MAAMC,aAAa,GAChB,iFAAD,GACAZ,QAAQ,CAACa,MAAT,CAAgB;EAAEC,GAAG,EAAE,gCAAP;EAAyCC,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAMA,MAAMC,eAAe,GAAGjB,aAAa,CAACkB,SAAd,GACpBlB,aAAa,CAACkB,SADM,GAEpB,IAAIC,KAAJ,CACE,EADF,EAEE;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAJ,CAAUR,aAAV,CAAN;EACD;;AAHH,CAFF,CAFJ;AAWA,SACEI,eADF,EAEElB,SAFF,EAIEG,WAJF,EAKE;AACAS,cANF,EAOEJ,iBAPF,EAQEC,eARF,EASE;AACAI,cAVF,EAYE;AACAT,gBAbF,EAcEC,uBAdF,EAgBE;AACAC,iBAjBF,EAkBEC,wBAlBF,EAoBE;AACAG,gBArBF,EAyBE;AACA;AACA;AACAC,iBA5BF"}
@@ -1,13 +1,49 @@
1
1
  import * as React from 'react';
2
2
  import { ViewProps } from 'react-native';
3
- import type { PEPaymentRequest } from '../PEPaymentRequest';
4
- import type { PEApplePayContact } from './PEApplePayContact';
3
+ import type { PEPaymentRequest, PESummaryItem } from '../PEPaymentRequest';
4
+ import type { PEApplePayContact, PEApplePayPaymentMethod, PEApplePaySheetError, PEApplePayShippingMethod } from './PEApplePayInterfaces';
5
5
  export interface PEApplePayButtonProps extends ViewProps {
6
6
  paymentRequest: PEPaymentRequest;
7
7
  onTokenDidReturn?: (token: string, metadata?: any, billingContact?: PEApplePayContact, shippingContact?: PEApplePayContact) => void;
8
8
  onPaymentSheetDismissed?: () => void;
9
9
  onPaymentFailed?: (error: Error) => void;
10
+ /**
11
+ * This callback is triggered whenever the payment method changes in the Apple Pay sheet.
12
+ * You MUST update the Apple Pay sheet in your callback using the updatePaymentSheet function,
13
+ * otherwise the Apple Pay sheet will hang and the payment flow will automatically cancel.
14
+ */
15
+ onPaymentMethodSelected?: (event: {
16
+ nativeEvent: {
17
+ paymentMethod: PEApplePayPaymentMethod;
18
+ };
19
+ }) => void;
20
+ /**
21
+ * This callback is triggered whenever the user selects a shipping method in the Apple Pay sheet.
22
+ * You MUST update the Apple Pay sheet in your callback using the updatePaymentSheet function,
23
+ * otherwise the Apple Pay sheet will hang and the payment flow will automatically cancel.
24
+ */
25
+ onShippingContactSelected?: (event: {
26
+ nativeEvent: {
27
+ contact: PEApplePayContact;
28
+ };
29
+ }) => void;
30
+ /**
31
+ * This callback is triggered whenever the user selects a shipping contact in the Apple Pay sheet.
32
+ * You MUST update the Apple Pay sheet in your callback using the updatePaymentSheet function,
33
+ * otherwise the Apple Pay sheet will hang and the payment flow will automatically cancel.
34
+ */
35
+ onShippingMethodSelected?: (event: {
36
+ nativeEvent: {
37
+ shippingMethod: PEApplePayShippingMethod;
38
+ };
39
+ }) => void;
10
40
  }
11
41
  export interface PEApplePayButtonMethods {
42
+ /**
43
+ * This method must be called after either onPaymentMethodSelected, onShippingContactSelected or
44
+ * onShippingMethodSelected callbacks are triggered.
45
+ * `shippingMethods` and `errors` are only applicable for onShippingContactSelected callback
46
+ */
47
+ updatePaymentSheet: (summaryItems: PESummaryItem[], shippingMethods: PEApplePayShippingMethod[], errors: PEApplePaySheetError[]) => Promise<boolean>;
12
48
  }
13
49
  export declare const PEApplePayButton: React.ForwardRefExoticComponent<PEApplePayButtonProps & React.RefAttributes<PEApplePayButtonMethods>>;
@@ -0,0 +1,54 @@
1
+ export interface PEApplePayContact {
2
+ givenName?: string;
3
+ familyName?: string;
4
+ addressLines?: string[];
5
+ locality?: string;
6
+ administrativeArea?: string;
7
+ postalCode?: string;
8
+ country?: string;
9
+ countryCode?: string;
10
+ subAdministrativeArea?: string;
11
+ subLocality?: string;
12
+ emailAddress?: string;
13
+ phoneNumber?: string;
14
+ }
15
+ export interface PEApplePayPaymentMethod {
16
+ displayName?: string;
17
+ network?: string;
18
+ type: PEApplePayPaymentMethodType;
19
+ }
20
+ export declare enum PEApplePayPaymentMethodType {
21
+ unknown = 0,
22
+ debit = 1,
23
+ credit = 2,
24
+ prepaid = 3,
25
+ store = 4,
26
+ eMoney = 5
27
+ }
28
+ export interface PEApplePayShippingMethod {
29
+ identifier: string;
30
+ amount: number;
31
+ label: string;
32
+ }
33
+ export declare type PEApplePaySheetError = {
34
+ errorType: PEApplePaySheetErrorType.InvalidShippingAddress;
35
+ field: PEApplePayInvalidShippingField;
36
+ message?: string;
37
+ } | {
38
+ errorType: PEApplePaySheetErrorType.UnserviceableShippingAddress;
39
+ message?: string;
40
+ };
41
+ export declare enum PEApplePaySheetErrorType {
42
+ InvalidShippingAddress = "InvalidShippingAddress",
43
+ UnserviceableShippingAddress = "UnserviceableShippingAddress"
44
+ }
45
+ export declare enum PEApplePayInvalidShippingField {
46
+ Street = "street",
47
+ City = "city",
48
+ SubAdministrativeArea = "subAdministrativeArea",
49
+ State = "state",
50
+ PostalCode = "postalCode",
51
+ Country = "country",
52
+ CountryCode = "countryCode",
53
+ SubLocality = "subLocality"
54
+ }
@@ -1,18 +1,20 @@
1
+ import type { PEApplePayShippingMethod } from "./ApplePay/PEApplePayInterfaces";
1
2
  declare type RNPEPaymentOptions = RNPEGooglePayOptions | RNPEApplePayOptions;
2
3
  export declare class PEPaymentRequest {
3
4
  merchantId: string;
4
5
  paymentAmount: number;
5
6
  currencyCode?: 'USD' | 'CAD';
6
- paymentItems?: {
7
- amount: number;
8
- label: string;
9
- }[];
7
+ paymentItems?: PESummaryItem[];
10
8
  platformOptions?: RNPEPaymentOptions;
11
9
  constructor(merchantId: string, paymentAmount: number, currencyCode?: 'USD' | 'CAD', paymentItems?: {
12
10
  amount: number;
13
11
  label: string;
14
12
  }[], platformOptions?: RNPEPaymentOptions);
15
13
  }
14
+ export interface PESummaryItem {
15
+ amount: number;
16
+ label: string;
17
+ }
16
18
  export declare enum RNPEContactField {
17
19
  name = "name",
18
20
  postalAddress = "postalAddress",
@@ -23,9 +25,11 @@ export declare enum RNPEContactField {
23
25
  export declare class RNPEApplePayOptions {
24
26
  requiredBillingContactFields?: RNPEContactField[];
25
27
  requiredShippingContactFields?: RNPEContactField[];
28
+ shippingMethods?: PEApplePayShippingMethod[];
26
29
  constructor(params: {
27
30
  requiredBillingContactFields: RNPEContactField[];
28
31
  requiredShippingContactFields: RNPEContactField[];
32
+ shippingMethods: PEApplePayShippingMethod[];
29
33
  });
30
34
  }
31
35
  export declare class RNPEGooglePayBillingAddressParameters {
@@ -9,11 +9,12 @@ import type PEBankAccount from './components/v2/SecureFields/PEBankAccount';
9
9
  import { PayEngineProvider } from './components/v2/PayEngineProvider';
10
10
  import PayEngineNative from './components/v2/PayEngineNative';
11
11
  import { PEApplePayButton } from './components/v2/ApplePay/PEApplePayButton';
12
- import { PEPaymentRequest, RNPEApplePayOptions, RNPEContactField, RNPEGooglePayBillingAddressParameters, RNPEGooglePayShippingAddressParameters } from './components/v2/PEPaymentRequest';
13
12
  import { PEGooglePayButton } from './components/v2/GooglePay/PEGooglePayButton';
14
13
  import * as PayEngineUtils from './utils/index';
15
14
  import PEKeyboardType from './components/v2/SecureFields/PEKeyboardType';
16
15
  import type { PEGooglePayAddress } from './components/v2/GooglePay/PEGooglePayAddress';
17
- import type { PEApplePayContact } from './components/v2/ApplePay/PEApplePayContact';
16
+ import type { PEApplePayContact } from './components/v2/ApplePay/PEApplePayInterfaces';
17
+ export * from './components/v2/PEPaymentRequest';
18
+ export * from './components/v2/ApplePay/PEApplePayInterfaces';
18
19
  declare const PayEngineStatic: any;
19
- export { PayEngineStatic, PayEngine, IPayEngineConfig, PayProvider, PayEngineUtils, PayEngineProvider, PayEngineNative, PEKeyboardType, IPEField, PECreditCardView, PECreditCardViewMethods, PECard, PEBankAccountView, PEBankAccountViewMethods, PEBankAccount, PEApplePayButton, RNPEApplePayOptions, RNPEContactField, PEApplePayContact, RNPEGooglePayBillingAddressParameters, RNPEGooglePayShippingAddressParameters, PEPaymentRequest, PEGooglePayButton, PEGooglePayAddress };
20
+ export { PayEngineStatic, PayEngine, IPayEngineConfig, PayProvider, PayEngineUtils, PayEngineProvider, PayEngineNative, PEKeyboardType, IPEField, PECreditCardView, PECreditCardViewMethods, PECard, PEBankAccountView, PEBankAccountViewMethods, PEBankAccount, PEApplePayButton, PEApplePayContact, PEGooglePayButton, PEGooglePayAddress };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-payengine",
3
- "version": "2.0.11",
3
+ "version": "2.0.13",
4
4
  "description": "PayEngine SDK for React Native",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -1,11 +1,32 @@
1
-
2
1
  import * as React from 'react';
3
- import { Platform, requireNativeComponent, Text, ViewProps } from 'react-native';
4
- import type { PEPaymentRequest } from '../PEPaymentRequest';
5
- import type { PEApplePayContact } from './PEApplePayContact';
2
+ import {
3
+ findNodeHandle,
4
+ NativeEventEmitter,
5
+ NativeModules,
6
+ Platform,
7
+ requireNativeComponent,
8
+ Text,
9
+ UIManager,
10
+ ViewProps,
11
+ } from 'react-native';
12
+ import type { PEPaymentRequest, PESummaryItem } from '../PEPaymentRequest';
13
+ import type {
14
+ PEApplePayContact,
15
+ PEApplePayPaymentMethod,
16
+ PEApplePaySheetError,
17
+ PEApplePayShippingMethod,
18
+ } from './PEApplePayInterfaces';
19
+
20
+ const { RNPEEventEmitter } = NativeModules;
21
+
22
+ const peEventEmitter = new NativeEventEmitter(RNPEEventEmitter);
6
23
 
24
+ const COMPONENT_NAME = 'RNPEApplePayButton';
25
+ const RNPEApplePayButton =
26
+ requireNativeComponent<NativePEApplePayViewProps>(COMPONENT_NAME);
7
27
 
8
- const RNPEApplePayButton = requireNativeComponent<NativePEApplePayViewProps>('RNPEApplePayButton');
28
+ // @ts-ignore
29
+ const RNPEApplePayButtonManager = UIManager[COMPONENT_NAME];
9
30
 
10
31
  type NativePEApplePayEvent = {
11
32
  nativeEvent: {
@@ -14,6 +35,9 @@ type NativePEApplePayEvent = {
14
35
  metadata?: any;
15
36
  billingContact?: string;
16
37
  shippingContact?: string;
38
+ paymentMethod?: string;
39
+ contact?: string;
40
+ shippingMethod?: string;
17
41
  };
18
42
  };
19
43
 
@@ -22,28 +46,137 @@ interface NativePEApplePayViewProps extends ViewProps {
22
46
  onPmSheetDidDismiss: (event: NativePEApplePayEvent) => void;
23
47
  onPmTokenDidReturn: (event: NativePEApplePayEvent) => void;
24
48
  onPmError: (event: NativePEApplePayEvent) => void;
49
+ onPaymentMethodSelected?: (event: {
50
+ nativeEvent: {
51
+ paymentMethod: PEApplePayPaymentMethod;
52
+ };
53
+ }) => void;
54
+ onShippingContactSelected?: (event: {
55
+ nativeEvent: {
56
+ contact: PEApplePayContact;
57
+ };
58
+ }) => void;
59
+ onShippingMethodSelected?: (event: {
60
+ nativeEvent: {
61
+ shippingMethod: PEApplePayShippingMethod;
62
+ };
63
+ }) => void;
25
64
  }
26
65
 
27
66
  export interface PEApplePayButtonProps extends ViewProps {
28
67
  paymentRequest: PEPaymentRequest;
29
- onTokenDidReturn?: (token: string, metadata?: any, billingContact?: PEApplePayContact, shippingContact?: PEApplePayContact) => void;
68
+ onTokenDidReturn?: (
69
+ token: string,
70
+ metadata?: any,
71
+ billingContact?: PEApplePayContact,
72
+ shippingContact?: PEApplePayContact
73
+ ) => void;
30
74
  onPaymentSheetDismissed?: () => void;
31
75
  onPaymentFailed?: (error: Error) => void;
76
+ /**
77
+ * This callback is triggered whenever the payment method changes in the Apple Pay sheet.
78
+ * You MUST update the Apple Pay sheet in your callback using the updatePaymentSheet function,
79
+ * otherwise the Apple Pay sheet will hang and the payment flow will automatically cancel.
80
+ */
81
+ onPaymentMethodSelected?: (event: {
82
+ nativeEvent: {
83
+ paymentMethod: PEApplePayPaymentMethod;
84
+ };
85
+ }) => void;
86
+ /**
87
+ * This callback is triggered whenever the user selects a shipping method in the Apple Pay sheet.
88
+ * You MUST update the Apple Pay sheet in your callback using the updatePaymentSheet function,
89
+ * otherwise the Apple Pay sheet will hang and the payment flow will automatically cancel.
90
+ */
91
+ onShippingContactSelected?: (event: {
92
+ nativeEvent: {
93
+ contact: PEApplePayContact;
94
+ };
95
+ }) => void;
96
+ /**
97
+ * This callback is triggered whenever the user selects a shipping contact in the Apple Pay sheet.
98
+ * You MUST update the Apple Pay sheet in your callback using the updatePaymentSheet function,
99
+ * otherwise the Apple Pay sheet will hang and the payment flow will automatically cancel.
100
+ */
101
+ onShippingMethodSelected?: (event: {
102
+ nativeEvent: {
103
+ shippingMethod: PEApplePayShippingMethod;
104
+ };
105
+ }) => void;
32
106
  }
33
107
 
34
108
  export interface PEApplePayButtonMethods {
35
-
109
+ /**
110
+ * This method must be called after either onPaymentMethodSelected, onShippingContactSelected or
111
+ * onShippingMethodSelected callbacks are triggered.
112
+ * `shippingMethods` and `errors` are only applicable for onShippingContactSelected callback
113
+ */
114
+ updatePaymentSheet: (
115
+ summaryItems: PESummaryItem[],
116
+ shippingMethods: PEApplePayShippingMethod[],
117
+ errors: PEApplePaySheetError[]
118
+ ) => Promise<boolean>;
36
119
  }
37
120
 
38
-
39
121
  export const PEApplePayButton = React.forwardRef<
40
- PEApplePayButtonMethods,
122
+ PEApplePayButtonMethods,
41
123
  PEApplePayButtonProps
42
124
  >((props, ref) => {
125
+ const buttonRef = React.useRef<any>();
43
126
 
44
127
  React.useImperativeHandle(ref, () => ({
128
+ updatePaymentSheet: async (
129
+ summaryItems: PESummaryItem[],
130
+ shippingMethods: PEApplePayShippingMethod[],
131
+ errors: PEApplePaySheetError[]
132
+ ): Promise<boolean> => {
133
+ return new Promise((resolve, reject) => {
134
+ const listener = peEventEmitter.addListener(
135
+ 'onUpdatePaymentSheetResult',
136
+ (args) => {
137
+ listener.remove();
138
+
139
+ const { error } = args;
140
+ if (error) {
141
+ reject(new Error(error));
142
+ } else {
143
+ resolve(true);
144
+ }
145
+ }
146
+ );
147
+ callNativeMethod('updatePaymentSheet', [
148
+ summaryItems,
149
+ shippingMethods,
150
+ errors,
151
+ ]);
152
+ });
153
+ },
45
154
  }));
46
155
 
156
+ React.useEffect(() => {
157
+ const listener = peEventEmitter.addListener(
158
+ 'onUpdatePaymentSheetResult',
159
+ (args) => {
160
+ console.log('Received event onUpdatePaymentSheetResult', args);
161
+ }
162
+ );
163
+ return () => {
164
+ listener.remove();
165
+ };
166
+ }, []);
167
+
168
+ const callNativeMethod = React.useCallback(
169
+ (methodName: string, params: any[] = []) => {
170
+ const viewId = findNodeHandle(buttonRef.current);
171
+ let commandId = RNPEApplePayButtonManager.Commands[methodName].toString();
172
+ if (Platform.OS === 'ios') {
173
+ commandId = Number(commandId);
174
+ }
175
+ UIManager.dispatchViewManagerCommand(viewId, commandId, params);
176
+ },
177
+ [buttonRef.current]
178
+ );
179
+
47
180
  const pmError = (event: NativePEApplePayEvent) => {
48
181
  if (props.onPaymentFailed) {
49
182
  props.onPaymentFailed(new Error(event.nativeEvent.error));
@@ -52,13 +185,33 @@ PEApplePayButtonMethods,
52
185
 
53
186
  const pmTokenDidReturn = (event: NativePEApplePayEvent) => {
54
187
  if (props.onTokenDidReturn) {
55
- const { token, metadata: metadataString, billingContact: billingContactString, shippingContact: shippingContactString } = event.nativeEvent;
56
- console.log('ON token', token, metadataString, billingContactString, shippingContactString)
188
+ const {
189
+ token,
190
+ metadata: metadataString,
191
+ billingContact: billingContactString,
192
+ shippingContact: shippingContactString,
193
+ } = event.nativeEvent;
194
+ console.log(
195
+ 'ON token',
196
+ token,
197
+ metadataString,
198
+ billingContactString,
199
+ shippingContactString
200
+ );
57
201
  const metadata = metadataString ? JSON.parse(metadataString) : null;
58
- const billingContact = billingContactString ? JSON.parse(billingContactString) as PEApplePayContact : null;
59
- const shippingContact = shippingContactString ? JSON.parse(shippingContactString) as PEApplePayContact : null;
202
+ const billingContact = billingContactString
203
+ ? (JSON.parse(billingContactString) as PEApplePayContact)
204
+ : null;
205
+ const shippingContact = shippingContactString
206
+ ? (JSON.parse(shippingContactString) as PEApplePayContact)
207
+ : null;
60
208
 
61
- props.onTokenDidReturn(token!, metadata, billingContact ?? undefined, shippingContact ?? undefined);
209
+ props.onTokenDidReturn(
210
+ token!,
211
+ metadata,
212
+ billingContact ?? undefined,
213
+ shippingContact ?? undefined
214
+ );
62
215
  }
63
216
  };
64
217
 
@@ -66,22 +219,26 @@ PEApplePayButtonMethods,
66
219
  if (props.onPaymentSheetDismissed) {
67
220
  props.onPaymentSheetDismissed();
68
221
  }
69
- }
222
+ };
70
223
 
71
224
  if (Platform.OS !== 'ios') {
72
- return <Text>Apple Pay is not supported on this platform</Text>
225
+ return <Text>Apple Pay is not supported on this platform</Text>;
73
226
  }
74
-
227
+
75
228
  return (
76
- <RNPEApplePayButton
77
- style={{ height: 32, width: '100%', ...(props.style as object) }}
229
+ <RNPEApplePayButton
230
+ ref={buttonRef}
231
+ style={{ height: 32, width: '100%', ...(props.style as object) }}
78
232
  paymentRequest={JSON.stringify({
79
233
  ...props.paymentRequest,
80
- ...props.paymentRequest.platformOptions
81
- })}
82
- onPmError={pmError}
83
- onPmTokenDidReturn={pmTokenDidReturn}
84
- onPmSheetDidDismiss={pmSheetDidDismiss}
234
+ ...props.paymentRequest.platformOptions,
235
+ })}
236
+ onPmError={pmError}
237
+ onPmTokenDidReturn={pmTokenDidReturn}
238
+ onPmSheetDidDismiss={pmSheetDidDismiss}
239
+ onPaymentMethodSelected={props.onPaymentMethodSelected}
240
+ onShippingContactSelected={props.onShippingContactSelected}
241
+ onShippingMethodSelected={props.onShippingMethodSelected}
85
242
  />
86
243
  );
87
244
  });