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
|
+
import ExpoModulesCore
|
|
2
|
+
import OpenpayKit
|
|
3
|
+
|
|
4
|
+
public class ExpoOpenpayModule: Module {
|
|
5
|
+
private var openpay: Openpay?
|
|
6
|
+
|
|
7
|
+
private func isInitialized(_ promise: Promise, _ action: (Openpay) -> Void) {
|
|
8
|
+
guard let openpay = openpay else {
|
|
9
|
+
return promise.reject("OPENPAY_NOT_INITIALIZED", "Openpay is not initialized")
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
action(openpay)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Each module class must implement the definition function. The definition consists of components
|
|
16
|
+
// that describes the module's functionality and behavior.
|
|
17
|
+
// See https://docs.expo.dev/modules/module-api for more details about available components.
|
|
18
|
+
public func definition() -> ModuleDefinition {
|
|
19
|
+
// Sets the name of the module that JavaScript code will use to refer to the module. Takes a string as an argument.
|
|
20
|
+
// Can be inferred from module's class name, but it's recommended to set it explicitly for clarity.
|
|
21
|
+
// The module will be accessible from `requireNativeModule('Openpay')` in JavaScript.
|
|
22
|
+
Name("Openpay")
|
|
23
|
+
|
|
24
|
+
AsyncFunction("initialize") {
|
|
25
|
+
(
|
|
26
|
+
merchantId: String, apiKey: String, isProduction: Bool, countryCode: String?,
|
|
27
|
+
promise: Promise
|
|
28
|
+
) in
|
|
29
|
+
|
|
30
|
+
guard !merchantId.isEmpty, !apiKey.isEmpty else {
|
|
31
|
+
return promise.reject(
|
|
32
|
+
"OPENPAY_INVALID_PARAMS", "Merchant ID and API Key are required")
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
let cc = countryCode?.uppercased() ?? "MX"
|
|
36
|
+
|
|
37
|
+
guard ["CO", "MX", "PE"].contains(cc) else {
|
|
38
|
+
return promise.reject(
|
|
39
|
+
"OPENPAY_INVALID_COUNTRY_CODE",
|
|
40
|
+
"Invalid country code: \(cc). Please use 'MX' for Mexico, 'CO' for Colombia, 'PE' for Peru, or leave empty to default to 'MX'."
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
openpay = Openpay(
|
|
45
|
+
withMerchantId: merchantId,
|
|
46
|
+
andApiKey: apiKey,
|
|
47
|
+
isProductionMode: isProduction,
|
|
48
|
+
isDebug: false,
|
|
49
|
+
countryCode: cc
|
|
50
|
+
)
|
|
51
|
+
return promise.resolve("Openpay initialized")
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
AsyncFunction("isInitialized") { (promise: Promise) in
|
|
55
|
+
if openpay != nil {
|
|
56
|
+
return promise.resolve(true)
|
|
57
|
+
} else {
|
|
58
|
+
return promise.resolve(false)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
AsyncFunction("createDeviceSessionId") { (promise: Promise) in
|
|
63
|
+
isInitialized(promise) { openpay in
|
|
64
|
+
openpay.createDeviceSessionId(
|
|
65
|
+
successFunction: { sessionId in return promise.resolve(sessionId) },
|
|
66
|
+
failureFunction: { error in
|
|
67
|
+
return promise.reject(
|
|
68
|
+
"OPENPAY_DEVICE_SESSION_ID_ERROR", error.localizedDescription)
|
|
69
|
+
})
|
|
70
|
+
}
|
|
71
|
+
}.runOnQueue(.main) // Must run on main thread due to SDK UI/internal thread constraints
|
|
72
|
+
|
|
73
|
+
AsyncFunction("tokenizeCard") {
|
|
74
|
+
(
|
|
75
|
+
cardNumber: String, holderName: String, expirationYear: String, expirationMonth: String,
|
|
76
|
+
cvv2: String, promise: Promise
|
|
77
|
+
) in
|
|
78
|
+
|
|
79
|
+
isInitialized(promise) { openpay in
|
|
80
|
+
let card = TokenizeCardRequest(
|
|
81
|
+
cardNumber: cardNumber, holderName: holderName, expirationYear: expirationYear,
|
|
82
|
+
expirationMonth: expirationMonth, cvv2: cvv2)
|
|
83
|
+
|
|
84
|
+
openpay.tokenizeCard(card: card) { (OPToken) in
|
|
85
|
+
return promise.resolve(OPToken.id)
|
|
86
|
+
} failureFunction: { error in
|
|
87
|
+
return promise.reject("OPENPAY_CARD_TOKEN_ERROR", error.localizedDescription)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Enables the module to be used as a native view. Definition components that are accepted as part of the
|
|
93
|
+
// view definition: Prop, Events.
|
|
94
|
+
View(OpenpayView.self) {
|
|
95
|
+
// Defines a setter for the `url` prop.
|
|
96
|
+
Prop("url") { (view: OpenpayView, url: URL) in
|
|
97
|
+
if view.webView.url != url {
|
|
98
|
+
view.webView.load(URLRequest(url: url))
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
Events("onLoad")
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import ExpoModulesCore
|
|
2
|
+
import WebKit
|
|
3
|
+
|
|
4
|
+
// This view will be used as a native component. Make sure to inherit from `ExpoView`
|
|
5
|
+
// to apply the proper styling (e.g. border radius and shadows).
|
|
6
|
+
class OpenpayView: ExpoView {
|
|
7
|
+
let webView = WKWebView()
|
|
8
|
+
let onLoad = EventDispatcher()
|
|
9
|
+
var delegate: WebViewDelegate?
|
|
10
|
+
|
|
11
|
+
required init(appContext: AppContext? = nil) {
|
|
12
|
+
super.init(appContext: appContext)
|
|
13
|
+
clipsToBounds = true
|
|
14
|
+
delegate = WebViewDelegate { url in
|
|
15
|
+
self.onLoad(["url": url])
|
|
16
|
+
}
|
|
17
|
+
webView.navigationDelegate = delegate
|
|
18
|
+
addSubview(webView)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
override func layoutSubviews() {
|
|
22
|
+
webView.frame = bounds
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
class WebViewDelegate: NSObject, WKNavigationDelegate {
|
|
27
|
+
let onUrlChange: (String) -> Void
|
|
28
|
+
|
|
29
|
+
init(onUrlChange: @escaping (String) -> Void) {
|
|
30
|
+
self.onUrlChange = onUrlChange
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation) {
|
|
34
|
+
if let url = webView.url {
|
|
35
|
+
onUrlChange(url.absoluteString)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "expo-openpay",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Expo module for Openpay integration",
|
|
5
|
+
"main": "build/index.js",
|
|
6
|
+
"types": "build/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "expo-module build",
|
|
9
|
+
"clean": "expo-module clean",
|
|
10
|
+
"lint": "expo-module lint",
|
|
11
|
+
"test": "expo-module test",
|
|
12
|
+
"prepare": "expo-module prepare",
|
|
13
|
+
"prepublishOnly": "expo-module prepublishOnly",
|
|
14
|
+
"expo-module": "expo-module",
|
|
15
|
+
"open:ios": "xed example/ios",
|
|
16
|
+
"open:android": "open -a \"Android Studio\" example/android"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"react-native",
|
|
20
|
+
"expo",
|
|
21
|
+
"expo-openpay",
|
|
22
|
+
"ExpoOpenpay",
|
|
23
|
+
"openpay"
|
|
24
|
+
],
|
|
25
|
+
"repository": "https://github.com/jgallaway2011/expo-openpay",
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/jgallaway2011/expo-openpay/issues"
|
|
28
|
+
},
|
|
29
|
+
"author": "jgallaway2011 <jgallaway2011@gmail.com> (https://github.com/jgallaway2011)",
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"homepage": "https://github.com/jgallaway2011/expo-openpay#readme",
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@svgr/cli": "^8.1.0",
|
|
34
|
+
"@types/react": "~19.0.10",
|
|
35
|
+
"expo": "~53.0.12",
|
|
36
|
+
"expo-module-scripts": "^4.1.6",
|
|
37
|
+
"react-native": "0.79.4",
|
|
38
|
+
"react-native-svg": "^15.14.0"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"expo": "*",
|
|
42
|
+
"react": "*",
|
|
43
|
+
"react-native": "*",
|
|
44
|
+
"react-native-svg": "*"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { StyleProp, ViewStyle } from "react-native";
|
|
2
|
+
|
|
3
|
+
export type OnLoadEventPayload = {
|
|
4
|
+
url: string;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export type ExpoOpenpayModuleEvents = {
|
|
8
|
+
onChange: (params: ChangeEventPayload) => void;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type ChangeEventPayload = {
|
|
12
|
+
value: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type CountryCode = "MX" | "CO" | "PE";
|
|
16
|
+
|
|
17
|
+
export type ExpoOpenpayViewProps = {
|
|
18
|
+
url: string;
|
|
19
|
+
onLoad: (event: { nativeEvent: OnLoadEventPayload }) => void;
|
|
20
|
+
style?: StyleProp<ViewStyle>;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export interface OpenpayInitOptions {
|
|
24
|
+
merchantId: string;
|
|
25
|
+
apiKey: string;
|
|
26
|
+
isProduction: boolean;
|
|
27
|
+
isDebug: boolean;
|
|
28
|
+
countryCode?: CountryCode; // Optional, defaults to 'MX'
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface CardData {
|
|
32
|
+
cardNumber: string;
|
|
33
|
+
holderName: string;
|
|
34
|
+
expirationMonth: string; // MM as string, e.g. '05'
|
|
35
|
+
expirationYear: string; // YY as string, e.g. '25'
|
|
36
|
+
cvv2: string; // CVV code
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface OpenpayToken {
|
|
40
|
+
id: string;
|
|
41
|
+
brand: string;
|
|
42
|
+
card_number: string;
|
|
43
|
+
holder_name: string;
|
|
44
|
+
expiration_year: number;
|
|
45
|
+
expiration_month: number;
|
|
46
|
+
type: string;
|
|
47
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { requireNativeModule } from "expo";
|
|
2
|
+
|
|
3
|
+
interface ExpoOpenpayModule {
|
|
4
|
+
initialize(
|
|
5
|
+
merchantId: string,
|
|
6
|
+
apiKey: string,
|
|
7
|
+
isProduction: boolean,
|
|
8
|
+
countryCode?: "MX" | "CO" | "PE"
|
|
9
|
+
): Promise<string>;
|
|
10
|
+
isInitialized(): Promise<boolean>;
|
|
11
|
+
createDeviceSessionId(): Promise<string>;
|
|
12
|
+
tokenizeCard(
|
|
13
|
+
cardNumber: string,
|
|
14
|
+
holderName: string,
|
|
15
|
+
expirationYear: string,
|
|
16
|
+
expirationMonth: string,
|
|
17
|
+
cvv2: string
|
|
18
|
+
): Promise<string>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// This call loads the native module object from the JSI.
|
|
22
|
+
const Openpay = requireNativeModule<ExpoOpenpayModule>("Openpay");
|
|
23
|
+
export default Openpay;
|
|
24
|
+
export const {
|
|
25
|
+
initialize,
|
|
26
|
+
isInitialized,
|
|
27
|
+
tokenizeCard,
|
|
28
|
+
createDeviceSessionId,
|
|
29
|
+
} = Openpay;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { registerWebModule, NativeModule } from 'expo';
|
|
2
|
+
|
|
3
|
+
import { ExpoOpenpayModuleEvents } from './ExpoOpenpay.types';
|
|
4
|
+
|
|
5
|
+
class ExpoOpenpayModule extends NativeModule<ExpoOpenpayModuleEvents> {
|
|
6
|
+
PI = Math.PI;
|
|
7
|
+
async setValueAsync(value: string): Promise<void> {
|
|
8
|
+
this.emit('onChange', { value });
|
|
9
|
+
}
|
|
10
|
+
hello() {
|
|
11
|
+
return 'Hello world! 👋';
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default registerWebModule(ExpoOpenpayModule, 'ExpoOpenpayModule');
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { requireNativeView } from "expo";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import { ExpoOpenpayViewProps } from "./ExpoOpenpay.types";
|
|
5
|
+
|
|
6
|
+
const NativeView: React.ComponentType<ExpoOpenpayViewProps> =
|
|
7
|
+
requireNativeView("Openpay");
|
|
8
|
+
|
|
9
|
+
export default function ExpoOpenpayView(props: ExpoOpenpayViewProps) {
|
|
10
|
+
return <NativeView {...props} />;
|
|
11
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import Svg, { SvgProps, Path } from "react-native-svg";
|
|
2
|
+
|
|
3
|
+
const AmexLogo: React.FC<SvgProps> = (props) => (
|
|
4
|
+
<Svg viewBox="0 0 70 70" {...props}>
|
|
5
|
+
<Path
|
|
6
|
+
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"
|
|
7
|
+
fill="#0071ce"
|
|
8
|
+
/>
|
|
9
|
+
<Path
|
|
10
|
+
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"
|
|
11
|
+
fill="#0071ce"
|
|
12
|
+
/>
|
|
13
|
+
<Path
|
|
14
|
+
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"
|
|
15
|
+
fill="#0071ce"
|
|
16
|
+
/>
|
|
17
|
+
<Path
|
|
18
|
+
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"
|
|
19
|
+
fill="#0071ce"
|
|
20
|
+
/>
|
|
21
|
+
</Svg>
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export default AmexLogo;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Svg, { SvgProps, Path } from "react-native-svg";
|
|
2
|
+
|
|
3
|
+
const MCLogo: React.FC<SvgProps> = (props) => (
|
|
4
|
+
<Svg width={203.209} height={144} viewBox="0 0 152.407 108" {...props}>
|
|
5
|
+
<Path d="M0 0h152.407v108H0z" fill="none" />
|
|
6
|
+
<Path d="M60.412 25.697h31.5v56.606h-31.5z" fill="#ff5f00" />
|
|
7
|
+
<Path
|
|
8
|
+
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"
|
|
9
|
+
fill="#eb001b"
|
|
10
|
+
transform="translate(-319.796 -252)"
|
|
11
|
+
/>
|
|
12
|
+
<Path
|
|
13
|
+
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"
|
|
14
|
+
fill="#f79e1b"
|
|
15
|
+
transform="translate(-319.796 -252)"
|
|
16
|
+
/>
|
|
17
|
+
</Svg>
|
|
18
|
+
);
|
|
19
|
+
export default MCLogo;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import Svg, { SvgProps, Path } from "react-native-svg";
|
|
2
|
+
|
|
3
|
+
const VisaLogo: React.FC<SvgProps> = (props) => (
|
|
4
|
+
<Svg viewBox="0 0 3384.54 2077.85" {...props}>
|
|
5
|
+
<Path
|
|
6
|
+
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"
|
|
7
|
+
fill="#fff"
|
|
8
|
+
/>
|
|
9
|
+
</Svg>
|
|
10
|
+
);
|
|
11
|
+
export default VisaLogo;
|
|
Binary file
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
// import { useEffect } from "react";
|
|
2
|
+
import {
|
|
3
|
+
KeyboardAvoidingView,
|
|
4
|
+
ScrollView,
|
|
5
|
+
StyleProp,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
TextStyle,
|
|
8
|
+
View,
|
|
9
|
+
ViewStyle,
|
|
10
|
+
} from "react-native";
|
|
11
|
+
|
|
12
|
+
import { FormProvider, FormThemeColors, FormThemeProvider } from "../context";
|
|
13
|
+
// import { initialize, createDeviceSessionId } from "../ExpoOpenpayModule";
|
|
14
|
+
import { SubmitButton } from "./forms";
|
|
15
|
+
import {
|
|
16
|
+
OPCardNumberInput,
|
|
17
|
+
OPCvv2Input,
|
|
18
|
+
OPExpInput,
|
|
19
|
+
OPExpMonthInput,
|
|
20
|
+
OPExpYearInput,
|
|
21
|
+
OPHolderNameInput,
|
|
22
|
+
} from ".";
|
|
23
|
+
|
|
24
|
+
// type ThemeColors = {
|
|
25
|
+
// background: string;
|
|
26
|
+
// text: string;
|
|
27
|
+
// error: string;
|
|
28
|
+
// primary: string;
|
|
29
|
+
// placeholder: string;
|
|
30
|
+
// };
|
|
31
|
+
|
|
32
|
+
// type ThemeProp = {
|
|
33
|
+
// light: Partial<ThemeColors>;
|
|
34
|
+
// dark: Partial<ThemeColors>;
|
|
35
|
+
// };
|
|
36
|
+
|
|
37
|
+
type CardFormProps = {
|
|
38
|
+
apiKey: string;
|
|
39
|
+
countryCode?: "MX" | "CO" | "PE";
|
|
40
|
+
isProduction: boolean;
|
|
41
|
+
merchantId: string;
|
|
42
|
+
options?: {
|
|
43
|
+
expIsMMYY?: boolean;
|
|
44
|
+
groupedView?: boolean;
|
|
45
|
+
handleSubmit?: () => any;
|
|
46
|
+
styling?: {
|
|
47
|
+
buttonStyle?: StyleProp<ViewStyle>;
|
|
48
|
+
buttonTextStyle?: StyleProp<TextStyle>;
|
|
49
|
+
colorScheme?: "light" | "dark";
|
|
50
|
+
darkTheme?: FormThemeColors;
|
|
51
|
+
formFieldStyle?: StyleProp<ViewStyle>;
|
|
52
|
+
defaultStyling?: boolean;
|
|
53
|
+
formKeyboardAvoidingViewStyle?: StyleProp<ViewStyle>;
|
|
54
|
+
formScrollViewStyle?: StyleProp<ViewStyle>;
|
|
55
|
+
labelStyle?: StyleProp<TextStyle>;
|
|
56
|
+
lightTheme?: FormThemeColors;
|
|
57
|
+
textInputStyle?: StyleProp<TextStyle>;
|
|
58
|
+
};
|
|
59
|
+
withAnimatedTexts?: boolean;
|
|
60
|
+
withIcons?: boolean;
|
|
61
|
+
withLabels?: boolean;
|
|
62
|
+
withPlaceholders?: boolean;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export default function OPCardForm({
|
|
67
|
+
merchantId,
|
|
68
|
+
apiKey,
|
|
69
|
+
isProduction = false,
|
|
70
|
+
countryCode = "MX",
|
|
71
|
+
options = {},
|
|
72
|
+
}: CardFormProps) {
|
|
73
|
+
const {
|
|
74
|
+
expIsMMYY = true,
|
|
75
|
+
groupedView = true,
|
|
76
|
+
handleSubmit,
|
|
77
|
+
styling = {},
|
|
78
|
+
withAnimatedTexts,
|
|
79
|
+
withIcons,
|
|
80
|
+
withLabels,
|
|
81
|
+
withPlaceholders,
|
|
82
|
+
} = options;
|
|
83
|
+
|
|
84
|
+
const {
|
|
85
|
+
buttonStyle = {},
|
|
86
|
+
buttonTextStyle = {},
|
|
87
|
+
colorScheme = "light",
|
|
88
|
+
darkTheme,
|
|
89
|
+
formFieldStyle = {},
|
|
90
|
+
defaultStyling = true,
|
|
91
|
+
formKeyboardAvoidingViewStyle = {},
|
|
92
|
+
formScrollViewStyle = {},
|
|
93
|
+
labelStyle = {},
|
|
94
|
+
lightTheme,
|
|
95
|
+
textInputStyle = {},
|
|
96
|
+
} = styling;
|
|
97
|
+
|
|
98
|
+
// useEffect(() => {
|
|
99
|
+
// const initOP = async () => {
|
|
100
|
+
// try {
|
|
101
|
+
// await initialize(merchantId, apiKey, isProduction, countryCode);
|
|
102
|
+
// await createDeviceSessionId();
|
|
103
|
+
// } catch (e) {
|
|
104
|
+
// console.error(e);
|
|
105
|
+
// }
|
|
106
|
+
// };
|
|
107
|
+
// initOP();
|
|
108
|
+
// }, []);
|
|
109
|
+
|
|
110
|
+
return (
|
|
111
|
+
<FormThemeProvider
|
|
112
|
+
colorScheme={colorScheme}
|
|
113
|
+
dark={darkTheme}
|
|
114
|
+
light={lightTheme}
|
|
115
|
+
>
|
|
116
|
+
<FormProvider initialValues={{ cardNumber: "" }} onSubmit={handleSubmit}>
|
|
117
|
+
<KeyboardAvoidingView
|
|
118
|
+
behavior="padding"
|
|
119
|
+
enabled
|
|
120
|
+
keyboardVerticalOffset={100}
|
|
121
|
+
style={
|
|
122
|
+
defaultStyling
|
|
123
|
+
? [styles.keyboardAvoidingView, formKeyboardAvoidingViewStyle]
|
|
124
|
+
: formKeyboardAvoidingViewStyle
|
|
125
|
+
}
|
|
126
|
+
>
|
|
127
|
+
<ScrollView
|
|
128
|
+
showsVerticalScrollIndicator={false}
|
|
129
|
+
style={
|
|
130
|
+
defaultStyling
|
|
131
|
+
? [styles.formView, formScrollViewStyle]
|
|
132
|
+
: formScrollViewStyle
|
|
133
|
+
}
|
|
134
|
+
>
|
|
135
|
+
<OPHolderNameInput
|
|
136
|
+
options={{
|
|
137
|
+
formFieldStyle,
|
|
138
|
+
defaultStyling,
|
|
139
|
+
inputStyle: {},
|
|
140
|
+
labelStyle,
|
|
141
|
+
textInputStyle,
|
|
142
|
+
}}
|
|
143
|
+
withAnimatedText={withAnimatedTexts}
|
|
144
|
+
withIcon={withIcons}
|
|
145
|
+
withLabel={withLabels}
|
|
146
|
+
withPlaceholder={withPlaceholders}
|
|
147
|
+
/>
|
|
148
|
+
<OPCardNumberInput
|
|
149
|
+
options={{
|
|
150
|
+
formFieldStyle,
|
|
151
|
+
defaultStyling,
|
|
152
|
+
inputStyle: {},
|
|
153
|
+
labelStyle,
|
|
154
|
+
textInputStyle,
|
|
155
|
+
}}
|
|
156
|
+
withAnimatedText={withAnimatedTexts}
|
|
157
|
+
withIcon={withIcons}
|
|
158
|
+
withLabel={withLabels}
|
|
159
|
+
withPlaceholder={withPlaceholders}
|
|
160
|
+
/>
|
|
161
|
+
{defaultStyling && groupedView ? (
|
|
162
|
+
<View style={{ flexDirection: "row", gap: 12 }}>
|
|
163
|
+
{expIsMMYY ? (
|
|
164
|
+
<OPExpInput
|
|
165
|
+
options={{
|
|
166
|
+
formFieldStyle: { flex: 1 },
|
|
167
|
+
defaultStyling,
|
|
168
|
+
inputStyle: {},
|
|
169
|
+
labelStyle,
|
|
170
|
+
textInputStyle,
|
|
171
|
+
}}
|
|
172
|
+
withAnimatedText={withAnimatedTexts}
|
|
173
|
+
withIcon={withIcons}
|
|
174
|
+
withLabel={withLabels}
|
|
175
|
+
withPlaceholder={withPlaceholders}
|
|
176
|
+
/>
|
|
177
|
+
) : (
|
|
178
|
+
<>
|
|
179
|
+
<OPExpMonthInput
|
|
180
|
+
options={{
|
|
181
|
+
formFieldStyle: { flex: 1 },
|
|
182
|
+
defaultStyling,
|
|
183
|
+
inputStyle: {},
|
|
184
|
+
labelStyle,
|
|
185
|
+
textInputStyle,
|
|
186
|
+
}}
|
|
187
|
+
withAnimatedText={withAnimatedTexts}
|
|
188
|
+
withIcon={withIcons}
|
|
189
|
+
withLabel={withLabels}
|
|
190
|
+
withPlaceholder={withPlaceholders}
|
|
191
|
+
/>
|
|
192
|
+
<OPExpYearInput
|
|
193
|
+
options={{
|
|
194
|
+
formFieldStyle: { flex: 1 },
|
|
195
|
+
defaultStyling,
|
|
196
|
+
inputStyle: {},
|
|
197
|
+
labelStyle,
|
|
198
|
+
textInputStyle,
|
|
199
|
+
}}
|
|
200
|
+
withAnimatedText={withAnimatedTexts}
|
|
201
|
+
withIcon={withIcons}
|
|
202
|
+
withLabel={withLabels}
|
|
203
|
+
withPlaceholder={withPlaceholders}
|
|
204
|
+
/>
|
|
205
|
+
</>
|
|
206
|
+
)}
|
|
207
|
+
<OPCvv2Input
|
|
208
|
+
options={{
|
|
209
|
+
formFieldStyle: { flex: 1 },
|
|
210
|
+
defaultStyling,
|
|
211
|
+
inputStyle: {},
|
|
212
|
+
labelStyle,
|
|
213
|
+
textInputStyle,
|
|
214
|
+
}}
|
|
215
|
+
withAnimatedText={withAnimatedTexts}
|
|
216
|
+
withIcon={withIcons}
|
|
217
|
+
withLabel={withLabels}
|
|
218
|
+
withPlaceholder={withPlaceholders}
|
|
219
|
+
/>
|
|
220
|
+
</View>
|
|
221
|
+
) : (
|
|
222
|
+
<>
|
|
223
|
+
{expIsMMYY ? (
|
|
224
|
+
<OPExpInput
|
|
225
|
+
options={{
|
|
226
|
+
formFieldStyle,
|
|
227
|
+
defaultStyling,
|
|
228
|
+
inputStyle: {},
|
|
229
|
+
labelStyle,
|
|
230
|
+
textInputStyle,
|
|
231
|
+
}}
|
|
232
|
+
withAnimatedText={withAnimatedTexts}
|
|
233
|
+
withIcon={withIcons}
|
|
234
|
+
withLabel={withLabels}
|
|
235
|
+
withPlaceholder={withPlaceholders}
|
|
236
|
+
/>
|
|
237
|
+
) : (
|
|
238
|
+
<>
|
|
239
|
+
<OPExpMonthInput
|
|
240
|
+
options={{
|
|
241
|
+
formFieldStyle,
|
|
242
|
+
defaultStyling,
|
|
243
|
+
inputStyle: {},
|
|
244
|
+
labelStyle: {},
|
|
245
|
+
textInputStyle,
|
|
246
|
+
}}
|
|
247
|
+
withAnimatedText={withAnimatedTexts}
|
|
248
|
+
withIcon={withIcons}
|
|
249
|
+
withLabel={withLabels}
|
|
250
|
+
withPlaceholder={withPlaceholders}
|
|
251
|
+
/>
|
|
252
|
+
<OPExpYearInput
|
|
253
|
+
options={{
|
|
254
|
+
formFieldStyle,
|
|
255
|
+
defaultStyling,
|
|
256
|
+
inputStyle: {},
|
|
257
|
+
labelStyle,
|
|
258
|
+
textInputStyle,
|
|
259
|
+
}}
|
|
260
|
+
withAnimatedText={withAnimatedTexts}
|
|
261
|
+
withIcon={withIcons}
|
|
262
|
+
withLabel={withLabels}
|
|
263
|
+
withPlaceholder={withPlaceholders}
|
|
264
|
+
/>
|
|
265
|
+
</>
|
|
266
|
+
)}
|
|
267
|
+
|
|
268
|
+
<OPCvv2Input
|
|
269
|
+
options={{
|
|
270
|
+
formFieldStyle,
|
|
271
|
+
defaultStyling,
|
|
272
|
+
inputStyle: {},
|
|
273
|
+
labelStyle,
|
|
274
|
+
textInputStyle,
|
|
275
|
+
}}
|
|
276
|
+
withAnimatedText={withAnimatedTexts}
|
|
277
|
+
withIcon={withIcons}
|
|
278
|
+
withLabel={withLabels}
|
|
279
|
+
withPlaceholder={withPlaceholders}
|
|
280
|
+
/>
|
|
281
|
+
</>
|
|
282
|
+
)}
|
|
283
|
+
<SubmitButton
|
|
284
|
+
buttonStyle={buttonStyle}
|
|
285
|
+
buttonTextStyle={buttonTextStyle}
|
|
286
|
+
defaultStyling={defaultStyling}
|
|
287
|
+
/>
|
|
288
|
+
</ScrollView>
|
|
289
|
+
</KeyboardAvoidingView>
|
|
290
|
+
</FormProvider>
|
|
291
|
+
</FormThemeProvider>
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
const styles = StyleSheet.create({
|
|
296
|
+
formView: {
|
|
297
|
+
height: "100%",
|
|
298
|
+
marginHorizontal: 12,
|
|
299
|
+
},
|
|
300
|
+
keyboardAvoidingView: {
|
|
301
|
+
flex: 1,
|
|
302
|
+
},
|
|
303
|
+
});
|