expo-openpay 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +5 -0
- package/LICENSE +21 -0
- package/README.md +87 -0
- package/android/build.gradle +76 -0
- package/android/gradle.properties +2 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/expo/modules/openpay/ExpoOpenpayModule.kt +127 -0
- package/android/src/main/java/expo/modules/openpay/ExpoOpenpayView.kt +30 -0
- package/android/src/main/java/mx/openpay/android/BuildConfig.java +8 -0
- package/android/src/main/java/mx/openpay/android/DeviceCollectorDefaultImpl.java +70 -0
- package/android/src/main/java/mx/openpay/android/JavaScriptInterface.java +19 -0
- package/android/src/main/java/mx/openpay/android/OpCountry.java +24 -0
- package/android/src/main/java/mx/openpay/android/OpenPayResult.java +35 -0
- package/android/src/main/java/mx/openpay/android/Openpay.java +98 -0
- package/android/src/main/java/mx/openpay/android/OpenpayUrls.java +11 -0
- package/android/src/main/java/mx/openpay/android/OperationCallBack.java +13 -0
- package/android/src/main/java/mx/openpay/android/OperationResult.java +14 -0
- package/android/src/main/java/mx/openpay/android/exceptions/OpenpayServiceException.java +93 -0
- package/android/src/main/java/mx/openpay/android/exceptions/ServiceUnavailableException.java +23 -0
- package/android/src/main/java/mx/openpay/android/model/Address.java +123 -0
- package/android/src/main/java/mx/openpay/android/model/Card.java +219 -0
- package/android/src/main/java/mx/openpay/android/model/Token.java +43 -0
- package/android/src/main/java/mx/openpay/android/services/BaseService.java +93 -0
- package/android/src/main/java/mx/openpay/android/services/ServicesFactory.java +47 -0
- package/android/src/main/java/mx/openpay/android/services/TokenService.java +19 -0
- package/android/src/main/java/mx/openpay/android/validation/CardType.java +9 -0
- package/android/src/main/java/mx/openpay/android/validation/CardValidator.java +105 -0
- package/android/src/main/java/mx/openpay/android/validation/LuhnValidator.java +34 -0
- package/build/ExpoOpenpay.types.d.ts +42 -0
- package/build/ExpoOpenpay.types.d.ts.map +1 -0
- package/build/ExpoOpenpay.types.js +2 -0
- package/build/ExpoOpenpay.types.js.map +1 -0
- package/build/ExpoOpenpayModule.d.ts +10 -0
- package/build/ExpoOpenpayModule.d.ts.map +1 -0
- package/build/ExpoOpenpayModule.js +6 -0
- package/build/ExpoOpenpayModule.js.map +1 -0
- package/build/ExpoOpenpayModule.web.d.ts +10 -0
- package/build/ExpoOpenpayModule.web.d.ts.map +1 -0
- package/build/ExpoOpenpayModule.web.js +12 -0
- package/build/ExpoOpenpayModule.web.js.map +1 -0
- package/build/ExpoOpenpayView.d.ts +4 -0
- package/build/ExpoOpenpayView.d.ts.map +1 -0
- package/build/ExpoOpenpayView.js +7 -0
- package/build/ExpoOpenpayView.js.map +1 -0
- package/build/ExpoOpenpayView.web.d.ts +3 -0
- package/build/ExpoOpenpayView.web.d.ts.map +1 -0
- package/build/ExpoOpenpayView.web.js +5 -0
- package/build/ExpoOpenpayView.web.js.map +1 -0
- package/build/assets/AmexLogo.d.ts +4 -0
- package/build/assets/AmexLogo.d.ts.map +1 -0
- package/build/assets/AmexLogo.js +9 -0
- package/build/assets/AmexLogo.js.map +1 -0
- package/build/assets/MCLogo.d.ts +4 -0
- package/build/assets/MCLogo.d.ts.map +1 -0
- package/build/assets/MCLogo.js +9 -0
- package/build/assets/MCLogo.js.map +1 -0
- package/build/assets/VisaLogo.d.ts +4 -0
- package/build/assets/VisaLogo.d.ts.map +1 -0
- package/build/assets/VisaLogo.js +6 -0
- package/build/assets/VisaLogo.js.map +1 -0
- package/build/assets/index.d.ts +4 -0
- package/build/assets/index.d.ts.map +1 -0
- package/build/assets/index.js +4 -0
- package/build/assets/index.js.map +1 -0
- package/build/components/OPCardForm.d.ts +33 -0
- package/build/components/OPCardForm.d.ts.map +1 -0
- package/build/components/OPCardForm.js +120 -0
- package/build/components/OPCardForm.js.map +1 -0
- package/build/components/OPCardNumberInput.d.ts +17 -0
- package/build/components/OPCardNumberInput.d.ts.map +1 -0
- package/build/components/OPCardNumberInput.js +60 -0
- package/build/components/OPCardNumberInput.js.map +1 -0
- package/build/components/OPCvv2Input.d.ts +17 -0
- package/build/components/OPCvv2Input.d.ts.map +1 -0
- package/build/components/OPCvv2Input.js +13 -0
- package/build/components/OPCvv2Input.js.map +1 -0
- package/build/components/OPExpInput.d.ts +17 -0
- package/build/components/OPExpInput.d.ts.map +1 -0
- package/build/components/OPExpInput.js +22 -0
- package/build/components/OPExpInput.js.map +1 -0
- package/build/components/OPExpMonthInput.d.ts +17 -0
- package/build/components/OPExpMonthInput.d.ts.map +1 -0
- package/build/components/OPExpMonthInput.js +6 -0
- package/build/components/OPExpMonthInput.js.map +1 -0
- package/build/components/OPExpYearInput.d.ts +17 -0
- package/build/components/OPExpYearInput.d.ts.map +1 -0
- package/build/components/OPExpYearInput.js +6 -0
- package/build/components/OPExpYearInput.js.map +1 -0
- package/build/components/OPHolderNameInput.d.ts +17 -0
- package/build/components/OPHolderNameInput.d.ts.map +1 -0
- package/build/components/OPHolderNameInput.js +6 -0
- package/build/components/OPHolderNameInput.js.map +1 -0
- package/build/components/forms/ErrorMessage.d.ts +7 -0
- package/build/components/forms/ErrorMessage.d.ts.map +1 -0
- package/build/components/forms/ErrorMessage.js +12 -0
- package/build/components/forms/ErrorMessage.js.map +1 -0
- package/build/components/forms/FormField.d.ts +34 -0
- package/build/components/forms/FormField.d.ts.map +1 -0
- package/build/components/forms/FormField.js +33 -0
- package/build/components/forms/FormField.js.map +1 -0
- package/build/components/forms/SubmitButton.d.ts +11 -0
- package/build/components/forms/SubmitButton.d.ts.map +1 -0
- package/build/components/forms/SubmitButton.js +45 -0
- package/build/components/forms/SubmitButton.js.map +1 -0
- package/build/components/forms/Text.d.ts +7 -0
- package/build/components/forms/Text.d.ts.map +1 -0
- package/build/components/forms/Text.js +12 -0
- package/build/components/forms/Text.js.map +1 -0
- package/build/components/forms/TextInput.d.ts +30 -0
- package/build/components/forms/TextInput.d.ts.map +1 -0
- package/build/components/forms/TextInput.js +195 -0
- package/build/components/forms/TextInput.js.map +1 -0
- package/build/components/forms/index.d.ts +4 -0
- package/build/components/forms/index.d.ts.map +1 -0
- package/build/components/forms/index.js +5 -0
- package/build/components/forms/index.js.map +1 -0
- package/build/components/index.d.ts +8 -0
- package/build/components/index.d.ts.map +1 -0
- package/build/components/index.js +8 -0
- package/build/components/index.js.map +1 -0
- package/build/constants/Colors.d.ts +27 -0
- package/build/constants/Colors.d.ts.map +1 -0
- package/build/constants/Colors.js +27 -0
- package/build/constants/Colors.js.map +1 -0
- package/build/constants/Styles.d.ts +9 -0
- package/build/constants/Styles.d.ts.map +1 -0
- package/build/constants/Styles.js +9 -0
- package/build/constants/Styles.js.map +1 -0
- package/build/context/FormContext.d.ts +22 -0
- package/build/context/FormContext.d.ts.map +1 -0
- package/build/context/FormContext.js +63 -0
- package/build/context/FormContext.js.map +1 -0
- package/build/context/FormThemeContext.d.ts +20 -0
- package/build/context/FormThemeContext.d.ts.map +1 -0
- package/build/context/FormThemeContext.js +21 -0
- package/build/context/FormThemeContext.js.map +1 -0
- package/build/context/index.d.ts +4 -0
- package/build/context/index.d.ts.map +1 -0
- package/build/context/index.js +3 -0
- package/build/context/index.js.map +1 -0
- package/build/index.d.ts +6 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +18 -0
- package/build/index.js.map +1 -0
- package/build/utility/cardBranding.d.ts +2 -0
- package/build/utility/cardBranding.d.ts.map +1 -0
- package/build/utility/cardBranding.js +2 -0
- package/build/utility/cardBranding.js.map +1 -0
- package/build/utility/formatting.d.ts +4 -0
- package/build/utility/formatting.d.ts.map +1 -0
- package/build/utility/formatting.js +20 -0
- package/build/utility/formatting.js.map +1 -0
- package/expo-module.config.json +9 -0
- package/ios/ExpoOpenpay.podspec +30 -0
- package/ios/Frameworks/OpenpayKit.xcframework/Info.plist +40 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64/OpenpayKit.framework/Headers/OpenpayKit-Swift.h +274 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64/OpenpayKit.framework/Info.plist +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64/OpenpayKit.framework/Modules/OpenpayKit.swiftmodule/arm64-apple-ios.abi.json +5179 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64/OpenpayKit.framework/Modules/OpenpayKit.swiftmodule/arm64-apple-ios.private.swiftinterface +127 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64/OpenpayKit.framework/Modules/OpenpayKit.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64/OpenpayKit.framework/Modules/OpenpayKit.swiftmodule/arm64-apple-ios.swiftinterface +127 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64/OpenpayKit.framework/Modules/module.modulemap +4 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64/OpenpayKit.framework/OpenpayKit +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64/OpenpayKit.framework/_CodeSignature/CodeResources +287 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64/OpenpayKit.framework/en.lproj/CardView.nib +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64/OpenpayKit.framework/en.lproj/Localizable.strings +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64/OpenpayKit.framework/es-MX.lproj/CardView.nib +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64/OpenpayKit.framework/es-MX.lproj/Localizable.strings +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64/OpenpayKit.framework/es.lproj/CardView.nib +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64/OpenpayKit.framework/es.lproj/Localizable.strings +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/Headers/OpenpayKit-Swift.h +544 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/Info.plist +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/Modules/OpenpayKit.swiftmodule/arm64-apple-ios-simulator.abi.json +5179 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/Modules/OpenpayKit.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +127 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/Modules/OpenpayKit.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/Modules/OpenpayKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +127 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/Modules/OpenpayKit.swiftmodule/x86_64-apple-ios-simulator.abi.json +5179 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/Modules/OpenpayKit.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +127 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/Modules/OpenpayKit.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/Modules/OpenpayKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +127 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/Modules/module.modulemap +4 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/OpenpayKit +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/_CodeSignature/CodeResources +342 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/en.lproj/CardView.nib +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/en.lproj/Localizable.strings +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/es-MX.lproj/CardView.nib +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/es-MX.lproj/Localizable.strings +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/es.lproj/CardView.nib +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/es.lproj/Localizable.strings +0 -0
- package/ios/src/ExpoOpenpayModule.swift +105 -0
- package/ios/src/ExpoOpenpayView.swift +38 -0
- package/package.json +46 -0
- package/src/ExpoOpenpay.types.ts +47 -0
- package/src/ExpoOpenpayModule.ts +29 -0
- package/src/ExpoOpenpayModule.web.ts +15 -0
- package/src/ExpoOpenpayView.tsx +11 -0
- package/src/ExpoOpenpayView.web.tsx +5 -0
- package/src/assets/AmexLogo.tsx +24 -0
- package/src/assets/MCLogo.tsx +19 -0
- package/src/assets/VisaLogo.tsx +11 -0
- package/src/assets/index.ts +3 -0
- package/src/assets/photos/discover_logo.png +0 -0
- package/src/components/OPCardForm.tsx +303 -0
- package/src/components/OPCardNumberInput.tsx +126 -0
- package/src/components/OPCvv2Input.tsx +62 -0
- package/src/components/OPExpInput.tsx +74 -0
- package/src/components/OPExpMonthInput.tsx +55 -0
- package/src/components/OPExpYearInput.tsx +55 -0
- package/src/components/OPHolderNameInput.tsx +53 -0
- package/src/components/forms/ErrorMessage.tsx +19 -0
- package/src/components/forms/FormField.tsx +96 -0
- package/src/components/forms/SubmitButton.tsx +81 -0
- package/src/components/forms/Text.tsx +20 -0
- package/src/components/forms/TextInput.tsx +329 -0
- package/src/components/forms/index.ts +4 -0
- package/src/components/index.ts +7 -0
- package/src/constants/Colors.ts +26 -0
- package/src/constants/Styles.ts +9 -0
- package/src/context/FormContext.tsx +109 -0
- package/src/context/FormThemeContext.tsx +55 -0
- package/src/context/index.ts +3 -0
- package/src/index.ts +19 -0
- package/src/utility/cardBranding.ts +0 -0
- package/src/utility/formatting.ts +23 -0
- package/tsconfig.json +9 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
package mx.openpay.android.validation;
|
|
2
|
+
|
|
3
|
+
import android.annotation.SuppressLint;
|
|
4
|
+
import java.text.ParseException;
|
|
5
|
+
import java.text.SimpleDateFormat;
|
|
6
|
+
import java.util.Calendar;
|
|
7
|
+
import java.util.Date;
|
|
8
|
+
import java.util.GregorianCalendar;
|
|
9
|
+
|
|
10
|
+
@SuppressLint({"SimpleDateFormat"})
|
|
11
|
+
/* loaded from: CardValidator.class */
|
|
12
|
+
public class CardValidator {
|
|
13
|
+
public static boolean validateCard(final String holderName, final String cardNumber, final Integer expMonth, final Integer expYear, final String cvv) {
|
|
14
|
+
return validateHolderName(holderName) && validateCVV(cvv, cardNumber) && validateExpiryDate(expMonth, expYear) && validateNumber(cardNumber);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public static boolean validateHolderName(final String holderName) {
|
|
18
|
+
return holderName != null && holderName.trim().length() > 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public static boolean validateCVV(final String cvv, final String cardNumber) {
|
|
22
|
+
if (cvv == null || cvv.trim().length() == 0) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
CardType type = getType(cardNumber);
|
|
26
|
+
if (CardType.AMEX.equals(type) && cvv.trim().length() != 4) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
if (((CardType.MASTERCARD.equals(type) || CardType.VISA.equals(type)) && cvv.trim().length() != 3) || CardType.UNKNOWN.equals(type)) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public static boolean validateExpiryDate(final Integer expirationMonth, final Integer expirationYear) {
|
|
36
|
+
if (!validateMonth(expirationMonth) || expirationYear == null) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
Calendar today = new GregorianCalendar();
|
|
40
|
+
SimpleDateFormat dateFormat = new SimpleDateFormat("MM-yy");
|
|
41
|
+
try {
|
|
42
|
+
Date expirationDate = dateFormat.parse(expirationMonth + "-" + expirationYear);
|
|
43
|
+
Calendar cardExpiration = new GregorianCalendar();
|
|
44
|
+
cardExpiration.setTime(expirationDate);
|
|
45
|
+
if (cardExpiration.get(1) > today.get(1)) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
if (cardExpiration.get(1) == today.get(1)) {
|
|
49
|
+
if (cardExpiration.get(2) >= today.get(2)) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
return false;
|
|
55
|
+
} catch (ParseException e) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
public static boolean validateMonth(final Integer month) {
|
|
61
|
+
return month != null && month.intValue() >= 1 && month.intValue() <= 12;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public static boolean validateNumber(final String number) {
|
|
65
|
+
if (number == null || number.trim().length() == 0 || !LuhnValidator.passesLuhnTest(number)) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
String trimNumber = number.trim();
|
|
69
|
+
CardType type = getType(number);
|
|
70
|
+
if (CardType.AMEX.equals(type) && trimNumber.length() != 15) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
if (CardType.MASTERCARD.equals(type) && trimNumber.length() != 16) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
if ((CardType.VISA.equals(type) && trimNumber.length() != 16 && trimNumber.length() != 13) || CardType.UNKNOWN.equals(type)) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
public static boolean startsWith(final String cardNumber, final String... prefixes) {
|
|
83
|
+
for (String prefix : prefixes) {
|
|
84
|
+
if (cardNumber.startsWith(prefix)) {
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
public static CardType getType(final String cardNumber) {
|
|
92
|
+
if (cardNumber != null && cardNumber.trim().length() > 0) {
|
|
93
|
+
if (startsWith(cardNumber, "34", "37")) {
|
|
94
|
+
return CardType.AMEX;
|
|
95
|
+
}
|
|
96
|
+
if (startsWith(cardNumber, "4")) {
|
|
97
|
+
return CardType.VISA;
|
|
98
|
+
}
|
|
99
|
+
if (startsWith(cardNumber, "51", "52", "53", "54", "55")) {
|
|
100
|
+
return CardType.MASTERCARD;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return CardType.UNKNOWN;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
package mx.openpay.android.validation;
|
|
2
|
+
|
|
3
|
+
import java.util.ArrayList;
|
|
4
|
+
import java.util.List;
|
|
5
|
+
|
|
6
|
+
/* loaded from: LuhnValidator.class */
|
|
7
|
+
public class LuhnValidator {
|
|
8
|
+
private static final int multiplicator = 2;
|
|
9
|
+
|
|
10
|
+
public static boolean passesLuhnTest(String value) {
|
|
11
|
+
char[] chars = value.toCharArray();
|
|
12
|
+
List<Integer> digits = new ArrayList<>();
|
|
13
|
+
for (char c : chars) {
|
|
14
|
+
if (Character.isDigit(c)) {
|
|
15
|
+
digits.add(Integer.valueOf(c - '0'));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
int length = digits.size();
|
|
19
|
+
int sum = 0;
|
|
20
|
+
boolean even = false;
|
|
21
|
+
for (int index = length - 1; index >= 0; index--) {
|
|
22
|
+
int digit = digits.get(index).intValue();
|
|
23
|
+
if (even) {
|
|
24
|
+
digit *= multiplicator;
|
|
25
|
+
}
|
|
26
|
+
if (digit > 9) {
|
|
27
|
+
digit = (digit / 10) + (digit % 10);
|
|
28
|
+
}
|
|
29
|
+
sum += digit;
|
|
30
|
+
even = !even;
|
|
31
|
+
}
|
|
32
|
+
return sum % 10 == 0;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { StyleProp, ViewStyle } from "react-native";
|
|
2
|
+
export type OnLoadEventPayload = {
|
|
3
|
+
url: string;
|
|
4
|
+
};
|
|
5
|
+
export type ExpoOpenpayModuleEvents = {
|
|
6
|
+
onChange: (params: ChangeEventPayload) => void;
|
|
7
|
+
};
|
|
8
|
+
export type ChangeEventPayload = {
|
|
9
|
+
value: string;
|
|
10
|
+
};
|
|
11
|
+
export type CountryCode = "MX" | "CO" | "PE";
|
|
12
|
+
export type ExpoOpenpayViewProps = {
|
|
13
|
+
url: string;
|
|
14
|
+
onLoad: (event: {
|
|
15
|
+
nativeEvent: OnLoadEventPayload;
|
|
16
|
+
}) => void;
|
|
17
|
+
style?: StyleProp<ViewStyle>;
|
|
18
|
+
};
|
|
19
|
+
export interface OpenpayInitOptions {
|
|
20
|
+
merchantId: string;
|
|
21
|
+
apiKey: string;
|
|
22
|
+
isProduction: boolean;
|
|
23
|
+
isDebug: boolean;
|
|
24
|
+
countryCode?: CountryCode;
|
|
25
|
+
}
|
|
26
|
+
export interface CardData {
|
|
27
|
+
cardNumber: string;
|
|
28
|
+
holderName: string;
|
|
29
|
+
expirationMonth: string;
|
|
30
|
+
expirationYear: string;
|
|
31
|
+
cvv2: string;
|
|
32
|
+
}
|
|
33
|
+
export interface OpenpayToken {
|
|
34
|
+
id: string;
|
|
35
|
+
brand: string;
|
|
36
|
+
card_number: string;
|
|
37
|
+
holder_name: string;
|
|
38
|
+
expiration_year: number;
|
|
39
|
+
expiration_month: number;
|
|
40
|
+
type: string;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=ExpoOpenpay.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpoOpenpay.types.d.ts","sourceRoot":"","sources":["../src/ExpoOpenpay.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE7C,MAAM,MAAM,oBAAoB,GAAG;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE,kBAAkB,CAAA;KAAE,KAAK,IAAI,CAAC;IAC7D,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC;AAEF,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,MAAM,WAAW,QAAQ;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpoOpenpay.types.js","sourceRoot":"","sources":["../src/ExpoOpenpay.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { StyleProp, ViewStyle } from \"react-native\";\n\nexport type OnLoadEventPayload = {\n url: string;\n};\n\nexport type ExpoOpenpayModuleEvents = {\n onChange: (params: ChangeEventPayload) => void;\n};\n\nexport type ChangeEventPayload = {\n value: string;\n};\n\nexport type CountryCode = \"MX\" | \"CO\" | \"PE\";\n\nexport type ExpoOpenpayViewProps = {\n url: string;\n onLoad: (event: { nativeEvent: OnLoadEventPayload }) => void;\n style?: StyleProp<ViewStyle>;\n};\n\nexport interface OpenpayInitOptions {\n merchantId: string;\n apiKey: string;\n isProduction: boolean;\n isDebug: boolean;\n countryCode?: CountryCode; // Optional, defaults to 'MX'\n}\n\nexport interface CardData {\n cardNumber: string;\n holderName: string;\n expirationMonth: string; // MM as string, e.g. '05'\n expirationYear: string; // YY as string, e.g. '25'\n cvv2: string; // CVV code\n}\n\nexport interface OpenpayToken {\n id: string;\n brand: string;\n card_number: string;\n holder_name: string;\n expiration_year: number;\n expiration_month: number;\n type: string;\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface ExpoOpenpayModule {
|
|
2
|
+
initialize(merchantId: string, apiKey: string, isProduction: boolean, countryCode?: "MX" | "CO" | "PE"): Promise<string>;
|
|
3
|
+
isInitialized(): Promise<boolean>;
|
|
4
|
+
createDeviceSessionId(): Promise<string>;
|
|
5
|
+
tokenizeCard(cardNumber: string, holderName: string, expirationYear: string, expirationMonth: string, cvv2: string): Promise<string>;
|
|
6
|
+
}
|
|
7
|
+
declare const Openpay: ExpoOpenpayModule;
|
|
8
|
+
export default Openpay;
|
|
9
|
+
export declare const initialize: (merchantId: string, apiKey: string, isProduction: boolean, countryCode?: "MX" | "CO" | "PE") => Promise<string>, isInitialized: () => Promise<boolean>, tokenizeCard: (cardNumber: string, holderName: string, expirationYear: string, expirationMonth: string, cvv2: string) => Promise<string>, createDeviceSessionId: () => Promise<string>;
|
|
10
|
+
//# sourceMappingURL=ExpoOpenpayModule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpoOpenpayModule.d.ts","sourceRoot":"","sources":["../src/ExpoOpenpayModule.ts"],"names":[],"mappings":"AAEA,UAAU,iBAAiB;IACzB,UAAU,CACR,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,OAAO,EACrB,WAAW,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAC/B,OAAO,CAAC,MAAM,CAAC,CAAC;IACnB,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAClC,qBAAqB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACzC,YAAY,CACV,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,EACtB,eAAe,EAAE,MAAM,EACvB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB;AAGD,QAAA,MAAM,OAAO,mBAAoD,CAAC;AAClE,eAAe,OAAO,CAAC;AACvB,eAAO,MACL,UAAU,eApBI,MAAM,UACV,MAAM,gBACA,OAAO,gBACP,IAAI,GAAG,IAAI,GAAG,IAAI,KAC/B,OAAO,CAAC,MAAM,CAAC,EAiBlB,aAAa,QAhBI,OAAO,CAAC,OAAO,CAAC,EAiBjC,YAAY,eAdE,MAAM,cACN,MAAM,kBACF,MAAM,mBACL,MAAM,QACjB,MAAM,KACX,OAAO,CAAC,MAAM,CAAC,EAUlB,qBAAqB,QAjBI,OAAO,CAAC,MAAM,CAkB9B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { requireNativeModule } from "expo";
|
|
2
|
+
// This call loads the native module object from the JSI.
|
|
3
|
+
const Openpay = requireNativeModule("Openpay");
|
|
4
|
+
export default Openpay;
|
|
5
|
+
export const { initialize, isInitialized, tokenizeCard, createDeviceSessionId, } = Openpay;
|
|
6
|
+
//# sourceMappingURL=ExpoOpenpayModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpoOpenpayModule.js","sourceRoot":"","sources":["../src/ExpoOpenpayModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAoB3C,yDAAyD;AACzD,MAAM,OAAO,GAAG,mBAAmB,CAAoB,SAAS,CAAC,CAAC;AAClE,eAAe,OAAO,CAAC;AACvB,MAAM,CAAC,MAAM,EACX,UAAU,EACV,aAAa,EACb,YAAY,EACZ,qBAAqB,GACtB,GAAG,OAAO,CAAC","sourcesContent":["import { requireNativeModule } from \"expo\";\n\ninterface ExpoOpenpayModule {\n initialize(\n merchantId: string,\n apiKey: string,\n isProduction: boolean,\n countryCode?: \"MX\" | \"CO\" | \"PE\"\n ): Promise<string>;\n isInitialized(): Promise<boolean>;\n createDeviceSessionId(): Promise<string>;\n tokenizeCard(\n cardNumber: string,\n holderName: string,\n expirationYear: string,\n expirationMonth: string,\n cvv2: string\n ): Promise<string>;\n}\n\n// This call loads the native module object from the JSI.\nconst Openpay = requireNativeModule<ExpoOpenpayModule>(\"Openpay\");\nexport default Openpay;\nexport const {\n initialize,\n isInitialized,\n tokenizeCard,\n createDeviceSessionId,\n} = Openpay;\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NativeModule } from 'expo';
|
|
2
|
+
import { ExpoOpenpayModuleEvents } from './ExpoOpenpay.types';
|
|
3
|
+
declare class ExpoOpenpayModule extends NativeModule<ExpoOpenpayModuleEvents> {
|
|
4
|
+
PI: number;
|
|
5
|
+
setValueAsync(value: string): Promise<void>;
|
|
6
|
+
hello(): string;
|
|
7
|
+
}
|
|
8
|
+
declare const _default: typeof ExpoOpenpayModule;
|
|
9
|
+
export default _default;
|
|
10
|
+
//# sourceMappingURL=ExpoOpenpayModule.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpoOpenpayModule.web.d.ts","sourceRoot":"","sources":["../src/ExpoOpenpayModule.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,YAAY,EAAE,MAAM,MAAM,CAAC;AAEvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,cAAM,iBAAkB,SAAQ,YAAY,CAAC,uBAAuB,CAAC;IACnE,EAAE,SAAW;IACP,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAGjD,KAAK;CAGN;;AAED,wBAAyE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { registerWebModule, NativeModule } from 'expo';
|
|
2
|
+
class ExpoOpenpayModule extends NativeModule {
|
|
3
|
+
PI = Math.PI;
|
|
4
|
+
async setValueAsync(value) {
|
|
5
|
+
this.emit('onChange', { value });
|
|
6
|
+
}
|
|
7
|
+
hello() {
|
|
8
|
+
return 'Hello world! 👋';
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export default registerWebModule(ExpoOpenpayModule, 'ExpoOpenpayModule');
|
|
12
|
+
//# sourceMappingURL=ExpoOpenpayModule.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpoOpenpayModule.web.js","sourceRoot":"","sources":["../src/ExpoOpenpayModule.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAIvD,MAAM,iBAAkB,SAAQ,YAAqC;IACnE,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;IACb,KAAK,CAAC,aAAa,CAAC,KAAa;QAC/B,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACnC,CAAC;IACD,KAAK;QACH,OAAO,iBAAiB,CAAC;IAC3B,CAAC;CACF;AAED,eAAe,iBAAiB,CAAC,iBAAiB,EAAE,mBAAmB,CAAC,CAAC","sourcesContent":["import { registerWebModule, NativeModule } from 'expo';\n\nimport { ExpoOpenpayModuleEvents } from './ExpoOpenpay.types';\n\nclass ExpoOpenpayModule extends NativeModule<ExpoOpenpayModuleEvents> {\n PI = Math.PI;\n async setValueAsync(value: string): Promise<void> {\n this.emit('onChange', { value });\n }\n hello() {\n return 'Hello world! 👋';\n }\n}\n\nexport default registerWebModule(ExpoOpenpayModule, 'ExpoOpenpayModule');\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpoOpenpayView.d.ts","sourceRoot":"","sources":["../src/ExpoOpenpayView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAK3D,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,KAAK,EAAE,oBAAoB,qBAElE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpoOpenpayView.js","sourceRoot":"","sources":["../src/ExpoOpenpayView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,UAAU,GACd,iBAAiB,CAAC,SAAS,CAAC,CAAC;AAE/B,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,KAA2B;IACjE,OAAO,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AACnC,CAAC","sourcesContent":["import { requireNativeView } from \"expo\";\nimport * as React from \"react\";\n\nimport { ExpoOpenpayViewProps } from \"./ExpoOpenpay.types\";\n\nconst NativeView: React.ComponentType<ExpoOpenpayViewProps> =\n requireNativeView(\"Openpay\");\n\nexport default function ExpoOpenpayView(props: ExpoOpenpayViewProps) {\n return <NativeView {...props} />;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpoOpenpayView.web.d.ts","sourceRoot":"","sources":["../src/ExpoOpenpayView.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,CAAC,OAAO,UAAU,mBAAmB,sBAE1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpoOpenpayView.web.js","sourceRoot":"","sources":["../src/ExpoOpenpayView.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,CAAC,OAAO,UAAU,mBAAmB;IACzC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;AACpC,CAAC","sourcesContent":["import * as React from \"react\";\n\nexport default function ExpoRadialChartView() {\n return <div>Not implemented</div>;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AmexLogo.d.ts","sourceRoot":"","sources":["../../src/assets/AmexLogo.tsx"],"names":[],"mappings":"AAAA,OAAY,EAAE,QAAQ,EAAQ,MAAM,kBAAkB,CAAC;AAEvD,QAAA,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,QAAQ,CAmBhC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Svg, { Path } from "react-native-svg";
|
|
2
|
+
const AmexLogo = (props) => (<Svg viewBox="0 0 70 70" {...props}>
|
|
3
|
+
<Path d="m59.4 49.7-2.6-2.9-2.7 2.9H37.4V36.2h-5.3l6.6-15.1h6.4l2.3 5.2v-5.2h8l1.4 3.9 1.4-3.9h6.1v-2.3c0-1.4-1.1-2.5-2.5-2.5H8.2c-1.4 0-2.5 1.1-2.5 2.5v32.5c0 1.4 1.1 2.5 2.5 2.5h53.6c1.4 0 2.5-1.1 2.5-2.5v-1.6z" fill="#0071ce"/>
|
|
4
|
+
<Path d="M60.1 48.1h4.2l-5.5-5.9 5.5-5.8h-4.1l-3.5 3.8-3.4-3.8h-4.2l5.6 5.9-5.6 5.8h4.1l3.5-3.8z" fill="#0071ce"/>
|
|
5
|
+
<Path d="M42.4 45.4v-1.8H49v-2.7h-6.6v-1.8h6.7v-2.7h-9.9v11.7h9.9v-2.7zM61.2 34.7h3V22.9l-4.8.1-2.6 7.3-2.7-7.3h-5v11.7h3.2v-8.2l3 8.2h2.8l3.1-8.2z" fill="#0071ce"/>
|
|
6
|
+
<Path d="M44 23h-4.1l-5.2 11.7h3.5l1-2.3h5.4l1 2.3h3.6zm-3.7 6.7 1.6-3.8 1.6 3.8zM61.4 41.9l2.9 3.2v-6.4z" fill="#0071ce"/>
|
|
7
|
+
</Svg>);
|
|
8
|
+
export default AmexLogo;
|
|
9
|
+
//# sourceMappingURL=AmexLogo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AmexLogo.js","sourceRoot":"","sources":["../../src/assets/AmexLogo.tsx"],"names":[],"mappings":"AAAA,OAAO,GAAG,EAAE,EAAY,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,QAAQ,GAAuB,CAAC,KAAK,EAAE,EAAE,CAAC,CAC9C,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,CACjC;IAAA,CAAC,IAAI,CACH,CAAC,CAAC,6MAA6M,CAC/M,IAAI,CAAC,SAAS,EAEhB;IAAA,CAAC,IAAI,CACH,CAAC,CAAC,yFAAyF,CAC3F,IAAI,CAAC,SAAS,EAEhB;IAAA,CAAC,IAAI,CACH,CAAC,CAAC,4IAA4I,CAC9I,IAAI,CAAC,SAAS,EAEhB;IAAA,CAAC,IAAI,CACH,CAAC,CAAC,kGAAkG,CACpG,IAAI,CAAC,SAAS,EAElB;EAAA,EAAE,GAAG,CAAC,CACP,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import Svg, { SvgProps, Path } from \"react-native-svg\";\n\nconst AmexLogo: React.FC<SvgProps> = (props) => (\n <Svg viewBox=\"0 0 70 70\" {...props}>\n <Path\n d=\"m59.4 49.7-2.6-2.9-2.7 2.9H37.4V36.2h-5.3l6.6-15.1h6.4l2.3 5.2v-5.2h8l1.4 3.9 1.4-3.9h6.1v-2.3c0-1.4-1.1-2.5-2.5-2.5H8.2c-1.4 0-2.5 1.1-2.5 2.5v32.5c0 1.4 1.1 2.5 2.5 2.5h53.6c1.4 0 2.5-1.1 2.5-2.5v-1.6z\"\n fill=\"#0071ce\"\n />\n <Path\n d=\"M60.1 48.1h4.2l-5.5-5.9 5.5-5.8h-4.1l-3.5 3.8-3.4-3.8h-4.2l5.6 5.9-5.6 5.8h4.1l3.5-3.8z\"\n fill=\"#0071ce\"\n />\n <Path\n d=\"M42.4 45.4v-1.8H49v-2.7h-6.6v-1.8h6.7v-2.7h-9.9v11.7h9.9v-2.7zM61.2 34.7h3V22.9l-4.8.1-2.6 7.3-2.7-7.3h-5v11.7h3.2v-8.2l3 8.2h2.8l3.1-8.2z\"\n fill=\"#0071ce\"\n />\n <Path\n d=\"M44 23h-4.1l-5.2 11.7h3.5l1-2.3h5.4l1 2.3h3.6zm-3.7 6.7 1.6-3.8 1.6 3.8zM61.4 41.9l2.9 3.2v-6.4z\"\n fill=\"#0071ce\"\n />\n </Svg>\n);\n\nexport default AmexLogo;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MCLogo.d.ts","sourceRoot":"","sources":["../../src/assets/MCLogo.tsx"],"names":[],"mappings":"AAAA,OAAY,EAAE,QAAQ,EAAQ,MAAM,kBAAkB,CAAC;AAEvD,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,QAAQ,CAe9B,CAAC;AACF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Svg, { Path } from "react-native-svg";
|
|
2
|
+
const MCLogo = (props) => (<Svg width={203.209} height={144} viewBox="0 0 152.407 108" {...props}>
|
|
3
|
+
<Path d="M0 0h152.407v108H0z" fill="none"/>
|
|
4
|
+
<Path d="M60.412 25.697h31.5v56.606h-31.5z" fill="#ff5f00"/>
|
|
5
|
+
<Path d="M382.208 306a35.94 35.94 0 0 1 13.75-28.303 36 36 0 1 0 0 56.606A35.94 35.94 0 0 1 382.208 306" fill="#eb001b" transform="translate(-319.796 -252)"/>
|
|
6
|
+
<Path d="M454.203 306a35.999 35.999 0 0 1-58.245 28.303 36.005 36.005 0 0 0 0-56.606A35.999 35.999 0 0 1 454.203 306M450.769 328.308v-1.16h.467v-.235h-1.19v.236h.468v1.159Zm2.31 0v-1.398h-.364l-.42.962-.42-.962h-.365v1.398h.258v-1.054l.393.908h.267l.394-.91v1.056Z" fill="#f79e1b" transform="translate(-319.796 -252)"/>
|
|
7
|
+
</Svg>);
|
|
8
|
+
export default MCLogo;
|
|
9
|
+
//# sourceMappingURL=MCLogo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MCLogo.js","sourceRoot":"","sources":["../../src/assets/MCLogo.tsx"],"names":[],"mappings":"AAAA,OAAO,GAAG,EAAE,EAAY,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,MAAM,GAAuB,CAAC,KAAK,EAAE,EAAE,CAAC,CAC5C,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,KAAK,CAAC,CACpE;IAAA,CAAC,IAAI,CAAC,CAAC,CAAC,qBAAqB,CAAC,IAAI,CAAC,MAAM,EACzC;IAAA,CAAC,IAAI,CAAC,CAAC,CAAC,mCAAmC,CAAC,IAAI,CAAC,SAAS,EAC1D;IAAA,CAAC,IAAI,CACH,CAAC,CAAC,gGAAgG,CAClG,IAAI,CAAC,SAAS,CACd,SAAS,CAAC,0BAA0B,EAEtC;IAAA,CAAC,IAAI,CACH,CAAC,CAAC,iQAAiQ,CACnQ,IAAI,CAAC,SAAS,CACd,SAAS,CAAC,0BAA0B,EAExC;EAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACF,eAAe,MAAM,CAAC","sourcesContent":["import Svg, { SvgProps, Path } from \"react-native-svg\";\n\nconst MCLogo: React.FC<SvgProps> = (props) => (\n <Svg width={203.209} height={144} viewBox=\"0 0 152.407 108\" {...props}>\n <Path d=\"M0 0h152.407v108H0z\" fill=\"none\" />\n <Path d=\"M60.412 25.697h31.5v56.606h-31.5z\" fill=\"#ff5f00\" />\n <Path\n d=\"M382.208 306a35.94 35.94 0 0 1 13.75-28.303 36 36 0 1 0 0 56.606A35.94 35.94 0 0 1 382.208 306\"\n fill=\"#eb001b\"\n transform=\"translate(-319.796 -252)\"\n />\n <Path\n d=\"M454.203 306a35.999 35.999 0 0 1-58.245 28.303 36.005 36.005 0 0 0 0-56.606A35.999 35.999 0 0 1 454.203 306M450.769 328.308v-1.16h.467v-.235h-1.19v.236h.468v1.159Zm2.31 0v-1.398h-.364l-.42.962-.42-.962h-.365v1.398h.258v-1.054l.393.908h.267l.394-.91v1.056Z\"\n fill=\"#f79e1b\"\n transform=\"translate(-319.796 -252)\"\n />\n </Svg>\n);\nexport default MCLogo;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VisaLogo.d.ts","sourceRoot":"","sources":["../../src/assets/VisaLogo.tsx"],"names":[],"mappings":"AAAA,OAAY,EAAE,QAAQ,EAAQ,MAAM,kBAAkB,CAAC;AAEvD,QAAA,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,QAAQ,CAOhC,CAAC;AACF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import Svg, { Path } from "react-native-svg";
|
|
2
|
+
const VisaLogo = (props) => (<Svg viewBox="0 0 3384.54 2077.85" {...props}>
|
|
3
|
+
<Path d="m1461.26 739.84-251.37 599.74h-164l-123.7-478.62c-7.51-29.48-14.04-40.28-36.88-52.7-37.29-20.23-98.87-39.21-153.05-50.99l3.68-17.43h263.99c33.65 0 63.9 22.4 71.54 61.15l65.33 347.04 161.46-408.2h163zm642.58 403.93c.66-158.29-218.88-167.01-217.37-237.72.47-21.52 20.96-44.4 65.81-50.24 22.23-2.91 83.48-5.13 152.95 26.84l27.25-127.18c-37.33-13.55-85.36-26.59-145.12-26.59-153.35 0-261.27 81.52-262.18 198.25-.99 86.34 77.03 134.52 135.81 163.21 60.47 29.38 80.76 48.26 80.53 74.54-.43 40.23-48.23 57.99-92.9 58.69-77.98 1.2-123.23-21.1-159.3-37.87l-28.12 131.39c36.25 16.63 103.16 31.14 172.53 31.87 162.99 0 269.61-80.51 270.11-205.19m404.94 195.81h143.49l-125.25-599.74h-132.44c-29.78 0-54.9 17.34-66.02 44l-232.81 555.74h162.91L2291 1250h199.05zm-173.11-212.5 81.66-225.18 47 225.18zm-652.74-387.24-128.29 599.74H1399.5l128.34-599.74z" fill="#fff"/>
|
|
4
|
+
</Svg>);
|
|
5
|
+
export default VisaLogo;
|
|
6
|
+
//# sourceMappingURL=VisaLogo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VisaLogo.js","sourceRoot":"","sources":["../../src/assets/VisaLogo.tsx"],"names":[],"mappings":"AAAA,OAAO,GAAG,EAAE,EAAY,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,QAAQ,GAAuB,CAAC,KAAK,EAAE,EAAE,CAAC,CAC9C,CAAC,GAAG,CAAC,OAAO,CAAC,qBAAqB,CAAC,IAAI,KAAK,CAAC,CAC3C;IAAA,CAAC,IAAI,CACH,CAAC,CAAC,s0BAAs0B,CACx0B,IAAI,CAAC,MAAM,EAEf;EAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACF,eAAe,QAAQ,CAAC","sourcesContent":["import Svg, { SvgProps, Path } from \"react-native-svg\";\n\nconst VisaLogo: React.FC<SvgProps> = (props) => (\n <Svg viewBox=\"0 0 3384.54 2077.85\" {...props}>\n <Path\n d=\"m1461.26 739.84-251.37 599.74h-164l-123.7-478.62c-7.51-29.48-14.04-40.28-36.88-52.7-37.29-20.23-98.87-39.21-153.05-50.99l3.68-17.43h263.99c33.65 0 63.9 22.4 71.54 61.15l65.33 347.04 161.46-408.2h163zm642.58 403.93c.66-158.29-218.88-167.01-217.37-237.72.47-21.52 20.96-44.4 65.81-50.24 22.23-2.91 83.48-5.13 152.95 26.84l27.25-127.18c-37.33-13.55-85.36-26.59-145.12-26.59-153.35 0-261.27 81.52-262.18 198.25-.99 86.34 77.03 134.52 135.81 163.21 60.47 29.38 80.76 48.26 80.53 74.54-.43 40.23-48.23 57.99-92.9 58.69-77.98 1.2-123.23-21.1-159.3-37.87l-28.12 131.39c36.25 16.63 103.16 31.14 172.53 31.87 162.99 0 269.61-80.51 270.11-205.19m404.94 195.81h143.49l-125.25-599.74h-132.44c-29.78 0-54.9 17.34-66.02 44l-232.81 555.74h162.91L2291 1250h199.05zm-173.11-212.5 81.66-225.18 47 225.18zm-652.74-387.24-128.29 599.74H1399.5l128.34-599.74z\"\n fill=\"#fff\"\n />\n </Svg>\n);\nexport default VisaLogo;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/assets/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/assets/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export { default as AmexLogo } from \"./AmexLogo\";\nexport { default as MCLogo } from \"./MCLogo\";\nexport { default as VisaLogo } from \"./VisaLogo\";\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
2
|
+
import { FormThemeColors } from "../context";
|
|
3
|
+
type CardFormProps = {
|
|
4
|
+
apiKey: string;
|
|
5
|
+
countryCode?: "MX" | "CO" | "PE";
|
|
6
|
+
isProduction: boolean;
|
|
7
|
+
merchantId: string;
|
|
8
|
+
options?: {
|
|
9
|
+
expIsMMYY?: boolean;
|
|
10
|
+
groupedView?: boolean;
|
|
11
|
+
handleSubmit?: () => any;
|
|
12
|
+
styling?: {
|
|
13
|
+
buttonStyle?: StyleProp<ViewStyle>;
|
|
14
|
+
buttonTextStyle?: StyleProp<TextStyle>;
|
|
15
|
+
colorScheme?: "light" | "dark";
|
|
16
|
+
darkTheme?: FormThemeColors;
|
|
17
|
+
formFieldStyle?: StyleProp<ViewStyle>;
|
|
18
|
+
defaultStyling?: boolean;
|
|
19
|
+
formKeyboardAvoidingViewStyle?: StyleProp<ViewStyle>;
|
|
20
|
+
formScrollViewStyle?: StyleProp<ViewStyle>;
|
|
21
|
+
labelStyle?: StyleProp<TextStyle>;
|
|
22
|
+
lightTheme?: FormThemeColors;
|
|
23
|
+
textInputStyle?: StyleProp<TextStyle>;
|
|
24
|
+
};
|
|
25
|
+
withAnimatedTexts?: boolean;
|
|
26
|
+
withIcons?: boolean;
|
|
27
|
+
withLabels?: boolean;
|
|
28
|
+
withPlaceholders?: boolean;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export default function OPCardForm({ merchantId, apiKey, isProduction, countryCode, options, }: CardFormProps): import("react").JSX.Element;
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=OPCardForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OPCardForm.d.ts","sourceRoot":"","sources":["../../src/components/OPCardForm.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,SAAS,EAET,SAAS,EAET,SAAS,EACV,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAgB,eAAe,EAAqB,MAAM,YAAY,CAAC;AAyB9E,KAAK,aAAa,GAAG;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACjC,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE;QACR,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC;QACzB,OAAO,CAAC,EAAE;YACR,WAAW,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;YACnC,eAAe,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;YACvC,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;YAC/B,SAAS,CAAC,EAAE,eAAe,CAAC;YAC5B,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;YACtC,cAAc,CAAC,EAAE,OAAO,CAAC;YACzB,6BAA6B,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;YACrD,mBAAmB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;YAC3C,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;YAClC,UAAU,CAAC,EAAE,eAAe,CAAC;YAC7B,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;SACvC,CAAC;QACF,iBAAiB,CAAC,EAAE,OAAO,CAAC;QAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,gBAAgB,CAAC,EAAE,OAAO,CAAC;KAC5B,CAAC;CACH,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,UAAU,EACV,MAAM,EACN,YAAoB,EACpB,WAAkB,EAClB,OAAY,GACb,EAAE,aAAa,+BA6Nf"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// import { useEffect } from "react";
|
|
2
|
+
import { KeyboardAvoidingView, ScrollView, StyleSheet, View, } from "react-native";
|
|
3
|
+
import { FormProvider, FormThemeProvider } from "../context";
|
|
4
|
+
// import { initialize, createDeviceSessionId } from "../ExpoOpenpayModule";
|
|
5
|
+
import { SubmitButton } from "./forms";
|
|
6
|
+
import { OPCardNumberInput, OPCvv2Input, OPExpInput, OPExpMonthInput, OPExpYearInput, OPHolderNameInput, } from ".";
|
|
7
|
+
export default function OPCardForm({ merchantId, apiKey, isProduction = false, countryCode = "MX", options = {}, }) {
|
|
8
|
+
const { expIsMMYY = true, groupedView = true, handleSubmit, styling = {}, withAnimatedTexts, withIcons, withLabels, withPlaceholders, } = options;
|
|
9
|
+
const { buttonStyle = {}, buttonTextStyle = {}, colorScheme = "light", darkTheme, formFieldStyle = {}, defaultStyling = true, formKeyboardAvoidingViewStyle = {}, formScrollViewStyle = {}, labelStyle = {}, lightTheme, textInputStyle = {}, } = styling;
|
|
10
|
+
// useEffect(() => {
|
|
11
|
+
// const initOP = async () => {
|
|
12
|
+
// try {
|
|
13
|
+
// await initialize(merchantId, apiKey, isProduction, countryCode);
|
|
14
|
+
// await createDeviceSessionId();
|
|
15
|
+
// } catch (e) {
|
|
16
|
+
// console.error(e);
|
|
17
|
+
// }
|
|
18
|
+
// };
|
|
19
|
+
// initOP();
|
|
20
|
+
// }, []);
|
|
21
|
+
return (<FormThemeProvider colorScheme={colorScheme} dark={darkTheme} light={lightTheme}>
|
|
22
|
+
<FormProvider initialValues={{ cardNumber: "" }} onSubmit={handleSubmit}>
|
|
23
|
+
<KeyboardAvoidingView behavior="padding" enabled keyboardVerticalOffset={100} style={defaultStyling
|
|
24
|
+
? [styles.keyboardAvoidingView, formKeyboardAvoidingViewStyle]
|
|
25
|
+
: formKeyboardAvoidingViewStyle}>
|
|
26
|
+
<ScrollView showsVerticalScrollIndicator={false} style={defaultStyling
|
|
27
|
+
? [styles.formView, formScrollViewStyle]
|
|
28
|
+
: formScrollViewStyle}>
|
|
29
|
+
<OPHolderNameInput options={{
|
|
30
|
+
formFieldStyle,
|
|
31
|
+
defaultStyling,
|
|
32
|
+
inputStyle: {},
|
|
33
|
+
labelStyle,
|
|
34
|
+
textInputStyle,
|
|
35
|
+
}} withAnimatedText={withAnimatedTexts} withIcon={withIcons} withLabel={withLabels} withPlaceholder={withPlaceholders}/>
|
|
36
|
+
<OPCardNumberInput options={{
|
|
37
|
+
formFieldStyle,
|
|
38
|
+
defaultStyling,
|
|
39
|
+
inputStyle: {},
|
|
40
|
+
labelStyle,
|
|
41
|
+
textInputStyle,
|
|
42
|
+
}} withAnimatedText={withAnimatedTexts} withIcon={withIcons} withLabel={withLabels} withPlaceholder={withPlaceholders}/>
|
|
43
|
+
{defaultStyling && groupedView ? (<View style={{ flexDirection: "row", gap: 12 }}>
|
|
44
|
+
{expIsMMYY ? (<OPExpInput options={{
|
|
45
|
+
formFieldStyle: { flex: 1 },
|
|
46
|
+
defaultStyling,
|
|
47
|
+
inputStyle: {},
|
|
48
|
+
labelStyle,
|
|
49
|
+
textInputStyle,
|
|
50
|
+
}} withAnimatedText={withAnimatedTexts} withIcon={withIcons} withLabel={withLabels} withPlaceholder={withPlaceholders}/>) : (<>
|
|
51
|
+
<OPExpMonthInput options={{
|
|
52
|
+
formFieldStyle: { flex: 1 },
|
|
53
|
+
defaultStyling,
|
|
54
|
+
inputStyle: {},
|
|
55
|
+
labelStyle,
|
|
56
|
+
textInputStyle,
|
|
57
|
+
}} withAnimatedText={withAnimatedTexts} withIcon={withIcons} withLabel={withLabels} withPlaceholder={withPlaceholders}/>
|
|
58
|
+
<OPExpYearInput options={{
|
|
59
|
+
formFieldStyle: { flex: 1 },
|
|
60
|
+
defaultStyling,
|
|
61
|
+
inputStyle: {},
|
|
62
|
+
labelStyle,
|
|
63
|
+
textInputStyle,
|
|
64
|
+
}} withAnimatedText={withAnimatedTexts} withIcon={withIcons} withLabel={withLabels} withPlaceholder={withPlaceholders}/>
|
|
65
|
+
</>)}
|
|
66
|
+
<OPCvv2Input options={{
|
|
67
|
+
formFieldStyle: { flex: 1 },
|
|
68
|
+
defaultStyling,
|
|
69
|
+
inputStyle: {},
|
|
70
|
+
labelStyle,
|
|
71
|
+
textInputStyle,
|
|
72
|
+
}} withAnimatedText={withAnimatedTexts} withIcon={withIcons} withLabel={withLabels} withPlaceholder={withPlaceholders}/>
|
|
73
|
+
</View>) : (<>
|
|
74
|
+
{expIsMMYY ? (<OPExpInput options={{
|
|
75
|
+
formFieldStyle,
|
|
76
|
+
defaultStyling,
|
|
77
|
+
inputStyle: {},
|
|
78
|
+
labelStyle,
|
|
79
|
+
textInputStyle,
|
|
80
|
+
}} withAnimatedText={withAnimatedTexts} withIcon={withIcons} withLabel={withLabels} withPlaceholder={withPlaceholders}/>) : (<>
|
|
81
|
+
<OPExpMonthInput options={{
|
|
82
|
+
formFieldStyle,
|
|
83
|
+
defaultStyling,
|
|
84
|
+
inputStyle: {},
|
|
85
|
+
labelStyle: {},
|
|
86
|
+
textInputStyle,
|
|
87
|
+
}} withAnimatedText={withAnimatedTexts} withIcon={withIcons} withLabel={withLabels} withPlaceholder={withPlaceholders}/>
|
|
88
|
+
<OPExpYearInput options={{
|
|
89
|
+
formFieldStyle,
|
|
90
|
+
defaultStyling,
|
|
91
|
+
inputStyle: {},
|
|
92
|
+
labelStyle,
|
|
93
|
+
textInputStyle,
|
|
94
|
+
}} withAnimatedText={withAnimatedTexts} withIcon={withIcons} withLabel={withLabels} withPlaceholder={withPlaceholders}/>
|
|
95
|
+
</>)}
|
|
96
|
+
|
|
97
|
+
<OPCvv2Input options={{
|
|
98
|
+
formFieldStyle,
|
|
99
|
+
defaultStyling,
|
|
100
|
+
inputStyle: {},
|
|
101
|
+
labelStyle,
|
|
102
|
+
textInputStyle,
|
|
103
|
+
}} withAnimatedText={withAnimatedTexts} withIcon={withIcons} withLabel={withLabels} withPlaceholder={withPlaceholders}/>
|
|
104
|
+
</>)}
|
|
105
|
+
<SubmitButton buttonStyle={buttonStyle} buttonTextStyle={buttonTextStyle} defaultStyling={defaultStyling}/>
|
|
106
|
+
</ScrollView>
|
|
107
|
+
</KeyboardAvoidingView>
|
|
108
|
+
</FormProvider>
|
|
109
|
+
</FormThemeProvider>);
|
|
110
|
+
}
|
|
111
|
+
const styles = StyleSheet.create({
|
|
112
|
+
formView: {
|
|
113
|
+
height: "100%",
|
|
114
|
+
marginHorizontal: 12,
|
|
115
|
+
},
|
|
116
|
+
keyboardAvoidingView: {
|
|
117
|
+
flex: 1,
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
//# sourceMappingURL=OPCardForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OPCardForm.js","sourceRoot":"","sources":["../../src/components/OPCardForm.tsx"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EACL,oBAAoB,EACpB,UAAU,EAEV,UAAU,EAEV,IAAI,GAEL,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,YAAY,EAAmB,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC9E,4EAA4E;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EACL,i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D;YAAA,CAAC,YAAY,CACX,WAAW,CAAC,CAAC,WAAW,CAAC,CACzB,eAAe,CAAC,CAAC,eAAe,CAAC,CACjC,cAAc,CAAC,CAAC,cAAc,CAAC,EAEnC;UAAA,EAAE,UAAU,CACd;QAAA,EAAE,oBAAoB,CACxB;MAAA,EAAE,YAAY,CAChB;IAAA,EAAE,iBAAiB,CAAC,CACrB,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,QAAQ,EAAE;QACR,MAAM,EAAE,MAAM;QACd,gBAAgB,EAAE,EAAE;KACrB;IACD,oBAAoB,EAAE;QACpB,IAAI,EAAE,CAAC;KACR;CACF,CAAC,CAAC","sourcesContent":["// import { useEffect } from \"react\";\nimport {\n KeyboardAvoidingView,\n ScrollView,\n StyleProp,\n StyleSheet,\n TextStyle,\n View,\n ViewStyle,\n} from \"react-native\";\n\nimport { FormProvider, FormThemeColors, FormThemeProvider } from \"../context\";\n// import { initialize, createDeviceSessionId } from \"../ExpoOpenpayModule\";\nimport { SubmitButton } from \"./forms\";\nimport {\n OPCardNumberInput,\n OPCvv2Input,\n OPExpInput,\n OPExpMonthInput,\n OPExpYearInput,\n OPHolderNameInput,\n} from \".\";\n\n// type ThemeColors = {\n// background: string;\n// text: string;\n// error: string;\n// primary: string;\n// placeholder: string;\n// };\n\n// type ThemeProp = {\n// light: Partial<ThemeColors>;\n// dark: Partial<ThemeColors>;\n// };\n\ntype CardFormProps = {\n apiKey: string;\n countryCode?: \"MX\" | \"CO\" | \"PE\";\n isProduction: boolean;\n merchantId: string;\n options?: {\n expIsMMYY?: boolean;\n groupedView?: boolean;\n handleSubmit?: () => any;\n styling?: {\n buttonStyle?: StyleProp<ViewStyle>;\n buttonTextStyle?: StyleProp<TextStyle>;\n colorScheme?: \"light\" | \"dark\";\n darkTheme?: FormThemeColors;\n formFieldStyle?: StyleProp<ViewStyle>;\n defaultStyling?: boolean;\n formKeyboardAvoidingViewStyle?: StyleProp<ViewStyle>;\n formScrollViewStyle?: StyleProp<ViewStyle>;\n labelStyle?: StyleProp<TextStyle>;\n lightTheme?: FormThemeColors;\n textInputStyle?: StyleProp<TextStyle>;\n };\n withAnimatedTexts?: boolean;\n withIcons?: boolean;\n withLabels?: boolean;\n withPlaceholders?: boolean;\n };\n};\n\nexport default function OPCardForm({\n merchantId,\n apiKey,\n isProduction = false,\n countryCode = \"MX\",\n options = {},\n}: CardFormProps) {\n const {\n expIsMMYY = true,\n groupedView = true,\n handleSubmit,\n styling = {},\n withAnimatedTexts,\n withIcons,\n withLabels,\n withPlaceholders,\n } = options;\n\n const {\n buttonStyle = {},\n buttonTextStyle = {},\n colorScheme = \"light\",\n darkTheme,\n formFieldStyle = {},\n defaultStyling = true,\n formKeyboardAvoidingViewStyle = {},\n formScrollViewStyle = {},\n labelStyle = {},\n lightTheme,\n textInputStyle = {},\n } = styling;\n\n // useEffect(() => {\n // const initOP = async () => {\n // try {\n // await initialize(merchantId, apiKey, isProduction, countryCode);\n // await createDeviceSessionId();\n // } catch (e) {\n // console.error(e);\n // }\n // };\n // initOP();\n // }, []);\n\n return (\n <FormThemeProvider\n colorScheme={colorScheme}\n dark={darkTheme}\n light={lightTheme}\n >\n <FormProvider initialValues={{ cardNumber: \"\" }} onSubmit={handleSubmit}>\n <KeyboardAvoidingView\n behavior=\"padding\"\n enabled\n keyboardVerticalOffset={100}\n style={\n defaultStyling\n ? [styles.keyboardAvoidingView, formKeyboardAvoidingViewStyle]\n : formKeyboardAvoidingViewStyle\n }\n >\n <ScrollView\n showsVerticalScrollIndicator={false}\n style={\n defaultStyling\n ? [styles.formView, formScrollViewStyle]\n : formScrollViewStyle\n }\n >\n <OPHolderNameInput\n options={{\n formFieldStyle,\n defaultStyling,\n inputStyle: {},\n labelStyle,\n textInputStyle,\n }}\n withAnimatedText={withAnimatedTexts}\n withIcon={withIcons}\n withLabel={withLabels}\n withPlaceholder={withPlaceholders}\n />\n <OPCardNumberInput\n options={{\n formFieldStyle,\n defaultStyling,\n inputStyle: {},\n labelStyle,\n textInputStyle,\n }}\n withAnimatedText={withAnimatedTexts}\n withIcon={withIcons}\n withLabel={withLabels}\n withPlaceholder={withPlaceholders}\n />\n {defaultStyling && groupedView ? (\n <View style={{ flexDirection: \"row\", gap: 12 }}>\n {expIsMMYY ? (\n <OPExpInput\n options={{\n formFieldStyle: { flex: 1 },\n defaultStyling,\n inputStyle: {},\n labelStyle,\n textInputStyle,\n }}\n withAnimatedText={withAnimatedTexts}\n withIcon={withIcons}\n withLabel={withLabels}\n withPlaceholder={withPlaceholders}\n />\n ) : (\n <>\n <OPExpMonthInput\n options={{\n formFieldStyle: { flex: 1 },\n defaultStyling,\n inputStyle: {},\n labelStyle,\n textInputStyle,\n }}\n withAnimatedText={withAnimatedTexts}\n withIcon={withIcons}\n withLabel={withLabels}\n withPlaceholder={withPlaceholders}\n />\n <OPExpYearInput\n options={{\n formFieldStyle: { flex: 1 },\n defaultStyling,\n inputStyle: {},\n labelStyle,\n textInputStyle,\n }}\n withAnimatedText={withAnimatedTexts}\n withIcon={withIcons}\n withLabel={withLabels}\n withPlaceholder={withPlaceholders}\n />\n </>\n )}\n <OPCvv2Input\n options={{\n formFieldStyle: { flex: 1 },\n defaultStyling,\n inputStyle: {},\n labelStyle,\n textInputStyle,\n }}\n withAnimatedText={withAnimatedTexts}\n withIcon={withIcons}\n withLabel={withLabels}\n withPlaceholder={withPlaceholders}\n />\n </View>\n ) : (\n <>\n {expIsMMYY ? (\n <OPExpInput\n options={{\n formFieldStyle,\n defaultStyling,\n inputStyle: {},\n labelStyle,\n textInputStyle,\n }}\n withAnimatedText={withAnimatedTexts}\n withIcon={withIcons}\n withLabel={withLabels}\n withPlaceholder={withPlaceholders}\n />\n ) : (\n <>\n <OPExpMonthInput\n options={{\n formFieldStyle,\n defaultStyling,\n inputStyle: {},\n labelStyle: {},\n textInputStyle,\n }}\n withAnimatedText={withAnimatedTexts}\n withIcon={withIcons}\n withLabel={withLabels}\n withPlaceholder={withPlaceholders}\n />\n <OPExpYearInput\n options={{\n formFieldStyle,\n defaultStyling,\n inputStyle: {},\n labelStyle,\n textInputStyle,\n }}\n withAnimatedText={withAnimatedTexts}\n withIcon={withIcons}\n withLabel={withLabels}\n withPlaceholder={withPlaceholders}\n />\n </>\n )}\n\n <OPCvv2Input\n options={{\n formFieldStyle,\n defaultStyling,\n inputStyle: {},\n labelStyle,\n textInputStyle,\n }}\n withAnimatedText={withAnimatedTexts}\n withIcon={withIcons}\n withLabel={withLabels}\n withPlaceholder={withPlaceholders}\n />\n </>\n )}\n <SubmitButton\n buttonStyle={buttonStyle}\n buttonTextStyle={buttonTextStyle}\n defaultStyling={defaultStyling}\n />\n </ScrollView>\n </KeyboardAvoidingView>\n </FormProvider>\n </FormThemeProvider>\n );\n}\n\nconst styles = StyleSheet.create({\n formView: {\n height: \"100%\",\n marginHorizontal: 12,\n },\n keyboardAvoidingView: {\n flex: 1,\n },\n});\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
2
|
+
type CardInputOptions = {
|
|
3
|
+
options?: {
|
|
4
|
+
formFieldStyle?: StyleProp<ViewStyle>;
|
|
5
|
+
defaultStyling?: boolean;
|
|
6
|
+
inputStyle?: StyleProp<TextStyle>;
|
|
7
|
+
labelStyle?: StyleProp<TextStyle>;
|
|
8
|
+
textInputStyle?: StyleProp<TextStyle>;
|
|
9
|
+
};
|
|
10
|
+
withAnimatedText?: boolean;
|
|
11
|
+
withIcon?: boolean;
|
|
12
|
+
withLabel?: boolean;
|
|
13
|
+
withPlaceholder?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export default function OPCardNumberInput({ options, withAnimatedText, withIcon, withLabel, withPlaceholder, ...otherProps }: CardInputOptions): import("react").JSX.Element;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=OPCardNumberInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OPCardNumberInput.d.ts","sourceRoot":"","sources":["../../src/components/OPCardNumberInput.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAiB/D,KAAK,gBAAgB,GAAG;IACtB,OAAO,CAAC,EAAE;QACR,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QACtC,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAClC,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAClC,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;KACvC,CAAC;IACF,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAqDF,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,OAAY,EACZ,gBAAuB,EACvB,QAAe,EACf,SAAiB,EACjB,eAAsB,EACtB,GAAG,UAAU,EACd,EAAE,gBAAgB,+BAmClB"}
|