Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
## [0.2.0] Initial release with working Android and iOS examples
## [0.2.1] Update internal SDK libraries to android 3.8.8 and iOS 3.8.5
## [0.2.2] Update internal SDK libraries to android 3.8.9 and iOS 3.8.8. Upgrade React Native version
## [0.3.0] Update internal SDK libraries to android 3.9.1 and iOS 4.0.0. Change ios integration to SPM
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def kotlin_version = getExtOrDefault("kotlinVersion")

dependencies {
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.3")
implementation "com.ecommpay:msdk-ui:3.8.9"
implementation "com.ecommpay:msdk-ui:3.9.1"

implementation "com.facebook.react:react-native:+"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
Expand Down
34 changes: 21 additions & 13 deletions android/src/main/java/com/msdkreactnative/MsdkReactNativeModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import android.util.Log
import com.ecommpay.msdk.ui.EcmpActionType
import com.ecommpay.msdk.ui.EcmpAdditionalField
import com.ecommpay.msdk.ui.EcmpPaymentOptions
import com.ecommpay.msdk.ui.EcmpPaymentSDK
import com.ecommpay.msdk.ui.Ecommpay
import com.ecommpay.msdk.ui.EcmpScreenDisplayMode
import com.facebook.react.bridge.ActivityEventListener
import com.facebook.react.bridge.Arguments
Expand Down Expand Up @@ -40,7 +40,7 @@ class MsdkReactNativeModule(reactContext: ReactApplicationContext) :
params: ReadableMap,
promise: Promise,
) {
val currentActivity = currentActivity ?: return
val currentActivity = reactApplicationContext.currentActivity ?: return

val ecmpPaymentInfo = params.getMap("paymentInfo")?.let { it.buildPaymentInfo() }

Expand Down Expand Up @@ -84,18 +84,26 @@ class MsdkReactNativeModule(reactContext: ReactApplicationContext) :
isTestEnvironment = params.safeGetBoolean("googleIsTestEnvironment")

// Brand customization
params.getString("brandColor")?.let { colorString ->
brandColor = colorString
params.getString("primaryBrandColor")?.let { colorString ->
primaryBrandColor = colorString
}

params.getString("secondaryBrandColor")?.let { colorString ->
secondaryBrandColor = colorString
}

params.getBoolean("hideFooterLogo")?.let {
hideEcommpayLogo = it
}

// Stored card type
storedCardType = params.safeGetInt("storedCardType")
}

val mockMode = EcmpPaymentSDK.EcmpMockModeType.entries[params.getInt("mockModeType")]
val mockMode = Ecommpay.EcmpMockModeType.entries[params.getInt("mockModeType")]

// Initialize SDK and open payment form
val sdk = EcmpPaymentSDK(currentActivity.applicationContext, paymentOptions, mockMode)
val sdk = Ecommpay(currentActivity.applicationContext, paymentOptions, mockMode)

paymentPromise = promise

Expand All @@ -121,23 +129,23 @@ class MsdkReactNativeModule(reactContext: ReactApplicationContext) :
}

override fun onActivityResult(
activity: Activity?,
activity: Activity,
requestCode: Int,
resultCode: Int,
data: Intent?,
) {
when (resultCode) {
EcmpPaymentSDK.RESULT_SUCCESS -> {
val paymentJson = data?.getStringExtra(EcmpPaymentSDK.EXTRA_PAYMENT)
Ecommpay.RESULT_SUCCESS -> {
val paymentJson = data?.getStringExtra(Ecommpay.EXTRA_PAYMENT)
val resultMap = Arguments.createMap()
resultMap.putString("paymentJson", paymentJson)
resultMap.putInt("resultCode", resultCode)
paymentPromise?.resolve(resultMap)
}

EcmpPaymentSDK.RESULT_ERROR -> {
val errorCode = data?.getStringExtra(EcmpPaymentSDK.EXTRA_ERROR_CODE)
val errorMessage = data?.getStringExtra(EcmpPaymentSDK.EXTRA_ERROR_MESSAGE)
Ecommpay.RESULT_ERROR -> {
val errorCode = data?.getStringExtra(Ecommpay.EXTRA_ERROR_CODE)
val errorMessage = data?.getStringExtra(Ecommpay.EXTRA_ERROR_MESSAGE)
val resultMap = Arguments.createMap()
resultMap.putString("errorCode", errorCode)
resultMap.putString("errorMessage", errorMessage)
Expand All @@ -151,6 +159,6 @@ class MsdkReactNativeModule(reactContext: ReactApplicationContext) :
paymentPromise = null
}

override fun onNewIntent(data: Intent?) {}
override fun onNewIntent(data: Intent) {}

}
193 changes: 67 additions & 126 deletions example/ios/MsdkReactNativeExample.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,6 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "00E356ED1AD99517003FC87E"
BuildableName = "MsdkReactNativeExampleTests.xctest"
BlueprintName = "MsdkReactNativeExampleTests"
ReferencedContainer = "container:MsdkReactNativeExample.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand Down
3 changes: 2 additions & 1 deletion example/ios/MsdkReactNativeExample/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<!-- Do not change NSAllowsArbitraryLoads to true, or you will risk app rejection! -->
<key>NSAllowsArbitraryLoads</key>
<false/>
<key>NSAllowsLocalNetworking</key>
<true/>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>RCTNewArchEnabled</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
Expand Down
24 changes: 0 additions & 24 deletions example/ios/MsdkReactNativeExampleTests/Info.plist

This file was deleted.

This file was deleted.

8 changes: 2 additions & 6 deletions example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ require Pod::Executable.execute_command('node', ['-p',
{paths: [process.argv[1]]},
)', __dir__]).strip

platform :ios, 15.6
platform :ios, 16.6
prepare_react_native_project!
ENV['RCT_NEW_ARCH_ENABLED'] = '1'

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
Expand All @@ -23,11 +24,6 @@ target 'MsdkReactNativeExample' do
:app_path => "#{Pod::Config.instance.installation_root}/.."
)

target 'MsdkReactNativeExampleTests' do
inherit! :complete
# Pods for testing
end

post_install do |installer|
# https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
react_native_post_install(
Expand Down
1 change: 0 additions & 1 deletion example/node_modules

This file was deleted.

1 change: 1 addition & 0 deletions example/node_modules
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../node_modules
13 changes: 7 additions & 6 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,19 @@
"build:ios": "react-native build-ios --scheme MsdkReactNativeExample --mode Debug --extra-params \"-sdk iphonesimulator CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO\""
},
"dependencies": {
"react": "19.0.0",
"react-native": "^0.79.5"
"react": "19.1.0",
"react-native": "^0.81.3",
"msdk-react-native": "*"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@babel/preset-env": "^7.20.0",
"@babel/runtime": "^7.20.0",
"@react-native-community/cli": "latest",
"@react-native/babel-preset": "0.79.5",
"@react-native/metro-config": "0.79.5",
"@react-native/typescript-config": "0.79.5",
"react-native-builder-bob": "^0.30.2"
"@react-native/babel-preset": "0.81.1",
"@react-native/metro-config": "0.81.1",
"@react-native/typescript-config": "0.81.1",
"react-native-builder-bob": "^0.40.13"
},
"engines": {
"node": ">=18"
Expand Down
23 changes: 17 additions & 6 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ export default function App() {
const [mockModeType, setMockModeType] = useState<EcmpMockModeType>(EcmpMockModeType.disabled);
const [hideScanningCards, setHideScanningCards] = useState<boolean>(true);
const [hideSavedWallets, setHideSavedWallets] = useState<boolean>(false);
const [brandColor, setBrandColor] = useState<string>('#3498db');
const [primaryBrandColor, setPrimaryBrandColor] = useState<string>('#3498db');
const [secondaryBrandColor, setSecondaryBrandColor] = useState<string>('#CAB2FF');
const [storedCardType, setStoredCardType] = useState<string>('');

// Screen Display Modes
Expand Down Expand Up @@ -188,7 +189,9 @@ export default function App() {
applePayMerchantID: applePayMerchantID || undefined,
applePayDescription: applePayDescription || undefined,
applePayCountryCode: applePayCountryCode || undefined,
brandColor,
primaryBrandColor: primaryBrandColor,
secondaryBrandColor: secondaryBrandColor,
hideFooterLogo: true,
storedCardType: parseInt(storedCardType) || undefined
},
(result) => {
Expand Down Expand Up @@ -311,10 +314,18 @@ export default function App() {

<TextInput
style={dynamicStyles.input}
placeholder="Brand Color (#hex)"
placeholderTextColor={isDark ? '#8e8e93' : '#999'}
value={brandColor}
onChangeText={setBrandColor}
placeholder="Primary brand Color (#hex)"
placeholderTextColor={isDark ? '#4B007C' : '#999'}
value={primaryBrandColor}
onChangeText={setPrimaryBrandColor}
/>

<TextInput
style={dynamicStyles.input}
placeholder="Secondary brand Color (#hex)"
placeholderTextColor={isDark ? '#CAB2FF' : '#999'}
value={secondaryBrandColor}
onChangeText={setSecondaryBrandColor}
/>

<View style={dynamicStyles.switchRow}>
Expand Down
2 changes: 1 addition & 1 deletion ios/Models/PluginAdditionalField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import Foundation
import ecommpaySDK
import EcommpaySDK

internal struct PluginAdditionalField: Decodable {
let type: String
Expand Down
2 changes: 1 addition & 1 deletion ios/Models/PluginPaymentInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import Foundation
import ecommpaySDK
import EcommpaySDK

internal struct PluginPaymentInfo: Decodable {
let projectID: Int32
Expand Down
Loading
Loading