@jimrising/easymerchantsdk-react-native 2.0.7 → 2.0.9
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.
- package/README.md +129 -1806
- package/android/build/.transforms/15b6a8a60a6b32d0dcaf609723cf365b/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/.transforms/8508f1428f740032c45a43f48b1bbe1e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule$1$1.dex +0 -0
- package/android/build/.transforms/8508f1428f740032c45a43f48b1bbe1e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule$1.dex +0 -0
- package/android/build/.transforms/8508f1428f740032c45a43f48b1bbe1e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule$2.dex +0 -0
- package/android/build/.transforms/8508f1428f740032c45a43f48b1bbe1e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule.dex +0 -0
- package/android/build/.transforms/eef2d06269ef2e204b4f065513034fca/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/.transforms/ffabb40f9809b32eb9546ce76fc51764/transformed/bundleLibRuntimeToDirRelease/bundleLibRuntimeToDirRelease_dex/com/reactlibrary/RNEasymerchantsdkModule$1$1.dex +0 -0
- package/android/build/.transforms/ffabb40f9809b32eb9546ce76fc51764/transformed/bundleLibRuntimeToDirRelease/bundleLibRuntimeToDirRelease_dex/com/reactlibrary/RNEasymerchantsdkModule$1.dex +0 -0
- package/android/build/.transforms/ffabb40f9809b32eb9546ce76fc51764/transformed/bundleLibRuntimeToDirRelease/bundleLibRuntimeToDirRelease_dex/com/reactlibrary/RNEasymerchantsdkModule$2.dex +0 -0
- package/android/build/.transforms/ffabb40f9809b32eb9546ce76fc51764/transformed/bundleLibRuntimeToDirRelease/bundleLibRuntimeToDirRelease_dex/com/reactlibrary/RNEasymerchantsdkModule.dex +0 -0
- package/android/build/intermediates/aar_main_jar/release/syncReleaseLibJars/classes.jar +0 -0
- package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
- package/android/build/intermediates/compile_library_classes_jar/release/bundleLibCompileToJarRelease/classes.jar +0 -0
- package/android/build/intermediates/full_jar/release/createFullJarRelease/full.jar +0 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -1
- package/android/build/intermediates/incremental/lintVitalAnalyzeRelease/release-artifact-dependencies.xml +4 -4
- package/android/build/intermediates/incremental/lintVitalAnalyzeRelease/release-artifact-libraries.xml +4 -4
- package/android/build/intermediates/incremental/release/mergeReleaseResources/compile-file-map.properties +838 -838
- package/android/build/intermediates/incremental/release/mergeReleaseResources/merger.xml +3 -3
- package/android/build/intermediates/incremental/release/packageReleaseResources/compile-file-map.properties +1 -1
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule$1$1.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule$1.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule$2.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule.class +0 -0
- package/android/build/intermediates/javac/release/compileReleaseJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule$1$1.class +0 -0
- package/android/build/intermediates/javac/release/compileReleaseJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule$1.class +0 -0
- package/android/build/intermediates/javac/release/compileReleaseJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule$2.class +0 -0
- package/android/build/intermediates/javac/release/compileReleaseJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule.class +0 -0
- package/android/build/intermediates/lint-cache/lintVitalAnalyzeRelease/maven.google/androidx/core/group-index.xml +4 -3
- package/android/build/intermediates/lint-cache/lintVitalAnalyzeRelease/maven.google/androidx/lifecycle/group-index.xml +165 -165
- package/android/build/intermediates/lint-cache/lintVitalAnalyzeRelease/maven.google/com/android/tools/build/group-index.xml +15 -15
- package/android/build/intermediates/lint-cache/lintVitalAnalyzeRelease/sdk_index/snapshot.gz +0 -0
- package/android/build/intermediates/lint_model/release/generateReleaseLintModel/release-artifact-dependencies.xml +4 -4
- package/android/build/intermediates/lint_model/release/generateReleaseLintModel/release-artifact-libraries.xml +4 -4
- package/android/build/intermediates/lint_vital_lint_model/release/generateReleaseLintVitalModel/release-artifact-dependencies.xml +4 -4
- package/android/build/intermediates/lint_vital_lint_model/release/generateReleaseLintVitalModel/release-artifact-libraries.xml +4 -4
- package/android/build/intermediates/local_aar_for_lint/release/out.aar +0 -0
- package/android/build/intermediates/merged_res/release/mergeReleaseResources/layout/activity_card_addition_ifo.xml +1 -0
- package/android/build/intermediates/merged_res/release/mergeReleaseResources/layout/activity_card_billing_info.xml +1 -0
- package/android/build/intermediates/merged_res/release/mergeReleaseResources/layout/activity_card_scan.xml +1 -0
- package/android/build/intermediates/merged_res/release/mergeReleaseResources/layout/activity_payment_done.xml +1 -0
- package/android/build/intermediates/merged_res/release/mergeReleaseResources/layout/activity_payment_done_url.xml +1 -0
- package/android/build/intermediates/merged_res/release/mergeReleaseResources/layout/activity_payment_error.xml +1 -0
- package/android/build/intermediates/merged_res/release/mergeReleaseResources/layout/activity_select_payment_method.xml +1 -0
- package/android/build/intermediates/merged_res/release/mergeReleaseResources/layout/activity_verify_email.xml +1 -0
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/multi-v2/values-night-v8.json +19 -19
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/multi-v2/values.json +38 -38
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/anim-v21.json +9 -9
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/anim.json +24 -24
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/animator-v21.json +1 -1
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/animator.json +34 -34
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/color-night-v8.json +3 -3
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/color-v31.json +10 -10
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/color.json +153 -153
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/drawable-hdpi-v4.json +1 -1
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/drawable-mdpi-v4.json +1 -1
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/drawable-v21.json +3 -3
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/drawable-v23.json +7 -7
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/drawable-xhdpi-v4.json +1 -1
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/drawable-xxhdpi-v4.json +1 -1
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/drawable-xxxhdpi-v4.json +1 -1
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/drawable.json +391 -391
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/font.json +9 -9
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/interpolator-v21.json +10 -10
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/interpolator.json +11 -11
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/layout-land.json +3 -3
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/layout-sw600dp-v13.json +2 -2
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/layout-v26.json +1 -1
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/layout.json +98 -98
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/mipmap-anydpi-v26.json +2 -2
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/mipmap-hdpi-v4.json +2 -2
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/mipmap-mdpi-v4.json +2 -2
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/mipmap-xhdpi-v4.json +2 -2
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/mipmap-xxhdpi-v4.json +2 -2
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/mipmap-xxxhdpi-v4.json +2 -2
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/raw.json +46 -46
- package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/xml.json +3 -3
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/reactlibrary/RNEasymerchantsdkModule$1$1.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/reactlibrary/RNEasymerchantsdkModule$1.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/reactlibrary/RNEasymerchantsdkModule$2.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/reactlibrary/RNEasymerchantsdkModule.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/release/bundleLibRuntimeToDirRelease/com/reactlibrary/RNEasymerchantsdkModule$1$1.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/release/bundleLibRuntimeToDirRelease/com/reactlibrary/RNEasymerchantsdkModule$1.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/release/bundleLibRuntimeToDirRelease/com/reactlibrary/RNEasymerchantsdkModule$2.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/release/bundleLibRuntimeToDirRelease/com/reactlibrary/RNEasymerchantsdkModule.class +0 -0
- package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
- package/android/build/intermediates/runtime_library_classes_jar/release/bundleLibRuntimeToJarRelease/classes.jar +0 -0
- package/android/build/intermediates/source_set_path_map/release/mapReleaseSourceSetPaths/file-map.txt +24 -24
- package/android/build/intermediates/verified_library_resources/release/verifyReleaseResources/compiled/layout_activity_card_addition_ifo.xml.flat +0 -0
- package/android/build/intermediates/verified_library_resources/release/verifyReleaseResources/compiled/layout_activity_card_billing_info.xml.flat +0 -0
- package/android/build/intermediates/verified_library_resources/release/verifyReleaseResources/compiled/layout_activity_card_scan.xml.flat +0 -0
- package/android/build/intermediates/verified_library_resources/release/verifyReleaseResources/compiled/layout_activity_payment_done.xml.flat +0 -0
- package/android/build/intermediates/verified_library_resources/release/verifyReleaseResources/compiled/layout_activity_payment_done_url.xml.flat +0 -0
- package/android/build/intermediates/verified_library_resources/release/verifyReleaseResources/compiled/layout_activity_payment_error.xml.flat +0 -0
- package/android/build/intermediates/verified_library_resources/release/verifyReleaseResources/compiled/layout_activity_select_payment_method.xml.flat +0 -0
- package/android/build/intermediates/verified_library_resources/release/verifyReleaseResources/compiled/layout_activity_verify_email.xml.flat +0 -0
- package/android/build/outputs/aar/jimrising_easymerchantsdk-react-native-release.aar +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkModule$1$1.class.uniqueId1 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkModule$1.class.uniqueId0 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkModule$2.class.uniqueId3 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkModule.class.uniqueId2 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkPackage.class.uniqueId4 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/build/tmp/compileReleaseJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/reactlibrary/RNEasymerchantsdkModule.java +93 -26
- package/ios/Classes/EasyMerchantSdk.m +4 -4
- package/ios/Classes/EasyMerchantSdk.swift +116 -60
- package/ios/Classes/EasyPayViewController.swift +3 -5
- package/ios/CustomComponents/CheckboxButton.swift +66 -0
- package/ios/Helper/GrailPayHelper.swift +1 -0
- package/ios/Models/Request.swift +8 -8
- package/ios/Pods/ViewControllers/AdditionalInfoVC.swift +233 -97
- package/ios/Pods/ViewControllers/BillingInfoVC/BillingInfoVC.swift +376 -104
- package/ios/Pods/ViewControllers/OTPVerificationVC.swift +28 -27
- package/ios/Pods/ViewControllers/PaymentErrorVC.swift +22 -25
- package/ios/Pods/ViewControllers/PaymentInformation/PaymentInfoVC.swift +575 -190
- package/ios/easymerchantsdk.podspec +1 -1
- package/ios/easymerchantsdk.storyboard +15 -15
- package/package.json +1 -1
|
@@ -228,7 +228,7 @@ class BillingInfoVC: BaseVC {
|
|
|
228
228
|
private func updateNextButtonTitle() {
|
|
229
229
|
guard let request = request else { return }
|
|
230
230
|
|
|
231
|
-
if let billingInfoData = request.
|
|
231
|
+
if let billingInfoData = request.fields,
|
|
232
232
|
let fieldSection = try? JSONDecoder().decode(FieldSection.self, from: billingInfoData) {
|
|
233
233
|
|
|
234
234
|
let isAdditionalVisible = fieldSection.visibility.additional
|
|
@@ -777,26 +777,34 @@ class BillingInfoVC: BaseVC {
|
|
|
777
777
|
|
|
778
778
|
}
|
|
779
779
|
else if !isAdditionalVisible && isSavedForFuture {
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
780
|
+
if UserStoreSingleton.shared.isLoggedIn == true {
|
|
781
|
+
if request.secureAuthentication == true {
|
|
782
|
+
threeDSecurePaymentApi()
|
|
783
|
+
} else {
|
|
784
|
+
paymentIntentApi()
|
|
785
|
+
}
|
|
786
|
+
} else {
|
|
787
|
+
// let vc = easymerchantsdk.instantiateViewController(withIdentifier: "EmailVerificationVC") as! EmailVerificationVC
|
|
788
|
+
let vc = easymerchantsdk.instantiateViewController(withIdentifier: "OTPVerificationVC") as! OTPVerificationVC
|
|
789
|
+
vc.cardNumber = cardNumber
|
|
790
|
+
vc.expiryDate = expiryDate
|
|
791
|
+
vc.cvv = cvv
|
|
792
|
+
vc.nameOnCard = nameOnCard
|
|
793
|
+
vc.userEmail = userEmail
|
|
794
|
+
vc.billingInfoData = updatedBillingData
|
|
795
|
+
vc.fieldSection = updatedFieldSection
|
|
796
|
+
vc.selectedPaymentMethod = selectedPaymentMethod
|
|
797
|
+
vc.easyPayDelegate = easyPayDelegate
|
|
798
|
+
vc.request = request
|
|
799
|
+
vc.chosenPlan = chosenPlan
|
|
800
|
+
vc.startDate = startDate
|
|
801
|
+
vc.billingInfo = updatedFieldSection.billing
|
|
802
|
+
vc.additionalInfo = updatedFieldSection.additional
|
|
803
|
+
vc.visibility = updatedFieldSection.visibility
|
|
804
|
+
vc.isSavedForFuture = true
|
|
805
|
+
vc.amount = amount
|
|
806
|
+
navigationController?.pushViewController(vc, animated: true)
|
|
807
|
+
}
|
|
800
808
|
}
|
|
801
809
|
else if !isAdditionalVisible && isFrom == "SavedCards" {
|
|
802
810
|
paymentIntentFromShowCardApi()
|
|
@@ -850,31 +858,35 @@ class BillingInfoVC: BaseVC {
|
|
|
850
858
|
navigationController?.pushViewController(vc, animated: true)
|
|
851
859
|
}
|
|
852
860
|
else if !isAdditionalVisible && isSavedForFuture {
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
861
|
+
if UserStoreSingleton.shared.isLoggedIn == true {
|
|
862
|
+
accountChargeWithSaveApi(customerId: UserStoreSingleton.shared.customerId)
|
|
863
|
+
} else {
|
|
864
|
+
// let vc = easymerchantsdk.instantiateViewController(withIdentifier: "EmailVerificationVC") as! EmailVerificationVC
|
|
865
|
+
let vc = easymerchantsdk.instantiateViewController(withIdentifier: "OTPVerificationVC") as! OTPVerificationVC
|
|
866
|
+
vc.accountName = accountName
|
|
867
|
+
vc.routingNumber = routingNumber
|
|
868
|
+
vc.accountType = accountType
|
|
869
|
+
vc.accountNumber = accountNumber
|
|
870
|
+
vc.userEmail = userEmail
|
|
871
|
+
vc.billingInfoData = updatedBillingData
|
|
872
|
+
vc.fieldSection = updatedFieldSection
|
|
873
|
+
vc.selectedPaymentMethod = selectedPaymentMethod
|
|
874
|
+
vc.easyPayDelegate = easyPayDelegate
|
|
875
|
+
vc.request = self.request
|
|
876
|
+
vc.chosenPlan = chosenPlan
|
|
877
|
+
vc.startDate = startDate
|
|
878
|
+
vc.billingInfo = updatedFieldSection.billing
|
|
879
|
+
vc.additionalInfo = updatedFieldSection.additional
|
|
880
|
+
vc.visibility = updatedFieldSection.visibility
|
|
881
|
+
vc.isSavedForFuture = isSavedForFuture
|
|
882
|
+
vc.isSavedNewAccount = isSavedNewAccount
|
|
883
|
+
vc.amount = amount
|
|
884
|
+
vc.grailPayAccountID = grailPayAccountID
|
|
885
|
+
vc.selectedGrailPayAccountType = selectedGrailPayAccountType
|
|
886
|
+
vc.selectedGrailPayAccountName = selectedGrailPayAccountName
|
|
887
|
+
vc.email = userEmail
|
|
888
|
+
navigationController?.pushViewController(vc, animated: true)
|
|
889
|
+
}
|
|
878
890
|
}
|
|
879
891
|
else if isFrom == "SavedBank" {
|
|
880
892
|
accountChargeSavedBankAccountApi()
|
|
@@ -913,31 +925,35 @@ class BillingInfoVC: BaseVC {
|
|
|
913
925
|
navigationController?.pushViewController(vc, animated: true)
|
|
914
926
|
}
|
|
915
927
|
else if !isAdditionalVisible && isSavedForFuture {
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
928
|
+
if UserStoreSingleton.shared.isLoggedIn == true {
|
|
929
|
+
grailPayAccountChargeApi()
|
|
930
|
+
} else {
|
|
931
|
+
// let vc = easymerchantsdk.instantiateViewController(withIdentifier: "EmailVerificationVC") as! EmailVerificationVC
|
|
932
|
+
let vc = easymerchantsdk.instantiateViewController(withIdentifier: "OTPVerificationVC") as! OTPVerificationVC
|
|
933
|
+
vc.billingInfoData = updatedBillingData
|
|
934
|
+
vc.fieldSection = updatedFieldSection
|
|
935
|
+
vc.billingInfo = updatedFieldSection.billing
|
|
936
|
+
vc.additionalInfo = updatedFieldSection.additional
|
|
937
|
+
vc.visibility = updatedFieldSection.visibility
|
|
938
|
+
vc.selectedPaymentMethod = selectedPaymentMethod
|
|
939
|
+
vc.isSavedForFuture = isSavedForFuture
|
|
940
|
+
vc.isFrom = isFrom
|
|
941
|
+
vc.isSavedNewAccount = isSavedNewAccount
|
|
942
|
+
vc.amount = Double(self.request.amount ?? 0)
|
|
943
|
+
vc.request = request
|
|
944
|
+
vc.chosenPlan = chosenPlan
|
|
945
|
+
vc.startDate = startDate
|
|
946
|
+
vc.grailPayAccountID = grailPayAccountID
|
|
947
|
+
vc.selectedGrailPayAccountType = selectedGrailPayAccountType
|
|
948
|
+
vc.selectedGrailPayAccountName = selectedGrailPayAccountName
|
|
949
|
+
vc.userEmail = userEmail
|
|
950
|
+
vc.email = userEmail
|
|
951
|
+
|
|
952
|
+
vc.grailPayAccountID = self.grailPayAccountID
|
|
953
|
+
vc.selectedGrailPayAccountType = self.selectedGrailPayAccountType
|
|
954
|
+
vc.selectedGrailPayAccountName = self.selectedGrailPayAccountName
|
|
955
|
+
navigationController?.pushViewController(vc, animated: true)
|
|
956
|
+
}
|
|
941
957
|
}
|
|
942
958
|
else {
|
|
943
959
|
grailPayAccountChargeApi()
|
|
@@ -1045,17 +1061,32 @@ class BillingInfoVC: BaseVC {
|
|
|
1045
1061
|
params["interval"] = chosenPlan?.lowercased()
|
|
1046
1062
|
}
|
|
1047
1063
|
|
|
1048
|
-
//
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1064
|
+
// ✅ Include metadata only if it has at least 1 key-value pair
|
|
1065
|
+
if let metadata = request?.metadata, !metadata.isEmpty {
|
|
1066
|
+
params["metadata"] = metadata
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
// ✅ Only for logged-in users
|
|
1070
|
+
if UserStoreSingleton.shared.isLoggedIn == true {
|
|
1071
|
+
let emailText = userEmail
|
|
1072
|
+
let emailPrefix = emailText?.components(separatedBy: "@").first ?? ""
|
|
1073
|
+
|
|
1074
|
+
params["save_card"] = 1
|
|
1075
|
+
params["is_default"] = "1"
|
|
1076
|
+
params["tokenize"] = request.tokenOnly ?? ""
|
|
1077
|
+
params["username"] = emailPrefix
|
|
1078
|
+
|
|
1079
|
+
if let customerId = UserStoreSingleton.shared.customerId {
|
|
1080
|
+
params["customer"] = customerId
|
|
1081
|
+
params["customer_id"] = customerId
|
|
1082
|
+
} else {
|
|
1083
|
+
params["create_customer"] = "1"
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
if UserStoreSingleton.shared.customerId == nil {
|
|
1087
|
+
params["create_customer"] = "1"
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1059
1090
|
|
|
1060
1091
|
print(params)
|
|
1061
1092
|
|
|
@@ -1199,6 +1230,28 @@ class BillingInfoVC: BaseVC {
|
|
|
1199
1230
|
"tokenize": request.tokenOnly ?? false
|
|
1200
1231
|
]
|
|
1201
1232
|
|
|
1233
|
+
// ✅ Only for logged-in users
|
|
1234
|
+
if UserStoreSingleton.shared.isLoggedIn == true {
|
|
1235
|
+
let emailText = userEmail
|
|
1236
|
+
let emailPrefix = emailText?.components(separatedBy: "@").first ?? ""
|
|
1237
|
+
|
|
1238
|
+
params["save_card"] = 1
|
|
1239
|
+
params["is_default"] = "1"
|
|
1240
|
+
params["tokenize"] = request.tokenOnly ?? ""
|
|
1241
|
+
params["username"] = emailPrefix
|
|
1242
|
+
|
|
1243
|
+
if let customerId = UserStoreSingleton.shared.customerId {
|
|
1244
|
+
params["customer"] = customerId
|
|
1245
|
+
params["customer_id"] = customerId
|
|
1246
|
+
} else {
|
|
1247
|
+
params["create_customer"] = "1"
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
if UserStoreSingleton.shared.customerId == nil {
|
|
1251
|
+
params["create_customer"] = "1"
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1202
1255
|
// Conditionally add billing info
|
|
1203
1256
|
if let visibility = visibility, visibility.billing == true,
|
|
1204
1257
|
let billing = billingInfo, !billing.isEmpty {
|
|
@@ -1609,17 +1662,10 @@ class BillingInfoVC: BaseVC {
|
|
|
1609
1662
|
params["email"] = UserStoreSingleton.shared.verificationEmail
|
|
1610
1663
|
}
|
|
1611
1664
|
|
|
1612
|
-
//
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
// ✅ Flatten metadata into requestBody
|
|
1618
|
-
if let metadata = request?.metadata, !metadata.isEmpty {
|
|
1619
|
-
for (key, value) in metadata {
|
|
1620
|
-
params[key] = value
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1665
|
+
// ✅ Include metadata only if it has at least 1 key-value pair
|
|
1666
|
+
if let metadata = request?.metadata, !metadata.isEmpty {
|
|
1667
|
+
params["metadata"] = metadata
|
|
1668
|
+
}
|
|
1623
1669
|
|
|
1624
1670
|
print(params)
|
|
1625
1671
|
|
|
@@ -1805,17 +1851,10 @@ class BillingInfoVC: BaseVC {
|
|
|
1805
1851
|
params["interval"] = chosenPlan?.lowercased()
|
|
1806
1852
|
}
|
|
1807
1853
|
|
|
1808
|
-
//
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
// ✅ Flatten metadata into requestBody
|
|
1814
|
-
if let metadata = request?.metadata, !metadata.isEmpty {
|
|
1815
|
-
for (key, value) in metadata {
|
|
1816
|
-
params[key] = value
|
|
1817
|
-
}
|
|
1818
|
-
}
|
|
1854
|
+
// ✅ Include metadata only if it has at least 1 key-value pair
|
|
1855
|
+
if let metadata = request?.metadata, !metadata.isEmpty {
|
|
1856
|
+
params["metadata"] = metadata
|
|
1857
|
+
}
|
|
1819
1858
|
|
|
1820
1859
|
print(params)
|
|
1821
1860
|
|
|
@@ -1982,6 +2021,11 @@ class BillingInfoVC: BaseVC {
|
|
|
1982
2021
|
params["interval"] = chosenPlan?.lowercased()
|
|
1983
2022
|
}
|
|
1984
2023
|
|
|
2024
|
+
// ✅ Include metadata only if it has at least 1 key-value pair
|
|
2025
|
+
if let metadata = request?.metadata, !metadata.isEmpty {
|
|
2026
|
+
params["metadata"] = metadata
|
|
2027
|
+
}
|
|
2028
|
+
|
|
1985
2029
|
print(params)
|
|
1986
2030
|
|
|
1987
2031
|
do {
|
|
@@ -2152,6 +2196,11 @@ class BillingInfoVC: BaseVC {
|
|
|
2152
2196
|
params["interval"] = chosenPlan?.lowercased()
|
|
2153
2197
|
}
|
|
2154
2198
|
|
|
2199
|
+
// ✅ Include metadata only if it has at least 1 key-value pair
|
|
2200
|
+
if let metadata = request?.metadata, !metadata.isEmpty {
|
|
2201
|
+
params["metadata"] = metadata
|
|
2202
|
+
}
|
|
2203
|
+
|
|
2155
2204
|
print(params)
|
|
2156
2205
|
|
|
2157
2206
|
do {
|
|
@@ -2332,6 +2381,199 @@ class BillingInfoVC: BaseVC {
|
|
|
2332
2381
|
params["interval"] = chosenPlan?.lowercased()
|
|
2333
2382
|
}
|
|
2334
2383
|
|
|
2384
|
+
// ✅ Include metadata only if it has at least 1 key-value pair
|
|
2385
|
+
if let metadata = request?.metadata, !metadata.isEmpty {
|
|
2386
|
+
params["metadata"] = metadata
|
|
2387
|
+
}
|
|
2388
|
+
|
|
2389
|
+
print(params)
|
|
2390
|
+
|
|
2391
|
+
do {
|
|
2392
|
+
let jsonData = try JSONSerialization.data(withJSONObject: params, options: .prettyPrinted)
|
|
2393
|
+
uRLRequest.httpBody = jsonData
|
|
2394
|
+
if let jsonString = String(data: jsonData, encoding: .utf8) {
|
|
2395
|
+
print("JSON Payload: \(jsonString)")
|
|
2396
|
+
}
|
|
2397
|
+
} catch let error {
|
|
2398
|
+
print("Error creating JSON data: \(error)")
|
|
2399
|
+
hideLoadingIndicator()
|
|
2400
|
+
return
|
|
2401
|
+
}
|
|
2402
|
+
|
|
2403
|
+
let session = URLSession.shared
|
|
2404
|
+
let task = session.dataTask(with: uRLRequest) { (serviceData, serviceResponse, error) in
|
|
2405
|
+
|
|
2406
|
+
DispatchQueue.main.async {
|
|
2407
|
+
self.hideLoadingIndicator() // Stop loader when response is received
|
|
2408
|
+
}
|
|
2409
|
+
|
|
2410
|
+
if let error = error {
|
|
2411
|
+
self.presentPaymentErrorVC(errorMessage: error.localizedDescription)
|
|
2412
|
+
return
|
|
2413
|
+
}
|
|
2414
|
+
|
|
2415
|
+
guard let httpResponse = serviceResponse as? HTTPURLResponse else {
|
|
2416
|
+
self.presentPaymentErrorVC(errorMessage: "Invalid response")
|
|
2417
|
+
return
|
|
2418
|
+
}
|
|
2419
|
+
|
|
2420
|
+
if httpResponse.statusCode == 200 || httpResponse.statusCode == 201 {
|
|
2421
|
+
if let data = serviceData {
|
|
2422
|
+
do {
|
|
2423
|
+
if let responseObject = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] {
|
|
2424
|
+
print("Response Data: \(responseObject)")
|
|
2425
|
+
|
|
2426
|
+
// Check if status is 0 and handle the error
|
|
2427
|
+
if let status = responseObject["status"] as? Int, status == 0 {
|
|
2428
|
+
let errorMessage = responseObject["message"] as? String ?? "Unknown error"
|
|
2429
|
+
self.presentPaymentErrorVC(errorMessage: errorMessage)
|
|
2430
|
+
} else {
|
|
2431
|
+
DispatchQueue.main.async {
|
|
2432
|
+
if let paymentDoneVC = self.storyboard?.instantiateViewController(withIdentifier: "PaymentDoneVC") as? PaymentDoneVC {
|
|
2433
|
+
paymentDoneVC.chargeData = responseObject
|
|
2434
|
+
paymentDoneVC.selectedPaymentMethod = self.selectedPaymentMethod
|
|
2435
|
+
paymentDoneVC.easyPayDelegate = self.easyPayDelegate
|
|
2436
|
+
paymentDoneVC.bankPaymentParams = params
|
|
2437
|
+
// Pass billing and additional info
|
|
2438
|
+
// Conditionally pass raw FieldItem array
|
|
2439
|
+
paymentDoneVC.visibility = self.visibility
|
|
2440
|
+
paymentDoneVC.request = self.request
|
|
2441
|
+
|
|
2442
|
+
// if self.visibility?.billing == true {
|
|
2443
|
+
paymentDoneVC.billingInfoData = self.billingInfo
|
|
2444
|
+
var billingDict: [String: Any] = [:]
|
|
2445
|
+
self.billingInfo?.forEach { billingDict[$0.name] = $0.value }
|
|
2446
|
+
paymentDoneVC.billingInfo = billingDict
|
|
2447
|
+
// }
|
|
2448
|
+
|
|
2449
|
+
// if self.visibility?.additional == true {
|
|
2450
|
+
paymentDoneVC.additionalInfoData = self.additionalInfo
|
|
2451
|
+
var additionalDict: [String: Any] = [:]
|
|
2452
|
+
self.additionalInfo?.forEach { additionalDict[$0.name] = $0.value }
|
|
2453
|
+
paymentDoneVC.additionalInfo = additionalDict
|
|
2454
|
+
// }
|
|
2455
|
+
self.navigationController?.pushViewController(paymentDoneVC, animated: true)
|
|
2456
|
+
}
|
|
2457
|
+
}
|
|
2458
|
+
}
|
|
2459
|
+
} else {
|
|
2460
|
+
self.presentPaymentErrorVC(errorMessage: "Invalid JSON format")
|
|
2461
|
+
}
|
|
2462
|
+
} catch let jsonError {
|
|
2463
|
+
self.presentPaymentErrorVC(errorMessage: "Error parsing JSON: \(jsonError)")
|
|
2464
|
+
}
|
|
2465
|
+
} else {
|
|
2466
|
+
self.presentPaymentErrorVC(errorMessage: "No data received")
|
|
2467
|
+
}
|
|
2468
|
+
} else {
|
|
2469
|
+
if let data = serviceData,
|
|
2470
|
+
let responseObj = try? JSONSerialization.jsonObject(with: data, options: []) as? [String: Any],
|
|
2471
|
+
let message = responseObj["message"] as? String {
|
|
2472
|
+
self.presentPaymentErrorVC(errorMessage: message)
|
|
2473
|
+
} else {
|
|
2474
|
+
self.presentPaymentErrorVC(errorMessage: "HTTP Status Code: \(httpResponse.statusCode)")
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2477
|
+
}
|
|
2478
|
+
task.resume()
|
|
2479
|
+
}
|
|
2480
|
+
|
|
2481
|
+
//MARK: - Account Charge Api if user logged in and saved the account.
|
|
2482
|
+
func accountChargeWithSaveApi(customerId: String?) {
|
|
2483
|
+
showLoadingIndicator()
|
|
2484
|
+
|
|
2485
|
+
let fullURL = EnvironmentConfig.baseURL + EnvironmentConfig.Endpoints.achCharge.path()
|
|
2486
|
+
|
|
2487
|
+
guard let serviceURL = URL(string: fullURL) else {
|
|
2488
|
+
print("Invalid URL")
|
|
2489
|
+
hideLoadingIndicator()
|
|
2490
|
+
return
|
|
2491
|
+
}
|
|
2492
|
+
|
|
2493
|
+
var uRLRequest = URLRequest(url: serviceURL)
|
|
2494
|
+
uRLRequest.httpMethod = "POST"
|
|
2495
|
+
uRLRequest.addValue("application/json", forHTTPHeaderField: "Content-Type")
|
|
2496
|
+
|
|
2497
|
+
let token = UserStoreSingleton.shared.clientToken
|
|
2498
|
+
print("Setting clientToken header: \(token ?? "None")")
|
|
2499
|
+
uRLRequest.addValue(token ?? "", forHTTPHeaderField: "Client-Token")
|
|
2500
|
+
|
|
2501
|
+
let emailPrefix = UserStoreSingleton.shared.verificationEmail?.components(separatedBy: "@").first ?? ""
|
|
2502
|
+
|
|
2503
|
+
var params: [String: Any] = [
|
|
2504
|
+
// "name": accountName ?? "",
|
|
2505
|
+
"name": !(request.name?.isEmpty ?? true) ? request.name! : (accountName ?? ""),
|
|
2506
|
+
"email": userEmail ?? "",
|
|
2507
|
+
"currency": "usd",
|
|
2508
|
+
"account_type": accountType?.lowercased() ?? "",
|
|
2509
|
+
"routing_number": routingNumber ?? "",
|
|
2510
|
+
"account_number": accountNumber ?? "",
|
|
2511
|
+
"payment_mode": "auth_and_capture",
|
|
2512
|
+
"payment_intent": UserStoreSingleton.shared.paymentIntent ?? "",
|
|
2513
|
+
"levelIndicator": 1,
|
|
2514
|
+
"save_account": 1,
|
|
2515
|
+
"payment_method": "ach"
|
|
2516
|
+
]
|
|
2517
|
+
|
|
2518
|
+
if let customerId = customerId {
|
|
2519
|
+
params["customer"] = customerId
|
|
2520
|
+
} else {
|
|
2521
|
+
params["username"] = emailPrefix
|
|
2522
|
+
}
|
|
2523
|
+
|
|
2524
|
+
if customerId == nil {
|
|
2525
|
+
params["create_customer"] = "1"
|
|
2526
|
+
}
|
|
2527
|
+
|
|
2528
|
+
// Conditionally add billing info
|
|
2529
|
+
if let visibility = visibility, visibility.billing == true,
|
|
2530
|
+
let billing = billingInfo, !billing.isEmpty {
|
|
2531
|
+
|
|
2532
|
+
var billingInfoDict: [String: Any] = [:]
|
|
2533
|
+
for item in billing {
|
|
2534
|
+
billingInfoDict[item.name] = item.value
|
|
2535
|
+
}
|
|
2536
|
+
|
|
2537
|
+
params["address"] = billingInfoDict["address"] as? String ?? ""
|
|
2538
|
+
params["country"] = billingInfoDict["country"] as? String ?? ""
|
|
2539
|
+
params["state"] = billingInfoDict["state"] as? String ?? ""
|
|
2540
|
+
params["city"] = billingInfoDict["city"] as? String ?? ""
|
|
2541
|
+
params["zip"] = billingInfoDict["postal_code"] as? String ?? ""
|
|
2542
|
+
}
|
|
2543
|
+
|
|
2544
|
+
// Set default description if additional info is not visible
|
|
2545
|
+
if let visibility = visibility, visibility.additional == false {
|
|
2546
|
+
params["description"] = "Hosted payment checkout"
|
|
2547
|
+
}
|
|
2548
|
+
|
|
2549
|
+
// Add these if recurring is enabled
|
|
2550
|
+
if let req = request, req.is_recurring == true {
|
|
2551
|
+
if let recurringType = req.recurringStartDateType, recurringType == .custom {
|
|
2552
|
+
// Only send start_date if type is .custom and field is not empty
|
|
2553
|
+
if let startDateText = startDate, !startDateText.isEmpty {
|
|
2554
|
+
let inputFormatter = DateFormatter()
|
|
2555
|
+
inputFormatter.dateFormat = "dd/MM/yyyy"
|
|
2556
|
+
|
|
2557
|
+
let outputFormatter = DateFormatter()
|
|
2558
|
+
outputFormatter.dateFormat = "MM/dd/yyyy"
|
|
2559
|
+
|
|
2560
|
+
if let date = inputFormatter.date(from: startDateText) {
|
|
2561
|
+
let apiFormattedDate = outputFormatter.string(from: date)
|
|
2562
|
+
params["start_date"] = apiFormattedDate
|
|
2563
|
+
} else {
|
|
2564
|
+
print("Invalid date format in startDateText")
|
|
2565
|
+
}
|
|
2566
|
+
}
|
|
2567
|
+
}
|
|
2568
|
+
|
|
2569
|
+
params["interval"] = chosenPlan?.lowercased()
|
|
2570
|
+
}
|
|
2571
|
+
|
|
2572
|
+
// ✅ Include metadata only if it has at least 1 key-value pair
|
|
2573
|
+
if let metadata = request?.metadata, !metadata.isEmpty {
|
|
2574
|
+
params["metadata"] = metadata
|
|
2575
|
+
}
|
|
2576
|
+
|
|
2335
2577
|
print(params)
|
|
2336
2578
|
|
|
2337
2579
|
do {
|
|
@@ -2459,6 +2701,26 @@ class BillingInfoVC: BaseVC {
|
|
|
2459
2701
|
"email": userEmail ?? ""
|
|
2460
2702
|
]
|
|
2461
2703
|
|
|
2704
|
+
// ✅ Only add these params for logged-in users
|
|
2705
|
+
if UserStoreSingleton.shared.isLoggedIn == true {
|
|
2706
|
+
let emailText = userEmail
|
|
2707
|
+
let emailPrefix = emailText?.components(separatedBy: "@").first ?? ""
|
|
2708
|
+
|
|
2709
|
+
params["save_account"] = 1
|
|
2710
|
+
params["is_default"] = 1
|
|
2711
|
+
params["customer_id"] = UserStoreSingleton.shared.customerId ?? ""
|
|
2712
|
+
|
|
2713
|
+
if let customerId = UserStoreSingleton.shared.customerId, !customerId.isEmpty {
|
|
2714
|
+
params["customer"] = customerId
|
|
2715
|
+
} else {
|
|
2716
|
+
params["username"] = emailPrefix
|
|
2717
|
+
}
|
|
2718
|
+
|
|
2719
|
+
if UserStoreSingleton.shared.customerId == nil {
|
|
2720
|
+
params["create_customer"] = "1"
|
|
2721
|
+
}
|
|
2722
|
+
}
|
|
2723
|
+
|
|
2462
2724
|
// Conditionally add billing info
|
|
2463
2725
|
if let visibility = visibility, visibility.billing == true,
|
|
2464
2726
|
let billing = billingInfo, !billing.isEmpty {
|
|
@@ -2503,6 +2765,11 @@ class BillingInfoVC: BaseVC {
|
|
|
2503
2765
|
params["interval"] = chosenPlan?.lowercased()
|
|
2504
2766
|
}
|
|
2505
2767
|
|
|
2768
|
+
// ✅ Include metadata only if it has at least 1 key-value pair
|
|
2769
|
+
if let metadata = request?.metadata, !metadata.isEmpty {
|
|
2770
|
+
params["metadata"] = metadata
|
|
2771
|
+
}
|
|
2772
|
+
|
|
2506
2773
|
print(params)
|
|
2507
2774
|
|
|
2508
2775
|
do {
|
|
@@ -2723,6 +2990,11 @@ class BillingInfoVC: BaseVC {
|
|
|
2723
2990
|
params["interval"] = chosenPlan?.lowercased()
|
|
2724
2991
|
}
|
|
2725
2992
|
|
|
2993
|
+
// ✅ Include metadata only if it has at least 1 key-value pair
|
|
2994
|
+
if let metadata = request?.metadata, !metadata.isEmpty {
|
|
2995
|
+
params["metadata"] = metadata
|
|
2996
|
+
}
|
|
2997
|
+
|
|
2726
2998
|
print(params)
|
|
2727
2999
|
|
|
2728
3000
|
do {
|