Skip to content

Instantly share code, notes, and snippets.

View WirecardMobileServices's full-sized avatar

WirecardMobileServices WirecardMobileServices

View GitHub Profile
@WirecardMobileServices
WirecardMobileServices / podfile
Created April 21, 2017 13:06
AcceptSDK podfile
platform :ios, :deployment_target => "9.0"
use_frameworks!
def shared_dependencies
pod "acceptSDKTwo"
end
target 'AcceptDemo' do
shared_dependencies
end
@WirecardMobileServices
WirecardMobileServices / WDePOS-Init.m
Last active March 9, 2018 11:41
WDePOS initialization
// Import the SDK header
#import <WDePOS/WDePOS.h>
//End of SDK Setup process
CurrentUserCompletion setupCompletion = ^( WDMerchantUser * _Nullable currentUser, WDMerchantCashier * _Nullable cashier, NSError * _Nullable error){
//Current User is returned upon successful login
//if the Cash Management is enabled and Cashier record exist for the current user then the Cashier is returned also
};
// The SDK is initialized as shared instance so can be accessed
@WirecardMobileServices
WirecardMobileServices / WDePOS-Init.swift
Last active March 27, 2020 13:44
AcceptSDK initialization
// Import SDK module
import WDePOS
//End of SDK setup process
let setupCompletion:CurrentUserCompletion = {( currentUser:WDMerchantUser?, cashier:WDMerchantCashier? , error:Error?) in
//Current User is returned upon successful login
//if the Cash Management is enabled and Cashier record exist for the current user then the Cashier is returned also
}
// The SDK is initialized as shared instance so can be accessed
@WirecardMobileServices
WirecardMobileServices / WDePOS-SaleRequest-Cash.m
Last active September 16, 2019 13:49
Sale Request for performing the Cash payment
// Create the instance of the Sale Request
// Here the minimum data is depicted
WDSaleRequestPurchase *saleRequest = [[WDSaleRequestPurchase alloc] initWithUniqueId:@"yourSaleUniqueID" // provide your unique ID to identify the Sale
location:nil // provide the GPS location
inclusiveTaxes:YES // Tax inclusive/exclusive flag
currency:@"EUR" // Currency to use for this Sale
note:@"Test Posmate Sale" // Top level note for this sale
gratuityTaxRate:nil // Gratuity tax rate - nil if no gratuity to be set later in the payment flow
// Create one item named "Item 1" costing 10.00 EUR at 20% Tax
@WirecardMobileServices
WirecardMobileServices / WDePOS-SaleRequest-Cash.swift
Last active September 16, 2019 13:48
Sale Request for performing the Cash payment
// Create the instance of the Sale Request
// Here the minimum data is depicted
let saleRequest = WDSaleRequestPurchase(uniqueId: "yourSaleUniqueID", // provide your unique ID to identify the Sale
location: nil, // provide the GPS location for this payment e.g. the mobile device location
inclusiveTaxes: true, // Tax inclusive/exclusive flag
currency: "EUR", // Currency to use for this Sale
note: "Test Sale", // Top level note for this sale
gratuityTaxRate: nil // Gratuity tax rate - nil if no gratuity to be set later in the payment flow
)!
@WirecardMobileServices
WirecardMobileServices / WDePOS-DiscoverDevices.m
Last active April 15, 2019 07:09
Discover paired and connected devices
// The SDK is initialized as shared instance so can be accessed
// from multiple View Controllers
WDePOS *sdk = [WDePOS sharedInstance];
// Set the SDK target environment - in this case Public Test
// and the username and password to authenticate to it
[sdk setupWithEnvironment:WDEnvironmentPublicTest
username:@"yourUsername"
password:@"yourPassword"
completion:^(WDMerchantUser * _Nullable currentUser, WDMerchantCashier * _Nullable cashier, NSError * _Nullable error) {
@WirecardMobileServices
WirecardMobileServices / WDePOS-DiscoverDevices.swift
Last active April 9, 2019 11:04
Discover paired and connected devices
//End of SDK setup process
let setupCompletion: CurrentUserCompletion = {( currentUser:WDMerchantUser?, cashier:WDMerchantCashier? , error:Error?) in
//Current User is returned upon successful login
//if the Cash Management is enabled and Cashier record exist for the current user then the Cashier is returned also
}
// The SDK is initialized as shared instance so can be accessed
// from multiple View Controllers
let sdk: WDePOS = WDePOS.sharedInstance()
@WirecardMobileServices
WirecardMobileServices / WDePOS-SaleRequest-Card.swift
Last active April 9, 2019 10:51
Sale Request for performing the Card payment
let sdk: WDePOS = WDePOS.sharedInstance()
// Discover active terminals and use it - in this case we use the first one
// Alternatively use the one discovered previously and stored in an instance variable (or user preferences)
sdk.terminalManager.discoverDevices(WDExtensionTypeUUID.WDPosMateExtensionUUID) { (terminals: [WDTerminal]?, error: Error?) in
if let terminalsArr = terminals {
//Here we assume that at least one terminal is present
let terminal:WDTerminal! = terminalsArr.first
// Create the instance of the Sale Request
@WirecardMobileServices
WirecardMobileServices / WDePOS-SaleRequest-Card.m
Last active February 4, 2020 08:54
Sale Request for performing the Card payment
//End of SDK Setup process
CurrentUserCompletion setupCompletion = ^( WDMerchantUser * _Nullable currentUser, WDMerchantCashier * _Nullable cashier, NSError * _Nullable error){
//Current User is returned upon successful login
//if the Cash Management is enabled and Cashier record exist for the current user then the Cashier is returned also
};
// The SDK is initialized as shared instance so can be accessed
// from multiple View Controllers
WDePOS *sdk = [WDePOS sharedInstance];
@WirecardMobileServices
WirecardMobileServices / WDePOS-Payment.m
Last active April 15, 2019 07:05
Performing the Payment
// It is necessary to implement WDPaymentDelegate methods to receive events from the payment flow
@interface PaymentHandler : NSObject<WDPaymentDelegate>
@end
@implementation PaymentHandler
// The end of the payment process
- (void)completion:(WDSaleResponse * _Nullable)saleResponse saleResponseError:(NSError * _Nullable)saleResponseError {
//sale - Is the completed Sale - contains the sale status, details, results
//error - If any error is encountered during the sale it would be reported