Giter Club home page Giter Club logo

nets-easy-ios-sdk's Introduction

MiA - Nets EASY iOS SDK v1.6.1

Getting started

MiA - Nets Easy iOS SDK is a library which facilitates the integration of the Nets Easy Re-direct Checkout in your iOS application.

Detailed documentation can be found here.

Additional resources:

  • Nets Easy technical documentation can be found here.
  • Nets Easy API documentation can be found here.
  • Nets Easy - Android SDK can be found here.

Sample Project

We have provided a sample project, MiaSample, in the repository which is written in Swift 4.2 and it demonstrates MiA Nets EASY SDK usage and capabilities. To use it, download the repo, run pod install to download the required libraries and open MiaSample.xcworkspace. After that, navigate to API.swift to add your provided information from Nets Easy platform.

Requirements

  • MiA iOS SDK requires iOS 9 or above.

Installation

Carthage

  • Add the following line to your Cartfile
github "nets-ecom/Nets-Easy-iOS-SDK"
  • Run carthage update to get Mia SDK
  • Navigate to Carthage/Builds/iOS for Mia.framework
  • In your project TARGET, navigate to GENERAL
  • Drag and drop Mia.framework to Embedded Binaries
  • In any file you'd like to use Mia in, do not forget to import the framework with import Mia

Manual

  • Download/clone this https://github.com/nets-ecom/Nets-Easy-iOS-SDK.git to get Mia.framework
  • In your project TARGET, navigate to GENERAL
  • Drag and drop Mia.framework to Embedded Binaries
  • In any file you'd like to use Mia in, do not forget to import the framework with import Mia

Xcode 11+ users can now replace Mia.framework in Xcode-Targets Frameworks, Libraries and Embedded Contents with Mia.XCFramework for iOS and iOS Simulator architectures.

High level architecture of the Nets Easy SDK

The below picture illustrates the SDK and its interactions with the macro components of the integration’s environment.

Usage

After setup is ready, using MiA SDK is easy. Initialize and present Mia SDK's checkout controller providing actions for success, cancelation and failure block parameters. The SDK will display a checkout WebView and invoke the action blocks accordingly. For full references, please refer to Documentation folder.

let miaSDK = MiaSDK.checkoutControllerForPayment(
    withID: paymentId,
    paymentURL: paymentURL,
    isEasyHostedWithRedirectURL: easyHostedRedirectURL,
    cancelURL: cancelURL,
    success: { controller in /* handle success */ },
    cancellation: { controller in /* handle cancellation */ },
    failure: { controller, error in /* handle failure */ }
)

present(miaSDK, animated: true)

IMPORTANT: While making the API call for creating a payment, make sure you add "commercePlatformTag" : "iOSSDK" in the request header. This is critical to identify the platform from which the payment is initiated.

let headers: HTTPHeaders = [
    "Authorization": token,
    "Content-Type": "application/json",
    "commercePlatformTag" : "iOSSDK"
]

Integration - Run Script

To assist integration of Mia.framework in your project, navigate to the project's target (under TARGETS) in Xcode and add the following Run Script in Build Phases section. If you want to avoid the error when running on simulator, please also check the box for this. Note: Run script only when installing!

APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"

# This script loops through the frameworks embedded in the application and
# removes unused architectures.
find "$APP_PATH" -name 'Mia.framework' -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"

EXTRACTED_ARCHS=()

for ARCH in $ARCHS
do
echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
done

echo "Merging extracted architectures: ${ARCHS}"
lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"
rm "${EXTRACTED_ARCHS[@]}"

echo "Replacing original executable with thinned version"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"

done

Contact

If you have any question or feedback, please contact us via email: [email protected].

License

Copyright (c) 2020 Nets Denmark A/S

NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS BINARY CODE LICENSE AGREEMENT. BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED.

Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software.

No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement.

Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), to deal in the Software, including without limitation the rights to use, copy, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

Software may only be used for commercial or production purpose together with Netaxept services provided from NETS, its subsidiaries or affiliates under common control.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

nets-easy-ios-sdk's People

Contributors

buildmanager-nets avatar mfigl-n avatar nets-in-app avatar sbhed avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nets-easy-ios-sdk's Issues

Undefined symbol: _OBJC_CLASS_$_MiaSDK

I have downloaded the latest version (1.5.0) and integrated it with my react-native application. The android platform configuration was a success, but for iOS I got this error when running the project.
"react-native": "0.64.2",
iPhone 13 Pro Emulator in Xcode - 13

Undefined symbols for architecture x86_64:
"OBJC_CLASS$_MiaSDK", referenced from:
objc-class-ref in libreact-native-rn-mia.a(RnMia.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Dependency "Easy-iOS-SDK" has no shared framework schemes: Failed to Import Mia

OUTPUT of carthage update

*** Cloning Easy-iOS-SDK
*** Checking out Easy-iOS-SDK at "1.2.0"
*** xcodebuild output can be found in /var/folders/5t/5fg5s4b94tn0jrxyhj95nvx00000gn/T/carthage-xcodebuild.yi0via.log
*** Skipped building Easy-iOS-SDK due to the error:
Dependency "Easy-iOS-SDK" has no shared framework schemes

If you believe this to be an error, please file an issue with the maintainers at https://github.com/DIBS-Payment-Services/Easy-iOS-SDK/issues/new

Cartfile
github "DIBS-Payment-Services/Easy-iOS-SDK"

MiaSample incorrectly includes checkout cancelUrl when performing embedded checkout

Changing the settings from the swipe-out settings menu from "HostedPaymentPage" to "EmbeddedCheckout", and attempting checkout results in the following error:

400 'https://test.api.dibspayment.eu/v1/payments' [0.3617 s]:
[...]
{
  "errors" : {
    "checkout.CancelUrl" : [
      "Cancel url is only supported for hosted checkout"
    ]
  }
}

The fix for it is a simple one, which I'm submitting as a pull request that will reference this issue.

React Native - Multiple commands produce header files

Hello, I have a issue with integrating mia for react native. Followed the instructions for SDK version 1.6, autolinking works, but in some part of build phase it ends with error:

Multiple commands produce '/Users//Library/Developer/Xcode/DerivedData/-dzbgrdhclhjyxlgkranvlqpssdqw/Build/Products/Debug-iphoneos/react-native-rn-mia/react_native_rn_mia.framework/Headers/MIAPaymentInfo.h'

  • Target 'react-native-rn-mia' (project 'Pods') has copy command from '/Users//IdeaProjects///node_modules/react-native-rn-mia/ios/Mia.framework/PrivateHeaders/MIAPaymentInfo.h' to '/Users//Library/Developer/Xcode/DerivedData/***-dzbgrdhclhjyxlgkranvlqpssdqw/Build/Products/Debug-iphoneos/react-native-rn-mia/react_native_rn_mia.framework/Headers/MIAPaymentInfo.h'
  • Target 'react-native-rn-mia' (project 'Pods') has copy command from '/Users//IdeaProjects///node_modules/react-native-rn-mia/ios/Mia.xcframework/ios-arm64_armv7_armv7s/Mia.framework/PrivateHeaders/MIAPaymentInfo.h' to '/Users//Library/Developer/Xcode/DerivedData/***-dzbgrdhclhjyxlgkranvlqpssdqw/Build/Products/Debug-iphoneos/react-native-rn-mia/react_native_rn_mia.framework/Headers/MIAPaymentInfo.h'
  • Target 'react-native-rn-mia' (project 'Pods') has copy command from '/Users//IdeaProjects///node_modules/react-native-rn-mia/ios/Mia.xcframework/ios-arm64_i386_x86_64-simulator/Mia.framework/PrivateHeaders/MIAPaymentInfo.h' to '/Users//Library/Developer/Xcode/DerivedData/***-dzbgrdhclhjyxlgkranvlqpssdqw/Build/Products/Debug-iphoneos/react-native-rn-mia/react_native_rn_mia.framework/Headers/MIAPaymentInfo.h'

Using:
RN17
XCode version 13.4.1 - New build system

"unsupported URL" error when user doesn't have MobilePay app installed on the iphone.

How to reproduce:

  1. Our solution is based on ReactNative. (Mia Bridge API used: https://github.com/Nets-eCom/Nets-Easy-iOS-SDK/blob/master/ReactNative/react-native-rn-mia/ios/RnMia.m)
  2. Make sure 'MobilePay' app is not installed on the test iphone.
  3. Select 'MobilePay' as payment option.

Error is logged as showing below:
image

It's working fine on android devices. (MobilePay webpage is loaded correctly with no error)

Any suggestion on how to fix the issue? Thanks!

Unable to copy/paste card info.

Our integration is based on ReactNative, is there a way to enable copy/paste functionality in payment window?

image

Also password manager is not supported under IOS. (but works fine on Android phone)

Alignment of Subscription updated screen is coming out of bounds

I am facing an issue integrating Nets Easy React Native SDK with my React Native application.

I initiate the subscription procedure.
After entering the card details, I click on the subscribe button.
The alignment of the subscription updated screen is coming out of bounds.

The issue is happening on both Android and iOS.

Android -
Screenshot_1689065770

iOS -
Simulator Screen Shot - iPhone 14 - 2023-07-07 at 12 39 36

Versions -
NPM package react-native-rn-mia version - v1.6.1

React Native version - 0.71.1
Node version - v16.16.0
Ruby version - 2.7.5
NPM version - 8.11.0
New RN architecture - disabled
XCode version 14.2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.