Skip to content

Commit

Permalink
SumUp iOS SDK version 1.3
Browse files Browse the repository at this point in the history
**Deployment target changed to iOS 6.**

* [UPDATE] Base SDK is iOS 9.3, deployment target is iOS 6
* [ADDED] Provide additional information on transaction and payment
  instrument in `-[SMPCheckoutResult additionalInfo]`.
* [ADDED] New terminal including US support
* [BUGFIX] Fix an issue where some C&S transactions and mobile payments
  would incorrectly be reported as failed
* [IMPROVEMENT] Improve layout on iPhone 6, iPhone 6 Plus, and iPad Pro
* [IMPROVEMENT] Match style of SumUp iOS app version 1.60 and later
* [IMPROVEMENT] Improve support of Wake-on-Bluetooth PIN+ readers
* [IMPROVEMENT] Add nullability annotations
* [IMPROVEMENT] Prefix some internal classes to avoid duplicated symbols
  • Loading branch information
mollidor committed Sep 7, 2016
2 parents 204188b + 96487d9 commit 5be1695
Show file tree
Hide file tree
Showing 382 changed files with 305 additions and 101 deletions.
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,37 @@
# SumUp iOS SDK Changelog

## Version 1.3

**Deployment target changed to iOS 6.**

* [UPDATE] Base SDK is iOS 9.3, deployment target is iOS 6
* [ADDED] Provide additional information on transaction and payment
instrument in `-[SMPCheckoutResult additionalInfo]`.
* [ADDED] New terminal including US support
* [BUGFIX] Fix an issue where some C&S transactions and mobile payments
would incorrectly be reported as failed
* [IMPROVEMENT] Improve layout on iPhone 6, iPhone 6 Plus, and iPad Pro
* [IMPROVEMENT] Match style of SumUp iOS app version 1.60 and later
* [IMPROVEMENT] Improve support of Wake-on-Bluetooth PIN+ readers
* [IMPROVEMENT] Add nullability annotations
* [IMPROVEMENT] Prefix some internal classes to avoid duplicated symbols,
see [issue 15](https://github.com/sumup/sumup-ios-sdk/issues/15).

Sample application:

* [UPDATE] Application supports large screens
* [UPDATE] Deployment target has been raised to iOS 6
* [IMPROVEMENT] Remove `-w` in other linker flags and hint from README.
* [IMPROVEMENT] Add NSBluetoothPeripheralUsageDescription to Info.plist

## Version 1.2.2

* [ADDED] `+[SumupSDK loginWithToken:completion:]` provides a way to log in a
merchant with an access token acquired using the
[authentication API](https://sumup.com/integration#APIAuth).
* [IMPROVEMENT] Always provide an error object if login fails in
`+[SumupSDK presentLoginFromViewController:animated:completionBlock]`
* [IMPROVEMENT] no need to link against `stdc++` anymore

## Version 1.2.1
* [IMPROVEMENT] Rename SBJson to [avoid conflicts](https://github.com/sumup/sumup-ios-sdk/issues/1).
Expand Down
44 changes: 23 additions & 21 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Portions of the SumUp iOS SDK and sample app may utilize the following copyright
[SBJson for Objective-C](http://www.sbjson.org)

Copyright (C) 2007-2009 Stig Brautaset. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Expand Down Expand Up @@ -40,9 +40,9 @@ Uses the QuickDialog Framework.
Copyright 2011 [ESCOZ Inc](http://escoz.com)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

---
Expand All @@ -51,7 +51,7 @@ Uses example code of Erica Sadun.

[Erica Sadun](http://ericasadun.com), iPhone Developer's Cookbook, 6.x Edition
BSD License

Modified by Eric Horacek for Monospace Ltd. on 2/4/13

Copyright (c) Erica Sadun
Expand All @@ -78,19 +78,21 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI

---

Uses [ISHPermissionKit](https://github.com/iosphere/ISHPermissionKit).

A unified way for iOS apps to request user permissions.

By [iosphere GmbH](https://iosphere.de) and contributors.
Licensed under the MIT License. See Below.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

* The name of IOSPHERE GMBH may not be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IOSPHERE GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Uses NSData+Base64 by Matt Gallagher
Created by Matt Gallagher on 2009/06/03.
Copyright 2009 Matt Gallagher. All rights reserved.

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software. Permission is granted to anyone to
use this software for any purpose, including commercial applications, and to
alter it and redistribute it freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
65 changes: 38 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# SumUp iOS SDK

## Version 1.2.2
## Version 1.3

- [Changelog](CHANGELOG.md)

#### Deployment Target
The SumUp SDK is suitable from iOS 6.0 to iOS 10 for iPad and iPhone,
so please set your deployment target to 6.0 or later.

## Getting started

### Preparing your Xcode project
Expand All @@ -22,34 +26,40 @@ are members of your app's target. Make sure your app is linked to `SumupSDK.fram

Lastly, the SumUp SDK has a few dependencies to system frameworks. Please make sure that your app links against the following frameworks:

* AVFoundation (needs to be linked as **optional** if your deployment target is iOS 5.x)
* AVFoundation
* Accelerate
* MapKit

Please also add `-lstdc++` to `OTHER_LDFLAGS` ("Other Linker Flags") of your target.

*You might want to silence warnings like "was built for newer iOS version than being linked" by adding `-w` to "Other Linker Flags" as well to work around a [bug in Xcode 7](http://stackoverflow.com/a/32543155).*

On older versions of Xcode you might also need to link to:

* AudioToolbox
* AudioUnit
* CFNetwork
* CoreAudio
* CoreGraphics
* CoreLocation
* Foundation
* GLKit
* Security
* UIKit


#### Deployment Target
The SumUp SDK is suitable from iOS 5.1.1 to iOS 8 for iPad and iPhone, so please set your deployment target to 5.1.1 or later.

### Location/Microphone usage
The SumUp SDK needs to access the user's location and the device's microphone. If your app has not asked for the user's permission the SumUp SDK will ask at the first login or checkout attempt. Please add the keys `NSLocationWhenInUseUsageDescription` and `NSMicrophoneUsageDescription` to your info plist file and add a (most likely english) explanation why the app needs the user's location. You can provide localization using a localized `InfoPlist.strings` file.

Please make sure to add `-ObjC` to "Other Linker Flags" if it is not included.

### Supported Device Orientation
Your app must support at least one landscape orientation. So please make sure
to support at least one of the orientations Landscape Left/Right.
See `UISupportedInterfaceOrientations` in the sample app's
[Info.plist](SumupSDKSampleApp/SumupSDKSampleApp-Info.plist#L54-L60)
or the "General" tab in Xcode's Target Editor.

### Privacy Info.plist keys
The SumUp SDK needs to access the user's location, Bluetooth peripherals,
and the device's microphone.
If your app has not asked for the user's permission the SumUp SDK will ask at
the first login or checkout attempt. Please add the following keys
to your info plist file:
* NSLocationWhenInUseUsageDescription
* NSBluetoothPeripheralUsageDescription
* NSMicrophoneUsageDescription
* NSLocationUsageDescription (only if deployment target is iOS 6 or 7)

See the sample app's
[Info.plist](SumupSDKSampleApp/SumupSDKSampleApp-Info.plist#L38-L45).
You can provide localization by providing a localized
[InfoPlist.strings](SumupSDKSampleApp/en.lproj/InfoPlist.strings) file.

For reference see the iOS Developer Library on
[location usage on iOS 6 and 7](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW27),
[iOS 8 and later](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW26),
[Bluetooth peripheral usage](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW20)
and [microphone access in iOS 7 and later](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW25).

## Integrating the SumUp SDK with your app

Expand Down Expand Up @@ -110,6 +120,7 @@ Using this checkout request you can then start accepting payments:
[SumupSDK checkoutWithRequest:request
fromViewController:vc
completion:^(SMPCheckoutResult *result, NSError *error) {
// ... handle completed and failed payments here
// handle completed and failed payments here
// retrieve information via result.additionalInfo
}];
```
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,20 @@

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

/*
* Currency codes to be used in checkout (ISO 4217 code).
* Other currency codes are permissible in the request object,
* but are likely not to be accepted during the checkout.
*/

extern NSString *const SMPCurrencyCodeBRL;
extern NSString *const SMPCurrencyCodeCHF;
extern NSString *const SMPCurrencyCodeEUR;
extern NSString *const SMPCurrencyCodeGBP;
extern NSString *const SMPCurrencyCodePLN;
extern NSString * const SMPCurrencyCodeBRL;
extern NSString * const SMPCurrencyCodeCHF;
extern NSString * const SMPCurrencyCodeEUR;
extern NSString * const SMPCurrencyCodeGBP;
extern NSString * const SMPCurrencyCodePLN;
extern NSString * const SMPCurrencyCodeUSD;

typedef NS_OPTIONS (NSUInteger, SMPPaymentOptions) {
SMPPaymentOptionAny = 0,
Expand All @@ -34,7 +37,7 @@ typedef NS_OPTIONS (NSUInteger, SMPPaymentOptions) {
\param totalAmount The total amount to be charged to a customer. Cannot be nil.
\param title An optional title to be displayed in the merchant's history and on customer receipts.
\param currencyCode Currency Code in which the total should be charged (ISO 4217 code, see SMPCurrencyCode). Cannot be nil, has to match the currency of the merchant logged in.
\param currencyCode Currency Code in which the total should be charged (ISO 4217 code, see SMPCurrencyCode). Cannot be nil, has to match the currency of the merchant logged in. Use [[[SumupSDK currentMerchant] currencyCode] and ensure its length is not 0.
\param options Payment options to choose a payment type(card reader, mobile payment...)
\discussion Be careful when creating the NSDecimalNumber to not
Expand All @@ -44,7 +47,7 @@ typedef NS_OPTIONS (NSUInteger, SMPPaymentOptions) {
\returns A new request object or nil if totalAmount or currencyCode are nil.
*/
+ (SMPCheckoutRequest *)requestWithTotal:(NSDecimalNumber *)totalAmount
title:(NSString *)title
title:(nullable NSString *)title
currencyCode:(NSString *)currencyCode
paymentOptions:(SMPPaymentOptions)paymentOptions;

Expand All @@ -53,25 +56,37 @@ typedef NS_OPTIONS (NSUInteger, SMPPaymentOptions) {
\param totalAmount The total amount to be charged to a customer. Cannot be nil.
\param title An optional title to be displayed in the merchant's history and on customer receipts.
\param currencyCode Currency Code in which the total should be charged (ISO 4217 code, see SMPCurrencyCode). Cannot be nil, has to match the currency of the merchant logged in. Use [[[SumupSDK currentMerchant] currencyCode].
\param currencyCode Currency Code in which the total should be charged (ISO 4217 code, see SMPCurrencyCode). Cannot be nil, has to match the currency of the merchant logged in. Use [[[SumupSDK currentMerchant] currencyCode] and ensure its length is not 0.
\discussion Be careful when creating the NSDecimalNumber to not
falsely use the NSNumber class creator methods.
\returns A new request object or nil if totalAmount or currencyCode are nil.
*/
+ (SMPCheckoutRequest *)requestWithTotal:(NSDecimalNumber *)totalAmount
title:(NSString *)title
title:(nullable NSString *)title
currencyCode:(NSString *)currencyCode;

/// The total amount to be charged to a customer.
@property (strong, readonly) NSDecimalNumber *totalAmount;
/**
\abstract The total amount to be charged to a customer.
\note Will not be nil if the instance was created using either
requestWithTotal:title:currencyCode:paymentOptions: or
requestWithTotal:title:currencyCode:
*/
@property (strong, readonly, nullable) NSDecimalNumber *totalAmount;

/// A title to be displayed in the merchant's history and on customer receipts.
@property (strong, readonly) NSString *title;
@property (strong, readonly, nullable) NSString *title;

/// Currency Code in which the total should be charged (ISO 4217 code, see SMPCurrencyCode). Cannot be nil.
@property (strong, readonly) NSString *currencyCode;
/**
\abstractCurrency Code in which the total should be charged (ISO 4217 code, see SMPCurrencyCode).
\note Will not be nil if the instance was created using either
requestWithTotal:title:currencyCode:paymentOptions: or
requestWithTotal:title:currencyCode:
*/
@property (strong, readonly, nullable) NSString *currencyCode;

/// Payment options to choose a payment type
@property (assign, readonly) SMPPaymentOptions paymentOptions;
Expand All @@ -83,6 +98,8 @@ typedef NS_OPTIONS (NSUInteger, SMPPaymentOptions) {
* This ID has to be unique in the scope of a SumUp merchant account and its sub-accounts.
* It must not be longer than 128 characters and can only contain printable ASCII characters.
*/
@property (strong) NSString *foreignTransactionID;
@property (strong, nullable) NSString *foreignTransactionID;

@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,22 @@

@interface SMPCheckoutResult : NSObject

/**
* A boolean indicating whether the checkout was sucessful.
*/
@property (readonly) BOOL success;
@property (strong, readonly) NSString *transactionCode;

/**
* The transaction code to be used as a reference to this transaction.
* Can be nil if the checkout failed in an early stage and did not reach SumUp's backend.
*/
@property (strong, readonly, nullable) NSString *transactionCode;

/**
* Additional information on the transaction like card information.
* Can be nil if the checkout failed prior to payment type selection or card insertion.
* Please see https://sumup.com/integration#TransactionHistoryModel for details.
*/
@property (strong, readonly, nullable) NSDictionary *additionalInfo;

@end
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
@interface SMPMerchant : NSObject

/// The currency code used by the merchant for all payments.
@property (readonly, copy) NSString *currencyCode;
@property (readonly, copy, nullable) NSString *currencyCode;

/// The merchant's identifier within the SumUp system.
@property (readonly, copy) NSString *merchantCode;
@property (readonly, copy, nullable) NSString *merchantCode;

@end
Loading

0 comments on commit 5be1695

Please sign in to comment.