Merge pull request #1671 from stripe/dynamic-xcframework
Switch to dynamic Stripe3DS2.xcframework for SPM
This commit is contained in:
commit
bccc829600
|
@ -38,16 +38,6 @@ jobs:
|
|||
- run: "bundle add jazzy"
|
||||
- run: "bundle exec fastlane linting_tests"
|
||||
|
||||
lint-fauxpas:
|
||||
macos:
|
||||
xcode: 11.7.0 # Specify the Xcode version to use
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
- run: "bundle install"
|
||||
- run: "brew cask install fauxpas"
|
||||
- run: "bundle exec fastlane lint_fauxpas"
|
||||
|
||||
test-legacy-11:
|
||||
macos:
|
||||
xcode: 11.7.0 # Specify the Xcode version to use
|
||||
|
@ -77,6 +67,5 @@ workflows:
|
|||
- integration-tests
|
||||
- linting-tests
|
||||
- ui-and-analyze-tests
|
||||
- lint-fauxpas
|
||||
- test-legacy-11
|
||||
- test-legacy-12
|
||||
|
|
|
@ -4,7 +4,7 @@ output: docs/docs
|
|||
clean: true
|
||||
objc: true
|
||||
umbrella_header: Stripe/PublicHeaders/Stripe/Stripe.h
|
||||
framework_root: .
|
||||
framework_root: Stripe
|
||||
sdk: iphonesimulator
|
||||
author: Stripe
|
||||
author_url: https://stripe.com
|
||||
|
@ -17,3 +17,6 @@ theme: fullwidth
|
|||
exclude:
|
||||
- Stripe/PublicHeaders/Stripe/STD*
|
||||
- Stripe/PublicHeaders/Stripe/Stripe3DS2.h
|
||||
- InternalFrameworks/dynamic/Stripe3DS2.xcframework/**
|
||||
- build*
|
||||
- .git
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,54 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>AvailableLibraries</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>ios-x86_64-maccatalyst</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>Stripe3DS2.framework</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>x86_64</string>
|
||||
</array>
|
||||
<key>SupportedPlatform</key>
|
||||
<string>ios</string>
|
||||
<key>SupportedPlatformVariant</key>
|
||||
<string>maccatalyst</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>ios-arm64_x86_64-simulator</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>Stripe3DS2.framework</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
<string>x86_64</string>
|
||||
</array>
|
||||
<key>SupportedPlatform</key>
|
||||
<string>ios</string>
|
||||
<key>SupportedPlatformVariant</key>
|
||||
<string>simulator</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>ios-arm64</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>Stripe3DS2.framework</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
</array>
|
||||
<key>SupportedPlatform</key>
|
||||
<string>ios</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XFWK</string>
|
||||
<key>XCFrameworkFormatVersion</key>
|
||||
<string>1.0</string>
|
||||
</dict>
|
||||
</plist>
|
Binary file not shown.
|
@ -0,0 +1,22 @@
|
|||
//
|
||||
// STDSAlreadyInitializedException.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Cameron Sabol on 1/22/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import "STDSException.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
`STDSAlreadyInitializedException` represents an exception that will be thrown in the `STDSThreeDS2Service` instance has already been initialized.
|
||||
|
||||
@see STDSThreeDS2Service
|
||||
*/
|
||||
@interface STDSAlreadyInitializedException : STDSException
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,68 @@
|
|||
//
|
||||
// STDSAuthenticationRequestParameters.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 3/21/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "STDSJSONEncodable.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface STDSAuthenticationRequestParameters : NSObject <STDSJSONEncodable>
|
||||
|
||||
/**
|
||||
Designated initializer for `STDSAuthenticationRequestParameters`.
|
||||
|
||||
@param sdkTransactionIdentifier The SDK Transaction Identifier, as created by `[STDSTransaction createTransaction]`
|
||||
@param deviceData Optional device data collected by the SDK.
|
||||
@param sdkEphemeralPublicKey The SDK ephemeral public key.
|
||||
@param sdkAppIdentifier The SDK app identifier.
|
||||
@param sdkReferenceNumber The SDK reference number.
|
||||
@param messageVersion The protocol version that is supported by the SDK and used for the transaction.
|
||||
|
||||
@exception InvalidInputException Thrown if an input parameter is invalid. @see InvalidInputException
|
||||
*/
|
||||
- (instancetype)initWithSDKTransactionIdentifier:(NSString *)sdkTransactionIdentifier
|
||||
deviceData:(nullable NSString *)deviceData
|
||||
sdkEphemeralPublicKey:(NSString *)sdkEphemeralPublicKey
|
||||
sdkAppIdentifier:(NSString *)sdkAppIdentifier
|
||||
sdkReferenceNumber:(NSString *)sdkReferenceNumber
|
||||
messageVersion:(NSString *)messageVersion;
|
||||
|
||||
/**
|
||||
The encrypted device data as a JWE string.
|
||||
*/
|
||||
@property (nonatomic, readonly, nullable) NSString *deviceData;
|
||||
|
||||
/**
|
||||
The SDK Transaction Identifier.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *sdkTransactionIdentifier;
|
||||
|
||||
/**
|
||||
The SDK App Identifier.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *sdkAppIdentifier;
|
||||
|
||||
/**
|
||||
The SDK reference number.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *sdkReferenceNumber;
|
||||
|
||||
/**
|
||||
The SDK ephemeral public key.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *sdkEphemeralPublicKey;
|
||||
|
||||
/**
|
||||
The protocol version that is used for the transaction.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *messageVersion;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,115 @@
|
|||
//
|
||||
// STDSAuthenticationResponse.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Cameron Sabol on 2/13/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "STDSJSONDecodable.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
The `STDSACSStatusType` enum defines the status of a transaction, as detailed in
|
||||
3DS2 Spec Seq 3.33:
|
||||
*/
|
||||
typedef NS_ENUM(NSInteger, STDSACSStatusType) {
|
||||
/// The status is unknown or invalid
|
||||
STDSACSStatusTypeUnknown = 0,
|
||||
|
||||
/// Authenticated
|
||||
STDSACSStatusTypeAuthenticated = 1,
|
||||
|
||||
/// Requires a Cardholder challenge to complete authentication
|
||||
STDSACSStatusTypeChallengeRequired = 2,
|
||||
|
||||
/// Requires a Cardholder challenge using Decoupled Authentication
|
||||
STDSACSStatusTypeDecoupledAuthentication = 3,
|
||||
|
||||
/// Not authenticated
|
||||
STDSACSStatusTypeNotAuthenticated = 4,
|
||||
|
||||
/// Not authenticated, but a proof of authentication attempt (Authentication Value)
|
||||
/// was generated
|
||||
STDSACSStatusTypeProofGenerated = 5,
|
||||
|
||||
/// Not authenticated, as authentication could not be performed due to technical or
|
||||
/// other issue
|
||||
STDSACSStatusTypeError = 6,
|
||||
|
||||
/// Not authenticated because the Issuer is rejecting authentication and requesting
|
||||
/// that authorisation not be attempted
|
||||
STDSACSStatusTypeRejected = 7,
|
||||
|
||||
/// Authentication not requested by the 3DS Server for data sent for informational
|
||||
/// purposes only
|
||||
STDSACSStatusTypeInformationalOnly = 8,
|
||||
};
|
||||
|
||||
/**
|
||||
A native protocol representing the response sent by the 3DS Server.
|
||||
Only parameters relevant to performing 3DS2 authentication in the mobile SDK are exposed.
|
||||
*/
|
||||
@protocol STDSAuthenticationResponse <NSObject>
|
||||
|
||||
/// Universally unique transaction identifier assigned by the 3DS Server to identify a single transaction.
|
||||
@property (nonatomic, readonly) NSString *threeDSServerTransactionID;
|
||||
|
||||
/// Transaction status
|
||||
@property (nonatomic, readonly) STDSACSStatusType status;
|
||||
|
||||
/// Indication of whether a challenge is required.
|
||||
@property (nonatomic, readonly, getter=isChallengeRequired) BOOL challengeRequired;
|
||||
|
||||
/// Indicates whether the ACS confirms utilisation of Decoupled Authentication and agrees to utilise Decoupled Authentication to authenticate the Cardholder.
|
||||
@property (nonatomic, readonly) BOOL willUseDecoupledAuthentication;
|
||||
|
||||
/**
|
||||
DS assigned ACS identifier.
|
||||
Each DS can provide a unique ID to each ACS on an individual basis.
|
||||
*/
|
||||
@property (nonatomic, readonly, nullable) NSString *acsOperatorID;
|
||||
|
||||
/// Unique identifier assigned by the EMVCo Secretariat upon Testing and Approval.
|
||||
@property (nonatomic, readonly, nullable) NSString *acsReferenceNumber;
|
||||
|
||||
/// Contains the JWS object (represented as a string) created by the ACS for the ARes message.
|
||||
@property (nonatomic, readonly, nullable) NSString *acsSignedContent;
|
||||
|
||||
/// Universally Unique transaction identifier assigned by the ACS to identify a single transaction.
|
||||
@property (nonatomic, readonly) NSString *acsTransactionID;
|
||||
|
||||
/// Fully qualified URL of the ACS to be used for the challenge.
|
||||
@property (nonatomic, readonly, nullable) NSURL *acsURL;
|
||||
|
||||
/**
|
||||
Text provided by the ACS/Issuer to Cardholder during a Frictionless or Decoupled transaction. The Issuer can provide information to Cardholder.
|
||||
For example, “Additional authentication is needed for this transaction, please contact (Issuer Name) at xxx-xxx-xxxx.”
|
||||
*/
|
||||
@property (nonatomic, readonly, nullable) NSString *cardholderInfo;
|
||||
|
||||
/// EMVCo-assigned unique identifier to track approved DS.
|
||||
@property (nonatomic, readonly, nullable) NSString *directoryServerReferenceNumber;
|
||||
|
||||
/// Universally unique transaction identifier assigned by the DS to identify a single transaction.
|
||||
@property (nonatomic, readonly, nullable) NSString *directoryServerTransactionID;
|
||||
|
||||
/**
|
||||
Protocol version identifier This shall be the Protocol Version Number of the specification utilised by the system creating this message.
|
||||
The Message Version Number is set by the 3DS Server which originates the protocol with the AReq message.
|
||||
The Message Version Number does not change during a 3DS transaction.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *protocolVersion;
|
||||
|
||||
/// Universally unique transaction identifier assigned by the 3DS SDK to identify a single transaction.
|
||||
@property (nonatomic, readonly) NSString *sdkTransactionID;
|
||||
|
||||
@end
|
||||
|
||||
/// A utility to parse an STDSAuthenticationResponse from JSON
|
||||
id<STDSAuthenticationResponse> _Nullable STDSAuthenticationResponseFromJSON(NSDictionary *json);
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,83 @@
|
|||
//
|
||||
// STDSButtonCustomization.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Andrew Harrison on 3/14/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "STDSCustomization.h"
|
||||
|
||||
/// An enum that defines the different types of buttons that are able to be customized.
|
||||
typedef NS_ENUM(NSInteger, STDSUICustomizationButtonType) {
|
||||
|
||||
/// The submit button type.
|
||||
STDSUICustomizationButtonTypeSubmit = 0,
|
||||
|
||||
/// The continue button type.
|
||||
STDSUICustomizationButtonTypeContinue = 1,
|
||||
|
||||
/// The next button type.
|
||||
STDSUICustomizationButtonTypeNext = 2,
|
||||
|
||||
/// The cancel button type.
|
||||
STDSUICustomizationButtonTypeCancel = 3,
|
||||
|
||||
/// The resend button type.
|
||||
STDSUICustomizationButtonTypeResend = 4,
|
||||
};
|
||||
|
||||
/// An enumeration of the case transformations that can be applied to the button's title
|
||||
typedef NS_ENUM(NSInteger, STDSButtonTitleStyle) {
|
||||
/// Default style, doesn't modify the title
|
||||
STDSButtonTitleStyleDefault,
|
||||
|
||||
/// Applies localizedUppercaseString to the title
|
||||
STDSButtonTitleStyleUppercase,
|
||||
|
||||
/// Applies localizedLowercaseString to the title
|
||||
STDSButtonTitleStyleLowercase,
|
||||
|
||||
/// Applies localizedCapitalizedString to the title
|
||||
STDSButtonTitleStyleSentenceCapitalized,
|
||||
};
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// A customization object to use to configure the UI of a button.
|
||||
@interface STDSButtonCustomization: STDSCustomization
|
||||
|
||||
/// The default settings for the provided button type.
|
||||
+ (instancetype)defaultSettingsForButtonType:(STDSUICustomizationButtonType)type;
|
||||
|
||||
/**
|
||||
Initializes an instance of STDSButtonCustomization with the given backgroundColor and colorRadius.
|
||||
*/
|
||||
- (instancetype)initWithBackgroundColor:(UIColor *)backgroundColor cornerRadius:(CGFloat)cornerRadius;
|
||||
|
||||
/**
|
||||
This is unavailable because there are no sensible default property values without a button type.
|
||||
Use `defaultSettingsForButtonType:` or `initWithBackgroundColor:cornerRadius:` instead.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
The background color of the button.
|
||||
The default for .resend and .cancel is clear.
|
||||
The default for .submit, .continue, and .next is blue.
|
||||
*/
|
||||
@property (nonatomic) UIColor *backgroundColor;
|
||||
|
||||
/// The corner radius of the button. Defaults to 8.
|
||||
@property (nonatomic) CGFloat cornerRadius;
|
||||
|
||||
/**
|
||||
The capitalization style of the button title
|
||||
*/
|
||||
@property (nonatomic) STDSButtonTitleStyle titleStyle;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,61 @@
|
|||
//
|
||||
// STDSChallengeParameters.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Cameron Sabol on 2/13/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@protocol STDSAuthenticationResponse;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
`STDSChallengeParameters` contains information from the 3DS Server's
|
||||
authentication response that are used by the 3DS2 SDK to initiate
|
||||
the challenge flow.
|
||||
*/
|
||||
@interface STDSChallengeParameters : NSObject
|
||||
|
||||
/**
|
||||
Convenience intiializer to create an instace of `STDSChallengeParameters` from an
|
||||
`STDSAuthenticationResponse`
|
||||
*/
|
||||
- (instancetype)initWithAuthenticationResponse:(id<STDSAuthenticationResponse>)authResponse;
|
||||
|
||||
/**
|
||||
Transaction identifier assigned by the 3DS Server to uniquely identify
|
||||
a transaction.
|
||||
*/
|
||||
@property (nonatomic, copy) NSString *threeDSServerTransactionID;
|
||||
|
||||
/**
|
||||
Transaction identifier assigned by the Access Control Server (ACS)
|
||||
to uniquely identify a transaction.
|
||||
*/
|
||||
@property (nonatomic, copy) NSString *acsTransactionID;
|
||||
|
||||
/**
|
||||
The reference number of the relevant Access Control Server.
|
||||
*/
|
||||
@property (nonatomic, copy) NSString *acsReferenceNumber;
|
||||
|
||||
/**
|
||||
The encrypted message sent by the Access Control Server
|
||||
containing the ACS URL, epthemeral public key, and the
|
||||
3DS2 SDK ephemeral public key.
|
||||
*/
|
||||
@property (nonatomic, copy) NSString *acsSignedContent;
|
||||
|
||||
/**
|
||||
The URL for the application that is requesting 3DS2 verification.
|
||||
This property can be optionally set and will be included with the
|
||||
messages sent to the Directory Server during the challenge flow.
|
||||
*/
|
||||
@property (nonatomic, copy, nullable) NSString *threeDSRequestorAppURL;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,61 @@
|
|||
//
|
||||
// STDSChallengeStatusReceiver.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 3/20/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
@class STDSTransaction, STDSCompletionEvent, STDSRuntimeErrorEvent, STDSProtocolErrorEvent;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
Implement the `STDSChallengeStatusReceiver` protocol to receive challenge status notifications at the end of the challenge process.
|
||||
@see `STDSTransaction.doChallenge`
|
||||
*/
|
||||
@protocol STDSChallengeStatusReceiver <NSObject>
|
||||
|
||||
/**
|
||||
Called when the challenge process is completed.
|
||||
|
||||
@param completionEvent Information about the completion of the challenge process. @see `STDSCompletionEvent`
|
||||
*/
|
||||
- (void)transaction:(STDSTransaction *)transaction didCompleteChallengeWithCompletionEvent:(STDSCompletionEvent *)completionEvent;
|
||||
|
||||
/**
|
||||
Called when the user selects the option to cancel the transaction on the challenge screen.
|
||||
*/
|
||||
- (void)transactionDidCancel:(STDSTransaction *)transaction;
|
||||
|
||||
/**
|
||||
Called when the challenge process reaches or exceeds the timeout interval that was passed to `STDSTransaction.doChallenge`
|
||||
*/
|
||||
- (void)transactionDidTimeOut:(STDSTransaction *)transaction;
|
||||
|
||||
/**
|
||||
Called when the 3DS SDK receives an EMV 3-D Secure protocol-defined error message from the ACS.
|
||||
|
||||
@param protocolErrorEvent The error code and details. @see `STDSProtocolErrorEvent`
|
||||
*/
|
||||
- (void)transaction:(STDSTransaction *)transaction didErrorWithProtocolErrorEvent:(STDSProtocolErrorEvent *)protocolErrorEvent;
|
||||
|
||||
/**
|
||||
Called when the 3DS SDK encounters errors during the challenge process. These errors include all errors except those covered by `didErrorWithProtocolErrorEvent`.
|
||||
|
||||
@param runtimeErrorEvent The error code and details. @see `STDSRuntimeErrorEvent`
|
||||
*/
|
||||
- (void)transaction:(STDSTransaction *)transaction didErrorWithRuntimeErrorEvent:(STDSRuntimeErrorEvent *)runtimeErrorEvent;
|
||||
|
||||
@optional
|
||||
|
||||
/**
|
||||
Optional method that will be called when the transaction displays a new challenge screen.
|
||||
*/
|
||||
- (void)transactionDidPresentChallengeScreen:(STDSTransaction *)transaction;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,40 @@
|
|||
//
|
||||
// STDSCompletionEvent.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 3/20/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
`STDSCompletionEvent` contains information about completion of the challenge process.
|
||||
*/
|
||||
@interface STDSCompletionEvent : NSObject
|
||||
|
||||
/**
|
||||
Designated initializer for `STDSCompletionEvent`.
|
||||
*/
|
||||
- (instancetype)initWithSDKTransactionIdentifier:(NSString *)identifier transactionStatus:(NSString *)transactionStatus NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
/**
|
||||
`STDSCompletionEvent` should not be directly initialized.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
The SDK Transaction ID.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *sdkTransactionIdentifier;
|
||||
|
||||
/**
|
||||
The transaction status that was received in the final challenge response.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *transactionStatus;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,96 @@
|
|||
//
|
||||
// STDSConfigParameters.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Cameron Sabol on 1/22/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
The default group name that will be used to group additional
|
||||
configuration parameters.
|
||||
*/
|
||||
extern NSString * const kSTDSConfigDefaultGroupName;
|
||||
|
||||
/**
|
||||
`STDSConfigParameters` represents additional configuration parameters
|
||||
that can be passed to the Stripe3DS2 SDK during initialization.
|
||||
|
||||
There are currently no supported additional parameters and apps can
|
||||
just pass `[STDSConfigParameters alloc] initWithStandardParameters`
|
||||
to the `STDSThreeDS2Service` instance.
|
||||
*/
|
||||
@interface STDSConfigParameters : NSObject
|
||||
|
||||
/**
|
||||
Convenience initializer to get an `STDSConfigParameters` instance
|
||||
with the default expected configuration parameters.
|
||||
*/
|
||||
- (instancetype)initWithStandardParameters;
|
||||
|
||||
/**
|
||||
Adds the parameter to this instance.
|
||||
|
||||
@param paramName The name of the parameter to add
|
||||
@param paramValue The value of the parameter to add
|
||||
@param paramGroup The group to which this parameter will be added. If `nil` the parameter will be added to `kSTDSConfigDefaultGroupName`
|
||||
|
||||
@exception STDSInvalidInputException Will throw an `STDSInvalidInputException` if `paramName` or `paramValue` are `nil`. @see STDSInvalidInputException
|
||||
*/
|
||||
- (void)addParameterNamed:(NSString *)paramName withValue:(NSString *)paramValue toGroup:(nullable NSString *)paramGroup;
|
||||
|
||||
/**
|
||||
Adds the parameter to the default group in this instance.
|
||||
|
||||
@param paramName The name of the parameter to add
|
||||
@param paramValue The value of the parameter to add
|
||||
|
||||
@exception STDSInvalidInputException Will throw an `STDSInvalidInputException` if `paramName` or `paramValue` are `nil`. @see STDSInvalidInputException
|
||||
*/
|
||||
- (void)addParameterNamed:(NSString *)paramName withValue:(NSString *)paramValue;
|
||||
|
||||
/**
|
||||
Returns the value for `paramName` in `paramGroup` or `nil` if the parameter value is not set.
|
||||
|
||||
@param paramName The name of the parameter to return
|
||||
@param paramGroup The group from which to fetch the parameter value. If `nil` will default to `kSTDSConfigDefaultGroupName`
|
||||
|
||||
@exception STDSInvalidInputException Will throw an `STDSInvalidInputException` if `paramName` is `nil`. @see STDSInvalidInputException
|
||||
*/
|
||||
- (nullable NSString *)parameterValue:(NSString *)paramName inGroup:(nullable NSString *)paramGroup;
|
||||
|
||||
/**
|
||||
Returns the value for `paramName` in the default group or `nil` if the parameter value is not set.
|
||||
|
||||
@param paramName The name of the parameter to return
|
||||
|
||||
@exception STDSInvalidInputException Will throw an `STDSInvalidInputException` if `paramName` is `nil`. @see STDSInvalidInputException
|
||||
*/
|
||||
- (nullable NSString *)parameterValue:(NSString *)paramName;
|
||||
|
||||
/**
|
||||
Removes the specified parameter from the group and returns the value or `nil` if the parameter was not found.
|
||||
|
||||
@param paramName The name of the parameter to remove
|
||||
@param paramGroup The group from which to remove this parameter. If `nil` will default to `kSTDSConfigDefaultGroupName`
|
||||
|
||||
@exception STDSInvalidInputException Will throw an `STDSInvalidInputException` if `paramName` is `nil`. @see STDSInvalidInputException
|
||||
*/
|
||||
- (nullable NSString *)removeParameterNamed:(NSString *)paramName fromGroup:(nullable NSString *)paramGroup;
|
||||
|
||||
/**
|
||||
Removes the specified parameter from the default group and returns the value or `nil` if the parameter was not found.
|
||||
|
||||
@param paramName The name of the parameter to remove
|
||||
|
||||
@exception STDSInvalidInputException Will throw an `STDSInvalidInputException` if `paramName` is `nil`. @see STDSInvalidInputException
|
||||
*/
|
||||
- (nullable NSString *)removeParameterNamed:(NSString *)paramName;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,25 @@
|
|||
//
|
||||
// STDSCustomization.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Andrew Harrison on 3/14/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// This class provides a common set of customization parameters, used to customize elements of the UI.
|
||||
@interface STDSCustomization : NSObject <NSCopying>
|
||||
|
||||
/// The font to use for text.
|
||||
@property (nonatomic, nullable) UIFont *font;
|
||||
|
||||
/// The color to use for the text.
|
||||
@property (nonatomic, nullable) UIColor *textColor;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,108 @@
|
|||
//
|
||||
// STDSErrorMessage.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 3/21/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "STDSJSONEncodable.h"
|
||||
#import "STDSJSONDecodable.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// Error codes as defined by the 3DS2 spec.
|
||||
typedef NS_ENUM(NSInteger, STDSErrorMessageCode) {
|
||||
/// The SDK received a message that is not an ARes, CRes, or ErrorMessage.
|
||||
STDSErrorMessageCodeInvalidMessage = 101,
|
||||
|
||||
/// A required data element is missing from the network response.
|
||||
STDSErrorMessageCodeRequiredDataElementMissing = 201,
|
||||
|
||||
// Critical message extension not recognised
|
||||
STDSErrorMessageCodeUnrecognizedCriticalMessageExtension = 202,
|
||||
|
||||
/// A data element is not in the required format or the value is invalid.
|
||||
STDSErrorMessageErrorInvalidDataElement = 203,
|
||||
|
||||
// Transaction ID not recognized
|
||||
STDSErrorMessageErrorTransactionIDNotRecognized = 301,
|
||||
|
||||
/// A network response could not be decrypted or verified.
|
||||
STDSErrorMessageErrorDataDecryptionFailure = 302,
|
||||
|
||||
/// The SDK timed out
|
||||
STDSErrorMessageErrorTimeout = 402,
|
||||
};
|
||||
|
||||
/**
|
||||
`STDSErrorMessage` represents an error message that is returned by the ACS or to be sent to the ACS.
|
||||
*/
|
||||
@interface STDSErrorMessage : NSObject <STDSJSONEncodable, STDSJSONDecodable>
|
||||
|
||||
/**
|
||||
Designated initializer for `STDSErrorMessage`.
|
||||
|
||||
@param errorCode The error code.
|
||||
@param errorComponent The component that identified the error.
|
||||
@param errorDescription Text describing the error.
|
||||
@param errorDetails Additional error details. Optional.
|
||||
*/
|
||||
- (instancetype)initWithErrorCode:(NSString *)errorCode
|
||||
errorComponent:(NSString *)errorComponent
|
||||
errorDescription:(NSString *)errorDescription
|
||||
errorDetails:(nullable NSString *)errorDetails
|
||||
messageVersion:(NSString *)messageVersion
|
||||
acsTransactionIdentifier:(nullable NSString *)acsTransactionIdentifier
|
||||
errorMessageType:(NSString *)errorMessageType;
|
||||
|
||||
/**
|
||||
`STDSErrorMessage` should not be directly initialized.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
The error code.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *errorCode;
|
||||
|
||||
/**
|
||||
The 3-D Secure component that identified the error.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *errorComponent;
|
||||
|
||||
/**
|
||||
Text describing the error.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *errorDescription;
|
||||
|
||||
/**
|
||||
Additional error details.
|
||||
*/
|
||||
@property (nonatomic, nullable, readonly) NSString *errorDetails;
|
||||
|
||||
/**
|
||||
The protocol version identifier.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *messageVersion;
|
||||
|
||||
/**
|
||||
The ACS transaction identifier.
|
||||
*/
|
||||
@property (nonatomic, readonly, nullable) NSString *acsTransactionIdentifier;
|
||||
|
||||
/**
|
||||
The message type that was identified as erroneous.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *errorMessageType;
|
||||
|
||||
/**
|
||||
A representation of the `STDSErrorMessage` as an `NSError`
|
||||
*/
|
||||
- (NSError *)NSErrorValue;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,25 @@
|
|||
//
|
||||
// STDSException.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Cameron Sabol on 1/22/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
An abstract class to represent 3DS2 SDK custom exceptions
|
||||
*/
|
||||
@interface STDSException : NSException
|
||||
|
||||
/**
|
||||
A description of the exception.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *message;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,41 @@
|
|||
//
|
||||
// STDSFooterCustomization.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 6/10/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "STDSCustomization.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
The Challenge view displays a footer with additional details that
|
||||
expand when tapped. This object configures the appearance of that view.
|
||||
*/
|
||||
@interface STDSFooterCustomization : STDSCustomization
|
||||
|
||||
/// The default settings.
|
||||
+ (instancetype)defaultSettings;
|
||||
|
||||
/**
|
||||
The background color of the footer.
|
||||
Defaults to gray.
|
||||
*/
|
||||
@property (nonatomic) UIColor *backgroundColor;
|
||||
|
||||
/// The color of the chevron. Defaults to a dark gray.
|
||||
@property (nonatomic) UIColor *chevronColor;
|
||||
|
||||
/// The color of the heading text. Defaults to black.
|
||||
@property (nonatomic) UIColor *headingTextColor;
|
||||
|
||||
/// The font to use for the heading text.
|
||||
@property (nonatomic) UIFont *headingFont;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,21 @@
|
|||
//
|
||||
// STDSInvalidInputException.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Cameron Sabol on 1/22/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import "STDSException.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
`STDSInvalidInputException` represents an exception that will be thrown by
|
||||
Stripe3DS2 SDK methods that are called with invalid input arguments.
|
||||
*/
|
||||
@interface STDSInvalidInputException : STDSException
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,33 @@
|
|||
//
|
||||
// STDSJSONDecodable.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 3/27/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol STDSJSONDecodable <NSObject>
|
||||
|
||||
/**
|
||||
Initializes an instance of the class from its JSON representation.
|
||||
|
||||
This method recognizes two categories of errors:
|
||||
- a required field is missing.
|
||||
- a required field value is in valid (e.g. expected 'Y' or 'N' but received 'X').
|
||||
|
||||
Errors populating optional fields are ignored.
|
||||
|
||||
@param json The JSON dictionary that represents an object of this type
|
||||
@param outError If there was a missing required field or invalid field value, contains an instance of NSError.
|
||||
|
||||
@return The object represented by the JSON dictionary. If the object could not be decoded, returns nil and populates the outError argument.
|
||||
*/
|
||||
+ (nullable instancetype)decodedObjectFromJSON:(nullable NSDictionary *)json error:(NSError **)outError;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,22 @@
|
|||
//
|
||||
// STDSJSONEncodable.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 3/25/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol STDSJSONEncodable <NSObject>
|
||||
|
||||
/**
|
||||
Returns a map of property names to their JSON representation's key value. For example, `STDSChallengeParameters` has a property called `acsTransactionID`, but the 3DS2 JSON spec expects a field called `acsTransID`. This dictionary represents a mapping from the former to the latter (in other words, [STDSChallengeParameters propertyNamesToJSONKeysMapping][@"acsTransactionID"] == @"acsTransID".)
|
||||
*/
|
||||
+ (NSDictionary *)propertyNamesToJSONKeysMapping;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,27 @@
|
|||
//
|
||||
// STDSJSONEncoder.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 3/25/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "STDSJSONEncodable.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
`STDSJSONEncoder` is a utility class to help with converting API objects into JSON
|
||||
*/
|
||||
@interface STDSJSONEncoder : NSObject
|
||||
|
||||
/**
|
||||
Method to convert an STDSJSONEncodable object into a JSON dictionary.
|
||||
*/
|
||||
+ (NSDictionary *)dictionaryForObject:(NSObject<STDSJSONEncodable> *)object;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,31 @@
|
|||
//
|
||||
// STDSLabelCustomization.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Andrew Harrison on 3/14/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import "STDSCustomization.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
A customization object to use to configure the UI of a text label.
|
||||
|
||||
The font and textColor inherited from `STDSCustomization` configure non-heading labels.
|
||||
*/
|
||||
@interface STDSLabelCustomization : STDSCustomization
|
||||
|
||||
/// The default settings.
|
||||
+ (instancetype)defaultSettings;
|
||||
|
||||
/// The color of the heading text. Defaults to black.
|
||||
@property (nonatomic) UIColor *headingTextColor;
|
||||
|
||||
/// The font to use for the heading text.
|
||||
@property (nonatomic) UIFont *headingFont;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,59 @@
|
|||
//
|
||||
// STDSNavigationBarCustomization.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Andrew Harrison on 3/14/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "STDSCustomization.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
A customization object to use to configure a UINavigationBar.
|
||||
|
||||
The font and textColor inherited from `STDSCustomization` configure the
|
||||
title of the navigation bar, and default to nil.
|
||||
*/
|
||||
@interface STDSNavigationBarCustomization : STDSCustomization
|
||||
|
||||
/// The default settings.
|
||||
+ (instancetype)defaultSettings;
|
||||
|
||||
/**
|
||||
The tint color of the navigation bar background.
|
||||
Defaults to nil.
|
||||
*/
|
||||
@property (nonatomic, nullable) UIColor *barTintColor;
|
||||
|
||||
/**
|
||||
The navigation bar style.
|
||||
Defaults to UIBarStyleDefault.
|
||||
*/
|
||||
@property (nonatomic) UIBarStyle barStyle;
|
||||
|
||||
/**
|
||||
A Boolean value indicating whether the navigation bar is translucent or not.
|
||||
Defaults to YES.
|
||||
*/
|
||||
@property (nonatomic) BOOL translucent;
|
||||
|
||||
/**
|
||||
The text to display in the title of the navigation bar.
|
||||
Defaults to "Secure checkout".
|
||||
*/
|
||||
@property (nonatomic, copy) NSString *headerText;
|
||||
|
||||
/**
|
||||
The text to display for the button in the navigation bar.
|
||||
Defaults to "Cancel".
|
||||
*/
|
||||
@property (nonatomic, copy) NSString *buttonText;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,23 @@
|
|||
//
|
||||
// STDSNotInitializedException.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Cameron Sabol on 2/13/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import "STDSException.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
`STDSNotInitializedException` represents an exception that will be thrown by
|
||||
the the Stripe3DS2 SDK if methods are called without initializing `STDSThreeDS2Service`.
|
||||
|
||||
@see STDSThreeDS2Service
|
||||
*/
|
||||
@interface STDSNotInitializedException : STDSException
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,42 @@
|
|||
//
|
||||
// STDSProtocolErrorEvent.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 3/20/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class STDSErrorMessage;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
`STDSProtocolErrorEvent` contains details about erorrs received from or sent to the ACS.
|
||||
*/
|
||||
@interface STDSProtocolErrorEvent : NSObject
|
||||
|
||||
/**
|
||||
Designated initializer for `STDSProtocolErrorEvent`.
|
||||
*/
|
||||
- (instancetype)initWithSDKTransactionIdentifier:(NSString *)identifier errorMessage:(STDSErrorMessage *)errorMessage;
|
||||
|
||||
/**
|
||||
`STDSProtocolErrorEvent` should not be directly initialized.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
Details about the error.
|
||||
*/
|
||||
@property (nonatomic, readonly) STDSErrorMessage *errorMessage;
|
||||
|
||||
/**
|
||||
The SDK Transaction Identifier.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *sdkTransactionIdentifier;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,53 @@
|
|||
//
|
||||
// STDSRuntimeErrorEvent.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 3/20/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
FOUNDATION_EXTERN NSString * const kSTDSRuntimeErrorCodeParsingError;
|
||||
FOUNDATION_EXTERN NSString * const kSTDSRuntimeErrorCodeEncryptionError;
|
||||
|
||||
/**
|
||||
`STDSRuntimeErrorEvent` contains details about run-time errors encountered during authentication.
|
||||
|
||||
The following are examples of run-time errors:
|
||||
- ACS is unreachable
|
||||
- Unparseable message
|
||||
- Network issues
|
||||
*/
|
||||
@interface STDSRuntimeErrorEvent : NSObject
|
||||
|
||||
/**
|
||||
A code corresponding to the type of error this represents.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *errorCode;
|
||||
|
||||
/**
|
||||
Details about the error.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *errorMessage;
|
||||
|
||||
/**
|
||||
Designated initializer for `STDSRuntimeErrorEvent`.
|
||||
*/
|
||||
- (instancetype)initWithErrorCode:(NSString *)errorCode errorMessage:(NSString *)errorMessage NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
/**
|
||||
A representation of the `STDSRuntimeErrorEvent` as an `NSError`
|
||||
*/
|
||||
- (NSError *)NSErrorValue;
|
||||
|
||||
/**
|
||||
`STDSRuntimeErrorEvent` should not be directly initialized.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,21 @@
|
|||
//
|
||||
// STDSRuntimeException.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Cameron Sabol on 1/22/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import "STDSException.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
`STDSRuntimeException` represents an exception that will be thrown by the
|
||||
Stripe3DS2 SDK if it encounters an internal error.
|
||||
*/
|
||||
@interface STDSRuntimeException : STDSException
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,48 @@
|
|||
//
|
||||
// STDSSelectionCustomization.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 6/11/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
A customization object that configures the appearance of
|
||||
radio buttons and checkboxes.
|
||||
*/
|
||||
@interface STDSSelectionCustomization: NSObject <NSCopying>
|
||||
|
||||
/// The default settings.
|
||||
+ (instancetype)defaultSettings;
|
||||
|
||||
/**
|
||||
The primary color of the selected state.
|
||||
Defaults to blue.
|
||||
*/
|
||||
@property (nonatomic) UIColor *primarySelectedColor;
|
||||
|
||||
/**
|
||||
The secondary color of the selected state (e.g. the checkmark color).
|
||||
Defaults to white.
|
||||
*/
|
||||
@property (nonatomic) UIColor *secondarySelectedColor;
|
||||
|
||||
/**
|
||||
The background color displayed in the unselected state.
|
||||
Defaults to light blue.
|
||||
*/
|
||||
@property (nonatomic) UIColor *unselectedBackgroundColor;
|
||||
|
||||
/**
|
||||
The color of the border drawn around the view in the unselected state.
|
||||
Defaults to blue.
|
||||
*/
|
||||
@property (nonatomic) UIColor *unselectedBorderColor;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,68 @@
|
|||
//
|
||||
// STDSStripe3DS2Error.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 3/27/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
FOUNDATION_EXPORT NSString * const STDSStripe3DS2ErrorDomain;
|
||||
|
||||
/**
|
||||
NSError.userInfo contains this key if we received an ErrorMessage instead of the expected response object.
|
||||
The value of this key is the ErrorMessage.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString * const STDSStripe3DS2ErrorMessageErrorKey;
|
||||
|
||||
/**
|
||||
NSError.userInfo contains this key if we errored parsing JSON.
|
||||
The value of this key is the invalid or missing field.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString * const STDSStripe3DS2ErrorFieldKey;
|
||||
|
||||
/**
|
||||
NSError.userInfo contains this key if we couldn't recognize critical message extension(s)
|
||||
The value of this key is an array of identifiers.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString * const STDSStripe3DS2UnrecognizedCriticalMessageExtensionsKey;
|
||||
|
||||
|
||||
typedef NS_ENUM(NSInteger, STDSErrorCode) {
|
||||
|
||||
/// Code triggered an assertion
|
||||
STDSErrorCodeAssertionFailed = 204,
|
||||
|
||||
// JSON Parsing
|
||||
/// Received invalid or malformed data
|
||||
STDSErrorCodeJSONFieldInvalid = 203,
|
||||
/// Expected field missing
|
||||
STDSErrorCodeJSONFieldMissing = 201,
|
||||
|
||||
/// Critical message extension not recognised
|
||||
STDSErrorCodeUnrecognizedCriticalMessageExtension = 202,
|
||||
|
||||
/// Decryption or verification error
|
||||
STDSErrorCodeDecryptionVerification = 302,
|
||||
|
||||
/// Error code corresponding to a `STDSRuntimeErrorEvent` for an unparseable network response
|
||||
STDSErrorCodeRuntimeParsing = 400,
|
||||
/// Error code corresponding to a `STDSRuntimeErrorEvent` for an error with decrypting or verifying a network response
|
||||
STDSErrorCodeRuntimeEncryption = 401,
|
||||
|
||||
// Networking
|
||||
/// We received an ErrorMessage instead of the expected response object. `userInfo[STDSStripe3DS2ErrorMessageErrorKey]` will contain the ErrorMessage object.
|
||||
STDSErrorCodeReceivedErrorMessage = 1000,
|
||||
/// We received an unknown message type.
|
||||
STDSErrorCodeUnknownMessageType = 1001,
|
||||
/// Request timed out
|
||||
STDSErrorCodeTimeout = 1002,
|
||||
|
||||
/// Unknown
|
||||
STDSErrorCodeUnknownError = 2000,
|
||||
};
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,50 @@
|
|||
//
|
||||
// STDSSwiftTryCatch.h
|
||||
//
|
||||
// Created by William Falcon on 10/10/14.
|
||||
// Copyright (c) 2014 William Falcon. All rights reserved.
|
||||
//
|
||||
/*
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, 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.
|
||||
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.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
Provides try catch functionality for swift by wrapping around Objective-C
|
||||
*/
|
||||
@interface STDSSwiftTryCatch : NSObject
|
||||
|
||||
/**
|
||||
Provides try catch functionality for swift by wrapping around Objective-C
|
||||
*/
|
||||
+ (void)tryBlock:(void(^)(void))tryBlock catchBlock:(void(^)(NSException*exception))catchBlock finallyBlock:(void(^)(void))finallyBlock;
|
||||
/**
|
||||
Throws Objective-C exception with name and reason set to `s`
|
||||
*/
|
||||
+ (void)throwString:(NSString*)s;
|
||||
|
||||
/**
|
||||
Throws exception `e`
|
||||
*/
|
||||
+ (void)throwException:(NSException*)e;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,47 @@
|
|||
//
|
||||
// STDSTextFieldCustomization.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Andrew Harrison on 3/14/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "STDSCustomization.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
A customization object to use to configure the UI of a text field.
|
||||
|
||||
The font and textColor inherited from `STDSCustomization` configure
|
||||
the user input text.
|
||||
*/
|
||||
@interface STDSTextFieldCustomization : STDSCustomization
|
||||
|
||||
/**
|
||||
The default settings.
|
||||
|
||||
The default textColor is black.
|
||||
*/
|
||||
+ (instancetype)defaultSettings;
|
||||
|
||||
/// The border width of the text field. Defaults to 2.
|
||||
@property (nonatomic) CGFloat borderWidth;
|
||||
|
||||
/// The color of the border of the text field. Defaults to clear.
|
||||
@property (nonatomic) UIColor *borderColor;
|
||||
|
||||
/// The corner radius of the edges of the text field. Defaults to 8.
|
||||
@property (nonatomic) CGFloat cornerRadius;
|
||||
|
||||
/// The appearance of the keyboard. Defaults to UIKeyboardAppearanceDefault.
|
||||
@property (nonatomic) UIKeyboardAppearance keyboardAppearance;
|
||||
|
||||
/// The color of the placeholder text. Defaults to light gray.
|
||||
@property (nonatomic) UIColor *placeholderTextColor;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,84 @@
|
|||
//
|
||||
// STDSThreeDS2Service.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Cameron Sabol on 1/22/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class STDSConfigParameters;
|
||||
@class STDSTransaction;
|
||||
@class STDSUICustomization;
|
||||
@class STDSWarning;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
`STDSThreeDS2Service` is the main 3DS SDK interface and provides methods to process transactions.
|
||||
*/
|
||||
@interface STDSThreeDS2Service : NSObject
|
||||
|
||||
/**
|
||||
A list of warnings that may be populated once the SDK has been initialized.
|
||||
*/
|
||||
@property (nonatomic, readonly, nullable) NSArray<STDSWarning *> *warnings;
|
||||
|
||||
/**
|
||||
Initializes the 3DS SDK instance.
|
||||
|
||||
This method should be called at the start of the payment stage of a transaction.
|
||||
**Note: Until the `STDSThreeDS2Service instance is initialized, it will be unusable.**
|
||||
|
||||
- Performs security checks
|
||||
- Collects device information
|
||||
|
||||
@param config Configuration information that will be used during initialization. @see STDSConfigParameters
|
||||
@param locale Optional override for the locale to use in UI. If `nil`, will default to the current system locale.
|
||||
@param uiSettings Optional custom UI settings. If `nil`, will default to `[STDSUICustomization defaultSettings]`.
|
||||
This argument is copied; any further changes to the customization object have no effect. @see STDSUICustomization
|
||||
|
||||
@exception STDSInvalidInputException Will throw an `STDSInvalidInputException` if `config` is `nil` or any of `config`, `locale`, or `uiSettings` are invalid. @see STDSInvalidInputException
|
||||
@exception STDSAlreadyInitializedException Will throw an `STDSAlreadyInitializedException` if the 3DS SDK instance has already been initialized. @see STDSSDKAlreadyInitializedException
|
||||
@exception STDSRuntimeException Will throw an `STDSRuntimeException` if there is an internal error in the SDK. @see STDSRuntimeException
|
||||
*/
|
||||
- (void)initializeWithConfig:(STDSConfigParameters *)config
|
||||
locale:(nullable NSLocale *)locale
|
||||
uiSettings:(nullable STDSUICustomization *)uiSettings;
|
||||
|
||||
/**
|
||||
Creates and returns an instance of `STDSTransaction`.
|
||||
|
||||
@param directoryServerID The Directory Server identifier returned in the authentication response
|
||||
@param protocolVersion 3DS protocol version according to which the transaction will be created. Uses the default value of 2.1.0 if nil
|
||||
|
||||
@exception STDSNotInitializedException Will throw an `STDSNotInitializedException` if the the `STDSThreeDS2Service` instance hasn't been initialized with a call to `initializeWithConfig:locale:uiSettings:`. @see STDSNotInitializedException
|
||||
@exception STDSInvalidInputException Will throw an `STDSInvalidInputException` if `directoryServerID` is not recognized or if the `protocolVersion` is not supported by this version of the SDK. @see STDSInvalidInputException
|
||||
@exception STDSRuntimeException Will throw an `STDSRuntimeException` if there is an internal error in the SDK. @see STDSRuntimeException
|
||||
*/
|
||||
- (STDSTransaction *)createTransactionForDirectoryServer:(NSString *)directoryServerID
|
||||
withProtocolVersion:(nullable NSString *)protocolVersion;
|
||||
|
||||
/**
|
||||
Creates and returns an instance of `STDSTransaction` using a custom directory server certificate.
|
||||
Will return nil if unable to create a certificate from the provided params.
|
||||
|
||||
@param directoryServerID The Directory Server identifier returned in the authentication response
|
||||
@param serverKeyID An additional authentication key used by some Directory Servers
|
||||
@param certificateString A Base64-encoded PEM or DER formatted certificate string containing the directory server's public key
|
||||
@param rootCertificateStrings An arry of base64-encoded PEM or DER formatted certificate strings containing the DS root certificate used for signature checks
|
||||
@param protocolVersion 3DS protocol version according to which the transaction will be created. Uses the default value of 2.1.0 if nil
|
||||
|
||||
@exception STDSNotInitializedException Will throw an `STDSNotInitializedException` if the the `STDSThreeDS2Service` instance hasn't been initialized with a call to `initializeWithConfig:locale:uiSettings:`. @see STDSNotInitializedException
|
||||
@exception STDSInvalidInputException Will throw an `STDSInvalidInputException` if the `protocolVersion` is not supported by this version of the SDK. @see STDSInvalidInputException
|
||||
*/
|
||||
- (nullable STDSTransaction *)createTransactionForDirectoryServer:(NSString *)directoryServerID
|
||||
serverKeyID:(nullable NSString *)serverKeyID
|
||||
certificateString:(NSString *)certificateString
|
||||
rootCertificateStrings:(NSArray<NSString *> *)rootCertificateStrings
|
||||
withProtocolVersion:(nullable NSString *)protocolVersion;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,15 @@
|
|||
//
|
||||
// STDSThreeDSProtocolVersion.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Cameron Sabol on 6/27/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
FOUNDATION_EXPORT NSString * const Stripe3DS2ProtocolVersion;
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,79 @@
|
|||
//
|
||||
// STDSTransaction.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 3/21/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
typedef void (^STDSTransactionVoidBlock)(void);
|
||||
|
||||
@class STDSAuthenticationRequestParameters, STDSChallengeParameters;
|
||||
@protocol STDSChallengeStatusReceiver;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
`STDSTransaction` holds parameters that the 3DS Server requires to create AReq messages and to perform the Challenge Flow.
|
||||
*/
|
||||
@interface STDSTransaction : NSObject
|
||||
|
||||
/**
|
||||
The UI type of the presented challenge for this transaction if applicable. Will be one of
|
||||
"none"
|
||||
"text"
|
||||
"single_select"
|
||||
"multi_select"
|
||||
"oob"
|
||||
"html"
|
||||
*/
|
||||
@property (nonatomic, readonly, copy) NSString *presentedChallengeUIType;
|
||||
|
||||
/**
|
||||
Encrypts device information collected during initialization and returns it along with SDK details.
|
||||
|
||||
@return Encrypted device information and details about this SDK. @see STDSAuthenticationRequestParameters
|
||||
|
||||
@exception SDKRuntimeException Thrown if an internal error is encountered.
|
||||
*/
|
||||
- (STDSAuthenticationRequestParameters *)createAuthenticationRequestParameters;
|
||||
|
||||
/**
|
||||
Returns a UIViewController instance displaying the Directory Server logo and a spinner. Present this during the Authentication Request/Response.
|
||||
*/
|
||||
- (UIViewController *)createProgressViewControllerWithDidCancel:(STDSTransactionVoidBlock)didCancel;
|
||||
|
||||
/**
|
||||
Initiates the challenge process, displaying challenge UI as needed.
|
||||
|
||||
@param presentingViewController The UIViewController used to present the challenge response UIViewController
|
||||
@param challengeParameters Details required to conduct the challenge process. @see STDSChallengeParameters
|
||||
@param challengeStatusReceiver A callback object to receive the status of the challenge. See @STDSChallengeStatusReceiver
|
||||
@param timeout An interval in seconds within which the challenge process will finish. Must be at least 5 minutes.
|
||||
|
||||
@exception STDSInvalidInputException Thrown if an argument is invalid (e.g. timeout less than 5 minutes). @see STDSInvalidInputException
|
||||
@exception STDSSDKRuntimeException Thrown if an internal error is encountered, and if you call this method after calling `close`. @see SDKRuntimeException
|
||||
*/
|
||||
- (void)doChallengeWithViewController:(UIViewController *)presentingViewController
|
||||
challengeParameters:(STDSChallengeParameters *)challengeParameters
|
||||
challengeStatusReceiver:(id<STDSChallengeStatusReceiver>)challengeStatusReceiver
|
||||
timeout:(NSTimeInterval)timeout;
|
||||
|
||||
/**
|
||||
Returns the version of the Stripe3DS2 SDK, e.g. @"1.0"
|
||||
*/
|
||||
- (NSString *)sdkVersion;
|
||||
|
||||
/**
|
||||
Cleans up resources held by `STDSTransaction`. Call this when the transaction is completed, if `doChallengeWithChallengeParameters:challengeStatusReceiver:timeout` is not called.
|
||||
|
||||
@note Don't use this object after calling this method. Calling `doChallengeWithViewController:challengeParameters:challengeStatusReceiver:timeout` after calling this method will throw an `STDSSDKRuntimeException`
|
||||
*/
|
||||
- (void)close;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,109 @@
|
|||
//
|
||||
// STDSUICustomization.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Andrew Harrison on 3/14/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "STDSCustomization.h"
|
||||
#import "STDSButtonCustomization.h"
|
||||
#import "STDSNavigationBarCustomization.h"
|
||||
#import "STDSLabelCustomization.h"
|
||||
#import "STDSTextFieldCustomization.h"
|
||||
#import "STDSFooterCustomization.h"
|
||||
#import "STDSSelectionCustomization.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
The `STDSUICustomization` provides configuration for UI elements.
|
||||
|
||||
It's important to configure this object appropriately before using it to initialize a
|
||||
`STDSThreeDS2Service` object. `STDSThreeDS2Service` makes a copy of the customization
|
||||
settings you provide; it ignores any subsequent changes you make to your `STDSUICustomization` instance.
|
||||
*/
|
||||
@interface STDSUICustomization: NSObject <NSCopying>
|
||||
|
||||
/// The default settings. See individual properties for their default values.
|
||||
+ (instancetype)defaultSettings;
|
||||
|
||||
/**
|
||||
Provides custom settings for the UINavigationBar of all UIViewControllers the SDK display.
|
||||
The default is `[STDSNavigationBarCustomization defaultSettings]`.
|
||||
*/
|
||||
@property (nonatomic) STDSNavigationBarCustomization *navigationBarCustomization;
|
||||
|
||||
/**
|
||||
Provides custom settings for labels.
|
||||
The default is `[STDSLabelCustomization defaultSettings]`.
|
||||
*/
|
||||
@property (nonatomic) STDSLabelCustomization *labelCustomization;
|
||||
|
||||
/**
|
||||
Provides custom settings for text fields.
|
||||
The default is `[STDSTextFieldCustomization defaultSettings]`.
|
||||
*/
|
||||
@property (nonatomic) STDSTextFieldCustomization *textFieldCustomization;
|
||||
|
||||
/**
|
||||
The primary background color of all UIViewControllers the SDK display.
|
||||
Defaults to white.
|
||||
*/
|
||||
@property (nonatomic) UIColor *backgroundColor;
|
||||
|
||||
/**
|
||||
The Challenge view displays a footer with additional details. This controls the background color of that view.
|
||||
Defaults to gray.
|
||||
*/
|
||||
@property (nonatomic) STDSFooterCustomization *footerCustomization;
|
||||
|
||||
/**
|
||||
Sets a given button customization for the specified type.
|
||||
|
||||
@param buttonCustomization The buttom customization to use.
|
||||
@param buttonType The type of button to use the customization for.
|
||||
*/
|
||||
- (void)setButtonCustomization:(STDSButtonCustomization *)buttonCustomization forType:(STDSUICustomizationButtonType)buttonType;
|
||||
|
||||
/**
|
||||
Retrieves a button customization object for the given button type.
|
||||
|
||||
@param buttonType The button type to retrieve a customization object for.
|
||||
@return A button customization object, or the default if none was set.
|
||||
@see STDSButtonCustomization
|
||||
*/
|
||||
- (STDSButtonCustomization *)buttonCustomizationForButtonType:(STDSUICustomizationButtonType)buttonType;
|
||||
|
||||
/**
|
||||
Provides custom settings for radio buttons and checkboxes.
|
||||
The default is `[STDSSelectionCustomization defaultSettings]`.
|
||||
*/
|
||||
@property (nonatomic) STDSSelectionCustomization *selectionCustomization;
|
||||
|
||||
|
||||
/**
|
||||
The preferred status bar style for all UIViewControllers the SDK display.
|
||||
Defaults to UIStatusBarStyleDefault.
|
||||
*/
|
||||
@property (nonatomic) UIStatusBarStyle preferredStatusBarStyle;
|
||||
|
||||
#pragma mark - Progress View
|
||||
|
||||
/**
|
||||
The style of UIActivityIndicatorViews displayed.
|
||||
This should contrast with `backgroundColor`. Defaults to regular on iOS 13+,
|
||||
gray on iOS 10-12.
|
||||
*/
|
||||
@property (nonatomic) UIActivityIndicatorViewStyle activityIndicatorViewStyle;
|
||||
|
||||
/**
|
||||
The style of the UIBlurEffect displayed underneath the UIActivityIndicatorView.
|
||||
Defaults to UIBlurEffectStyleDefault.
|
||||
*/
|
||||
@property (nonatomic) UIBlurEffectStyle blurStyle;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,69 @@
|
|||
//
|
||||
// STDSWarning.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Cameron Sabol on 2/12/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
The `STDSWarningSeverity` enum defines the severity levels of warnings generated
|
||||
during SDK initialization. @see STDSThreeDS2Service
|
||||
*/
|
||||
typedef NS_ENUM(NSInteger, STDSWarningSeverity) {
|
||||
/**
|
||||
Low severity
|
||||
*/
|
||||
STDSWarningSeverityLow = 0,
|
||||
|
||||
/**
|
||||
Medium severity
|
||||
*/
|
||||
STDSWarningSeverityMedium,
|
||||
|
||||
/**
|
||||
High severity
|
||||
*/
|
||||
STDSWarningSeverityHigh,
|
||||
};
|
||||
|
||||
/**
|
||||
The `STDSWarning` class represents warnings generated by `STDSThreeDS2Service` during
|
||||
security checks run during initialization. @see STDSThreeDS2Service
|
||||
*/
|
||||
@interface STDSWarning : NSObject
|
||||
|
||||
/**
|
||||
Designated initializer for `STDSWarning`.
|
||||
*/
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier
|
||||
message:(NSString *)message
|
||||
severity:(STDSWarningSeverity)severity NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
/**
|
||||
`STDSWarning` should not be directly initialized.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
The identifier for this warning instance.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *identifier;
|
||||
|
||||
/**
|
||||
The descriptive message for this warning.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *message;
|
||||
|
||||
/**
|
||||
The severity of this warning.
|
||||
*/
|
||||
@property (nonatomic, readonly) STDSWarningSeverity severity;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,14 @@
|
|||
//
|
||||
// Stripe3DS2-Prefix.pch
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Cameron Sabol on 4/16/20.
|
||||
// Copyright © 2020 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef Stripe3DS2_pch
|
||||
#define Stripe3DS2_pch
|
||||
|
||||
#import "STDSLocalizedString.h"
|
||||
|
||||
#endif /* Stripe3DS2_pch */
|
|
@ -0,0 +1,52 @@
|
|||
//
|
||||
// Stripe3DS2.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Cameron Sabol on 1/16/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
//! Project version number for Stripe3DS2.
|
||||
FOUNDATION_EXPORT double Stripe3DS2VersionNumber;
|
||||
|
||||
//! Project version string for Stripe3DS2.
|
||||
FOUNDATION_EXPORT const unsigned char Stripe3DS2VersionString[];
|
||||
|
||||
#import "STDSConfigParameters.h"
|
||||
#import "STDSThreeDS2Service.h"
|
||||
#import "STDSUICustomization.h"
|
||||
#import "STDSWarning.h"
|
||||
|
||||
#import "STDSAlreadyInitializedException.h"
|
||||
#import "STDSInvalidInputException.h"
|
||||
#import "STDSNotInitializedException.h"
|
||||
#import "STDSRuntimeException.h"
|
||||
|
||||
#import "STDSErrorMessage.h"
|
||||
#import "STDSProtocolErrorEvent.h"
|
||||
#import "STDSRuntimeErrorEvent.h"
|
||||
#import "STDSStripe3DS2Error.h"
|
||||
#import "STDSThreeDSProtocolVersion.h"
|
||||
|
||||
#import "STDSAuthenticationRequestParameters.h"
|
||||
#import "STDSAuthenticationResponse.h"
|
||||
#import "STDSChallengeParameters.h"
|
||||
#import "STDSChallengeStatusReceiver.h"
|
||||
#import "STDSCompletionEvent.h"
|
||||
#import "STDSJSONDecodable.h"
|
||||
#import "STDSJSONEncoder.h"
|
||||
#import "STDSTransaction.h"
|
||||
|
||||
#import "STDSButtonCustomization.h"
|
||||
#import "STDSCustomization.h"
|
||||
#import "STDSException.h"
|
||||
#import "STDSFooterCustomization.h"
|
||||
#import "STDSJSONEncodable.h"
|
||||
#import "STDSLabelCustomization.h"
|
||||
#import "STDSNavigationBarCustomization.h"
|
||||
#import "STDSSelectionCustomization.h"
|
||||
#import "STDSTextFieldCustomization.h"
|
||||
|
||||
#import "STDSSwiftTryCatch.h"
|
Binary file not shown.
|
@ -0,0 +1,6 @@
|
|||
framework module Stripe3DS2 {
|
||||
umbrella header "Stripe3DS2.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,22 @@
|
|||
//
|
||||
// STDSAlreadyInitializedException.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Cameron Sabol on 1/22/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import "STDSException.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
`STDSAlreadyInitializedException` represents an exception that will be thrown in the `STDSThreeDS2Service` instance has already been initialized.
|
||||
|
||||
@see STDSThreeDS2Service
|
||||
*/
|
||||
@interface STDSAlreadyInitializedException : STDSException
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,68 @@
|
|||
//
|
||||
// STDSAuthenticationRequestParameters.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 3/21/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "STDSJSONEncodable.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface STDSAuthenticationRequestParameters : NSObject <STDSJSONEncodable>
|
||||
|
||||
/**
|
||||
Designated initializer for `STDSAuthenticationRequestParameters`.
|
||||
|
||||
@param sdkTransactionIdentifier The SDK Transaction Identifier, as created by `[STDSTransaction createTransaction]`
|
||||
@param deviceData Optional device data collected by the SDK.
|
||||
@param sdkEphemeralPublicKey The SDK ephemeral public key.
|
||||
@param sdkAppIdentifier The SDK app identifier.
|
||||
@param sdkReferenceNumber The SDK reference number.
|
||||
@param messageVersion The protocol version that is supported by the SDK and used for the transaction.
|
||||
|
||||
@exception InvalidInputException Thrown if an input parameter is invalid. @see InvalidInputException
|
||||
*/
|
||||
- (instancetype)initWithSDKTransactionIdentifier:(NSString *)sdkTransactionIdentifier
|
||||
deviceData:(nullable NSString *)deviceData
|
||||
sdkEphemeralPublicKey:(NSString *)sdkEphemeralPublicKey
|
||||
sdkAppIdentifier:(NSString *)sdkAppIdentifier
|
||||
sdkReferenceNumber:(NSString *)sdkReferenceNumber
|
||||
messageVersion:(NSString *)messageVersion;
|
||||
|
||||
/**
|
||||
The encrypted device data as a JWE string.
|
||||
*/
|
||||
@property (nonatomic, readonly, nullable) NSString *deviceData;
|
||||
|
||||
/**
|
||||
The SDK Transaction Identifier.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *sdkTransactionIdentifier;
|
||||
|
||||
/**
|
||||
The SDK App Identifier.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *sdkAppIdentifier;
|
||||
|
||||
/**
|
||||
The SDK reference number.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *sdkReferenceNumber;
|
||||
|
||||
/**
|
||||
The SDK ephemeral public key.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *sdkEphemeralPublicKey;
|
||||
|
||||
/**
|
||||
The protocol version that is used for the transaction.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *messageVersion;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,115 @@
|
|||
//
|
||||
// STDSAuthenticationResponse.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Cameron Sabol on 2/13/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "STDSJSONDecodable.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
The `STDSACSStatusType` enum defines the status of a transaction, as detailed in
|
||||
3DS2 Spec Seq 3.33:
|
||||
*/
|
||||
typedef NS_ENUM(NSInteger, STDSACSStatusType) {
|
||||
/// The status is unknown or invalid
|
||||
STDSACSStatusTypeUnknown = 0,
|
||||
|
||||
/// Authenticated
|
||||
STDSACSStatusTypeAuthenticated = 1,
|
||||
|
||||
/// Requires a Cardholder challenge to complete authentication
|
||||
STDSACSStatusTypeChallengeRequired = 2,
|
||||
|
||||
/// Requires a Cardholder challenge using Decoupled Authentication
|
||||
STDSACSStatusTypeDecoupledAuthentication = 3,
|
||||
|
||||
/// Not authenticated
|
||||
STDSACSStatusTypeNotAuthenticated = 4,
|
||||
|
||||
/// Not authenticated, but a proof of authentication attempt (Authentication Value)
|
||||
/// was generated
|
||||
STDSACSStatusTypeProofGenerated = 5,
|
||||
|
||||
/// Not authenticated, as authentication could not be performed due to technical or
|
||||
/// other issue
|
||||
STDSACSStatusTypeError = 6,
|
||||
|
||||
/// Not authenticated because the Issuer is rejecting authentication and requesting
|
||||
/// that authorisation not be attempted
|
||||
STDSACSStatusTypeRejected = 7,
|
||||
|
||||
/// Authentication not requested by the 3DS Server for data sent for informational
|
||||
/// purposes only
|
||||
STDSACSStatusTypeInformationalOnly = 8,
|
||||
};
|
||||
|
||||
/**
|
||||
A native protocol representing the response sent by the 3DS Server.
|
||||
Only parameters relevant to performing 3DS2 authentication in the mobile SDK are exposed.
|
||||
*/
|
||||
@protocol STDSAuthenticationResponse <NSObject>
|
||||
|
||||
/// Universally unique transaction identifier assigned by the 3DS Server to identify a single transaction.
|
||||
@property (nonatomic, readonly) NSString *threeDSServerTransactionID;
|
||||
|
||||
/// Transaction status
|
||||
@property (nonatomic, readonly) STDSACSStatusType status;
|
||||
|
||||
/// Indication of whether a challenge is required.
|
||||
@property (nonatomic, readonly, getter=isChallengeRequired) BOOL challengeRequired;
|
||||
|
||||
/// Indicates whether the ACS confirms utilisation of Decoupled Authentication and agrees to utilise Decoupled Authentication to authenticate the Cardholder.
|
||||
@property (nonatomic, readonly) BOOL willUseDecoupledAuthentication;
|
||||
|
||||
/**
|
||||
DS assigned ACS identifier.
|
||||
Each DS can provide a unique ID to each ACS on an individual basis.
|
||||
*/
|
||||
@property (nonatomic, readonly, nullable) NSString *acsOperatorID;
|
||||
|
||||
/// Unique identifier assigned by the EMVCo Secretariat upon Testing and Approval.
|
||||
@property (nonatomic, readonly, nullable) NSString *acsReferenceNumber;
|
||||
|
||||
/// Contains the JWS object (represented as a string) created by the ACS for the ARes message.
|
||||
@property (nonatomic, readonly, nullable) NSString *acsSignedContent;
|
||||
|
||||
/// Universally Unique transaction identifier assigned by the ACS to identify a single transaction.
|
||||
@property (nonatomic, readonly) NSString *acsTransactionID;
|
||||
|
||||
/// Fully qualified URL of the ACS to be used for the challenge.
|
||||
@property (nonatomic, readonly, nullable) NSURL *acsURL;
|
||||
|
||||
/**
|
||||
Text provided by the ACS/Issuer to Cardholder during a Frictionless or Decoupled transaction. The Issuer can provide information to Cardholder.
|
||||
For example, “Additional authentication is needed for this transaction, please contact (Issuer Name) at xxx-xxx-xxxx.”
|
||||
*/
|
||||
@property (nonatomic, readonly, nullable) NSString *cardholderInfo;
|
||||
|
||||
/// EMVCo-assigned unique identifier to track approved DS.
|
||||
@property (nonatomic, readonly, nullable) NSString *directoryServerReferenceNumber;
|
||||
|
||||
/// Universally unique transaction identifier assigned by the DS to identify a single transaction.
|
||||
@property (nonatomic, readonly, nullable) NSString *directoryServerTransactionID;
|
||||
|
||||
/**
|
||||
Protocol version identifier This shall be the Protocol Version Number of the specification utilised by the system creating this message.
|
||||
The Message Version Number is set by the 3DS Server which originates the protocol with the AReq message.
|
||||
The Message Version Number does not change during a 3DS transaction.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *protocolVersion;
|
||||
|
||||
/// Universally unique transaction identifier assigned by the 3DS SDK to identify a single transaction.
|
||||
@property (nonatomic, readonly) NSString *sdkTransactionID;
|
||||
|
||||
@end
|
||||
|
||||
/// A utility to parse an STDSAuthenticationResponse from JSON
|
||||
id<STDSAuthenticationResponse> _Nullable STDSAuthenticationResponseFromJSON(NSDictionary *json);
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,83 @@
|
|||
//
|
||||
// STDSButtonCustomization.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Andrew Harrison on 3/14/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "STDSCustomization.h"
|
||||
|
||||
/// An enum that defines the different types of buttons that are able to be customized.
|
||||
typedef NS_ENUM(NSInteger, STDSUICustomizationButtonType) {
|
||||
|
||||
/// The submit button type.
|
||||
STDSUICustomizationButtonTypeSubmit = 0,
|
||||
|
||||
/// The continue button type.
|
||||
STDSUICustomizationButtonTypeContinue = 1,
|
||||
|
||||
/// The next button type.
|
||||
STDSUICustomizationButtonTypeNext = 2,
|
||||
|
||||
/// The cancel button type.
|
||||
STDSUICustomizationButtonTypeCancel = 3,
|
||||
|
||||
/// The resend button type.
|
||||
STDSUICustomizationButtonTypeResend = 4,
|
||||
};
|
||||
|
||||
/// An enumeration of the case transformations that can be applied to the button's title
|
||||
typedef NS_ENUM(NSInteger, STDSButtonTitleStyle) {
|
||||
/// Default style, doesn't modify the title
|
||||
STDSButtonTitleStyleDefault,
|
||||
|
||||
/// Applies localizedUppercaseString to the title
|
||||
STDSButtonTitleStyleUppercase,
|
||||
|
||||
/// Applies localizedLowercaseString to the title
|
||||
STDSButtonTitleStyleLowercase,
|
||||
|
||||
/// Applies localizedCapitalizedString to the title
|
||||
STDSButtonTitleStyleSentenceCapitalized,
|
||||
};
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// A customization object to use to configure the UI of a button.
|
||||
@interface STDSButtonCustomization: STDSCustomization
|
||||
|
||||
/// The default settings for the provided button type.
|
||||
+ (instancetype)defaultSettingsForButtonType:(STDSUICustomizationButtonType)type;
|
||||
|
||||
/**
|
||||
Initializes an instance of STDSButtonCustomization with the given backgroundColor and colorRadius.
|
||||
*/
|
||||
- (instancetype)initWithBackgroundColor:(UIColor *)backgroundColor cornerRadius:(CGFloat)cornerRadius;
|
||||
|
||||
/**
|
||||
This is unavailable because there are no sensible default property values without a button type.
|
||||
Use `defaultSettingsForButtonType:` or `initWithBackgroundColor:cornerRadius:` instead.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
The background color of the button.
|
||||
The default for .resend and .cancel is clear.
|
||||
The default for .submit, .continue, and .next is blue.
|
||||
*/
|
||||
@property (nonatomic) UIColor *backgroundColor;
|
||||
|
||||
/// The corner radius of the button. Defaults to 8.
|
||||
@property (nonatomic) CGFloat cornerRadius;
|
||||
|
||||
/**
|
||||
The capitalization style of the button title
|
||||
*/
|
||||
@property (nonatomic) STDSButtonTitleStyle titleStyle;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,61 @@
|
|||
//
|
||||
// STDSChallengeParameters.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Cameron Sabol on 2/13/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@protocol STDSAuthenticationResponse;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
`STDSChallengeParameters` contains information from the 3DS Server's
|
||||
authentication response that are used by the 3DS2 SDK to initiate
|
||||
the challenge flow.
|
||||
*/
|
||||
@interface STDSChallengeParameters : NSObject
|
||||
|
||||
/**
|
||||
Convenience intiializer to create an instace of `STDSChallengeParameters` from an
|
||||
`STDSAuthenticationResponse`
|
||||
*/
|
||||
- (instancetype)initWithAuthenticationResponse:(id<STDSAuthenticationResponse>)authResponse;
|
||||
|
||||
/**
|
||||
Transaction identifier assigned by the 3DS Server to uniquely identify
|
||||
a transaction.
|
||||
*/
|
||||
@property (nonatomic, copy) NSString *threeDSServerTransactionID;
|
||||
|
||||
/**
|
||||
Transaction identifier assigned by the Access Control Server (ACS)
|
||||
to uniquely identify a transaction.
|
||||
*/
|
||||
@property (nonatomic, copy) NSString *acsTransactionID;
|
||||
|
||||
/**
|
||||
The reference number of the relevant Access Control Server.
|
||||
*/
|
||||
@property (nonatomic, copy) NSString *acsReferenceNumber;
|
||||
|
||||
/**
|
||||
The encrypted message sent by the Access Control Server
|
||||
containing the ACS URL, epthemeral public key, and the
|
||||
3DS2 SDK ephemeral public key.
|
||||
*/
|
||||
@property (nonatomic, copy) NSString *acsSignedContent;
|
||||
|
||||
/**
|
||||
The URL for the application that is requesting 3DS2 verification.
|
||||
This property can be optionally set and will be included with the
|
||||
messages sent to the Directory Server during the challenge flow.
|
||||
*/
|
||||
@property (nonatomic, copy, nullable) NSString *threeDSRequestorAppURL;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,61 @@
|
|||
//
|
||||
// STDSChallengeStatusReceiver.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 3/20/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
@class STDSTransaction, STDSCompletionEvent, STDSRuntimeErrorEvent, STDSProtocolErrorEvent;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
Implement the `STDSChallengeStatusReceiver` protocol to receive challenge status notifications at the end of the challenge process.
|
||||
@see `STDSTransaction.doChallenge`
|
||||
*/
|
||||
@protocol STDSChallengeStatusReceiver <NSObject>
|
||||
|
||||
/**
|
||||
Called when the challenge process is completed.
|
||||
|
||||
@param completionEvent Information about the completion of the challenge process. @see `STDSCompletionEvent`
|
||||
*/
|
||||
- (void)transaction:(STDSTransaction *)transaction didCompleteChallengeWithCompletionEvent:(STDSCompletionEvent *)completionEvent;
|
||||
|
||||
/**
|
||||
Called when the user selects the option to cancel the transaction on the challenge screen.
|
||||
*/
|
||||
- (void)transactionDidCancel:(STDSTransaction *)transaction;
|
||||
|
||||
/**
|
||||
Called when the challenge process reaches or exceeds the timeout interval that was passed to `STDSTransaction.doChallenge`
|
||||
*/
|
||||
- (void)transactionDidTimeOut:(STDSTransaction *)transaction;
|
||||
|
||||
/**
|
||||
Called when the 3DS SDK receives an EMV 3-D Secure protocol-defined error message from the ACS.
|
||||
|
||||
@param protocolErrorEvent The error code and details. @see `STDSProtocolErrorEvent`
|
||||
*/
|
||||
- (void)transaction:(STDSTransaction *)transaction didErrorWithProtocolErrorEvent:(STDSProtocolErrorEvent *)protocolErrorEvent;
|
||||
|
||||
/**
|
||||
Called when the 3DS SDK encounters errors during the challenge process. These errors include all errors except those covered by `didErrorWithProtocolErrorEvent`.
|
||||
|
||||
@param runtimeErrorEvent The error code and details. @see `STDSRuntimeErrorEvent`
|
||||
*/
|
||||
- (void)transaction:(STDSTransaction *)transaction didErrorWithRuntimeErrorEvent:(STDSRuntimeErrorEvent *)runtimeErrorEvent;
|
||||
|
||||
@optional
|
||||
|
||||
/**
|
||||
Optional method that will be called when the transaction displays a new challenge screen.
|
||||
*/
|
||||
- (void)transactionDidPresentChallengeScreen:(STDSTransaction *)transaction;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,40 @@
|
|||
//
|
||||
// STDSCompletionEvent.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 3/20/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
`STDSCompletionEvent` contains information about completion of the challenge process.
|
||||
*/
|
||||
@interface STDSCompletionEvent : NSObject
|
||||
|
||||
/**
|
||||
Designated initializer for `STDSCompletionEvent`.
|
||||
*/
|
||||
- (instancetype)initWithSDKTransactionIdentifier:(NSString *)identifier transactionStatus:(NSString *)transactionStatus NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
/**
|
||||
`STDSCompletionEvent` should not be directly initialized.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
The SDK Transaction ID.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *sdkTransactionIdentifier;
|
||||
|
||||
/**
|
||||
The transaction status that was received in the final challenge response.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *transactionStatus;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,96 @@
|
|||
//
|
||||
// STDSConfigParameters.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Cameron Sabol on 1/22/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
The default group name that will be used to group additional
|
||||
configuration parameters.
|
||||
*/
|
||||
extern NSString * const kSTDSConfigDefaultGroupName;
|
||||
|
||||
/**
|
||||
`STDSConfigParameters` represents additional configuration parameters
|
||||
that can be passed to the Stripe3DS2 SDK during initialization.
|
||||
|
||||
There are currently no supported additional parameters and apps can
|
||||
just pass `[STDSConfigParameters alloc] initWithStandardParameters`
|
||||
to the `STDSThreeDS2Service` instance.
|
||||
*/
|
||||
@interface STDSConfigParameters : NSObject
|
||||
|
||||
/**
|
||||
Convenience initializer to get an `STDSConfigParameters` instance
|
||||
with the default expected configuration parameters.
|
||||
*/
|
||||
- (instancetype)initWithStandardParameters;
|
||||
|
||||
/**
|
||||
Adds the parameter to this instance.
|
||||
|
||||
@param paramName The name of the parameter to add
|
||||
@param paramValue The value of the parameter to add
|
||||
@param paramGroup The group to which this parameter will be added. If `nil` the parameter will be added to `kSTDSConfigDefaultGroupName`
|
||||
|
||||
@exception STDSInvalidInputException Will throw an `STDSInvalidInputException` if `paramName` or `paramValue` are `nil`. @see STDSInvalidInputException
|
||||
*/
|
||||
- (void)addParameterNamed:(NSString *)paramName withValue:(NSString *)paramValue toGroup:(nullable NSString *)paramGroup;
|
||||
|
||||
/**
|
||||
Adds the parameter to the default group in this instance.
|
||||
|
||||
@param paramName The name of the parameter to add
|
||||
@param paramValue The value of the parameter to add
|
||||
|
||||
@exception STDSInvalidInputException Will throw an `STDSInvalidInputException` if `paramName` or `paramValue` are `nil`. @see STDSInvalidInputException
|
||||
*/
|
||||
- (void)addParameterNamed:(NSString *)paramName withValue:(NSString *)paramValue;
|
||||
|
||||
/**
|
||||
Returns the value for `paramName` in `paramGroup` or `nil` if the parameter value is not set.
|
||||
|
||||
@param paramName The name of the parameter to return
|
||||
@param paramGroup The group from which to fetch the parameter value. If `nil` will default to `kSTDSConfigDefaultGroupName`
|
||||
|
||||
@exception STDSInvalidInputException Will throw an `STDSInvalidInputException` if `paramName` is `nil`. @see STDSInvalidInputException
|
||||
*/
|
||||
- (nullable NSString *)parameterValue:(NSString *)paramName inGroup:(nullable NSString *)paramGroup;
|
||||
|
||||
/**
|
||||
Returns the value for `paramName` in the default group or `nil` if the parameter value is not set.
|
||||
|
||||
@param paramName The name of the parameter to return
|
||||
|
||||
@exception STDSInvalidInputException Will throw an `STDSInvalidInputException` if `paramName` is `nil`. @see STDSInvalidInputException
|
||||
*/
|
||||
- (nullable NSString *)parameterValue:(NSString *)paramName;
|
||||
|
||||
/**
|
||||
Removes the specified parameter from the group and returns the value or `nil` if the parameter was not found.
|
||||
|
||||
@param paramName The name of the parameter to remove
|
||||
@param paramGroup The group from which to remove this parameter. If `nil` will default to `kSTDSConfigDefaultGroupName`
|
||||
|
||||
@exception STDSInvalidInputException Will throw an `STDSInvalidInputException` if `paramName` is `nil`. @see STDSInvalidInputException
|
||||
*/
|
||||
- (nullable NSString *)removeParameterNamed:(NSString *)paramName fromGroup:(nullable NSString *)paramGroup;
|
||||
|
||||
/**
|
||||
Removes the specified parameter from the default group and returns the value or `nil` if the parameter was not found.
|
||||
|
||||
@param paramName The name of the parameter to remove
|
||||
|
||||
@exception STDSInvalidInputException Will throw an `STDSInvalidInputException` if `paramName` is `nil`. @see STDSInvalidInputException
|
||||
*/
|
||||
- (nullable NSString *)removeParameterNamed:(NSString *)paramName;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,25 @@
|
|||
//
|
||||
// STDSCustomization.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Andrew Harrison on 3/14/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// This class provides a common set of customization parameters, used to customize elements of the UI.
|
||||
@interface STDSCustomization : NSObject <NSCopying>
|
||||
|
||||
/// The font to use for text.
|
||||
@property (nonatomic, nullable) UIFont *font;
|
||||
|
||||
/// The color to use for the text.
|
||||
@property (nonatomic, nullable) UIColor *textColor;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,108 @@
|
|||
//
|
||||
// STDSErrorMessage.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 3/21/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "STDSJSONEncodable.h"
|
||||
#import "STDSJSONDecodable.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// Error codes as defined by the 3DS2 spec.
|
||||
typedef NS_ENUM(NSInteger, STDSErrorMessageCode) {
|
||||
/// The SDK received a message that is not an ARes, CRes, or ErrorMessage.
|
||||
STDSErrorMessageCodeInvalidMessage = 101,
|
||||
|
||||
/// A required data element is missing from the network response.
|
||||
STDSErrorMessageCodeRequiredDataElementMissing = 201,
|
||||
|
||||
// Critical message extension not recognised
|
||||
STDSErrorMessageCodeUnrecognizedCriticalMessageExtension = 202,
|
||||
|
||||
/// A data element is not in the required format or the value is invalid.
|
||||
STDSErrorMessageErrorInvalidDataElement = 203,
|
||||
|
||||
// Transaction ID not recognized
|
||||
STDSErrorMessageErrorTransactionIDNotRecognized = 301,
|
||||
|
||||
/// A network response could not be decrypted or verified.
|
||||
STDSErrorMessageErrorDataDecryptionFailure = 302,
|
||||
|
||||
/// The SDK timed out
|
||||
STDSErrorMessageErrorTimeout = 402,
|
||||
};
|
||||
|
||||
/**
|
||||
`STDSErrorMessage` represents an error message that is returned by the ACS or to be sent to the ACS.
|
||||
*/
|
||||
@interface STDSErrorMessage : NSObject <STDSJSONEncodable, STDSJSONDecodable>
|
||||
|
||||
/**
|
||||
Designated initializer for `STDSErrorMessage`.
|
||||
|
||||
@param errorCode The error code.
|
||||
@param errorComponent The component that identified the error.
|
||||
@param errorDescription Text describing the error.
|
||||
@param errorDetails Additional error details. Optional.
|
||||
*/
|
||||
- (instancetype)initWithErrorCode:(NSString *)errorCode
|
||||
errorComponent:(NSString *)errorComponent
|
||||
errorDescription:(NSString *)errorDescription
|
||||
errorDetails:(nullable NSString *)errorDetails
|
||||
messageVersion:(NSString *)messageVersion
|
||||
acsTransactionIdentifier:(nullable NSString *)acsTransactionIdentifier
|
||||
errorMessageType:(NSString *)errorMessageType;
|
||||
|
||||
/**
|
||||
`STDSErrorMessage` should not be directly initialized.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
The error code.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *errorCode;
|
||||
|
||||
/**
|
||||
The 3-D Secure component that identified the error.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *errorComponent;
|
||||
|
||||
/**
|
||||
Text describing the error.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *errorDescription;
|
||||
|
||||
/**
|
||||
Additional error details.
|
||||
*/
|
||||
@property (nonatomic, nullable, readonly) NSString *errorDetails;
|
||||
|
||||
/**
|
||||
The protocol version identifier.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *messageVersion;
|
||||
|
||||
/**
|
||||
The ACS transaction identifier.
|
||||
*/
|
||||
@property (nonatomic, readonly, nullable) NSString *acsTransactionIdentifier;
|
||||
|
||||
/**
|
||||
The message type that was identified as erroneous.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *errorMessageType;
|
||||
|
||||
/**
|
||||
A representation of the `STDSErrorMessage` as an `NSError`
|
||||
*/
|
||||
- (NSError *)NSErrorValue;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,25 @@
|
|||
//
|
||||
// STDSException.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Cameron Sabol on 1/22/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
An abstract class to represent 3DS2 SDK custom exceptions
|
||||
*/
|
||||
@interface STDSException : NSException
|
||||
|
||||
/**
|
||||
A description of the exception.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *message;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,41 @@
|
|||
//
|
||||
// STDSFooterCustomization.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 6/10/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "STDSCustomization.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
The Challenge view displays a footer with additional details that
|
||||
expand when tapped. This object configures the appearance of that view.
|
||||
*/
|
||||
@interface STDSFooterCustomization : STDSCustomization
|
||||
|
||||
/// The default settings.
|
||||
+ (instancetype)defaultSettings;
|
||||
|
||||
/**
|
||||
The background color of the footer.
|
||||
Defaults to gray.
|
||||
*/
|
||||
@property (nonatomic) UIColor *backgroundColor;
|
||||
|
||||
/// The color of the chevron. Defaults to a dark gray.
|
||||
@property (nonatomic) UIColor *chevronColor;
|
||||
|
||||
/// The color of the heading text. Defaults to black.
|
||||
@property (nonatomic) UIColor *headingTextColor;
|
||||
|
||||
/// The font to use for the heading text.
|
||||
@property (nonatomic) UIFont *headingFont;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,21 @@
|
|||
//
|
||||
// STDSInvalidInputException.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Cameron Sabol on 1/22/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import "STDSException.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
`STDSInvalidInputException` represents an exception that will be thrown by
|
||||
Stripe3DS2 SDK methods that are called with invalid input arguments.
|
||||
*/
|
||||
@interface STDSInvalidInputException : STDSException
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,33 @@
|
|||
//
|
||||
// STDSJSONDecodable.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 3/27/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol STDSJSONDecodable <NSObject>
|
||||
|
||||
/**
|
||||
Initializes an instance of the class from its JSON representation.
|
||||
|
||||
This method recognizes two categories of errors:
|
||||
- a required field is missing.
|
||||
- a required field value is in valid (e.g. expected 'Y' or 'N' but received 'X').
|
||||
|
||||
Errors populating optional fields are ignored.
|
||||
|
||||
@param json The JSON dictionary that represents an object of this type
|
||||
@param outError If there was a missing required field or invalid field value, contains an instance of NSError.
|
||||
|
||||
@return The object represented by the JSON dictionary. If the object could not be decoded, returns nil and populates the outError argument.
|
||||
*/
|
||||
+ (nullable instancetype)decodedObjectFromJSON:(nullable NSDictionary *)json error:(NSError **)outError;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,22 @@
|
|||
//
|
||||
// STDSJSONEncodable.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 3/25/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol STDSJSONEncodable <NSObject>
|
||||
|
||||
/**
|
||||
Returns a map of property names to their JSON representation's key value. For example, `STDSChallengeParameters` has a property called `acsTransactionID`, but the 3DS2 JSON spec expects a field called `acsTransID`. This dictionary represents a mapping from the former to the latter (in other words, [STDSChallengeParameters propertyNamesToJSONKeysMapping][@"acsTransactionID"] == @"acsTransID".)
|
||||
*/
|
||||
+ (NSDictionary *)propertyNamesToJSONKeysMapping;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,27 @@
|
|||
//
|
||||
// STDSJSONEncoder.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 3/25/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "STDSJSONEncodable.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
`STDSJSONEncoder` is a utility class to help with converting API objects into JSON
|
||||
*/
|
||||
@interface STDSJSONEncoder : NSObject
|
||||
|
||||
/**
|
||||
Method to convert an STDSJSONEncodable object into a JSON dictionary.
|
||||
*/
|
||||
+ (NSDictionary *)dictionaryForObject:(NSObject<STDSJSONEncodable> *)object;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,31 @@
|
|||
//
|
||||
// STDSLabelCustomization.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Andrew Harrison on 3/14/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import "STDSCustomization.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
A customization object to use to configure the UI of a text label.
|
||||
|
||||
The font and textColor inherited from `STDSCustomization` configure non-heading labels.
|
||||
*/
|
||||
@interface STDSLabelCustomization : STDSCustomization
|
||||
|
||||
/// The default settings.
|
||||
+ (instancetype)defaultSettings;
|
||||
|
||||
/// The color of the heading text. Defaults to black.
|
||||
@property (nonatomic) UIColor *headingTextColor;
|
||||
|
||||
/// The font to use for the heading text.
|
||||
@property (nonatomic) UIFont *headingFont;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,59 @@
|
|||
//
|
||||
// STDSNavigationBarCustomization.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Andrew Harrison on 3/14/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "STDSCustomization.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
A customization object to use to configure a UINavigationBar.
|
||||
|
||||
The font and textColor inherited from `STDSCustomization` configure the
|
||||
title of the navigation bar, and default to nil.
|
||||
*/
|
||||
@interface STDSNavigationBarCustomization : STDSCustomization
|
||||
|
||||
/// The default settings.
|
||||
+ (instancetype)defaultSettings;
|
||||
|
||||
/**
|
||||
The tint color of the navigation bar background.
|
||||
Defaults to nil.
|
||||
*/
|
||||
@property (nonatomic, nullable) UIColor *barTintColor;
|
||||
|
||||
/**
|
||||
The navigation bar style.
|
||||
Defaults to UIBarStyleDefault.
|
||||
*/
|
||||
@property (nonatomic) UIBarStyle barStyle;
|
||||
|
||||
/**
|
||||
A Boolean value indicating whether the navigation bar is translucent or not.
|
||||
Defaults to YES.
|
||||
*/
|
||||
@property (nonatomic) BOOL translucent;
|
||||
|
||||
/**
|
||||
The text to display in the title of the navigation bar.
|
||||
Defaults to "Secure checkout".
|
||||
*/
|
||||
@property (nonatomic, copy) NSString *headerText;
|
||||
|
||||
/**
|
||||
The text to display for the button in the navigation bar.
|
||||
Defaults to "Cancel".
|
||||
*/
|
||||
@property (nonatomic, copy) NSString *buttonText;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,23 @@
|
|||
//
|
||||
// STDSNotInitializedException.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Cameron Sabol on 2/13/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import "STDSException.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
`STDSNotInitializedException` represents an exception that will be thrown by
|
||||
the the Stripe3DS2 SDK if methods are called without initializing `STDSThreeDS2Service`.
|
||||
|
||||
@see STDSThreeDS2Service
|
||||
*/
|
||||
@interface STDSNotInitializedException : STDSException
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,42 @@
|
|||
//
|
||||
// STDSProtocolErrorEvent.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 3/20/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class STDSErrorMessage;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
`STDSProtocolErrorEvent` contains details about erorrs received from or sent to the ACS.
|
||||
*/
|
||||
@interface STDSProtocolErrorEvent : NSObject
|
||||
|
||||
/**
|
||||
Designated initializer for `STDSProtocolErrorEvent`.
|
||||
*/
|
||||
- (instancetype)initWithSDKTransactionIdentifier:(NSString *)identifier errorMessage:(STDSErrorMessage *)errorMessage;
|
||||
|
||||
/**
|
||||
`STDSProtocolErrorEvent` should not be directly initialized.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
Details about the error.
|
||||
*/
|
||||
@property (nonatomic, readonly) STDSErrorMessage *errorMessage;
|
||||
|
||||
/**
|
||||
The SDK Transaction Identifier.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *sdkTransactionIdentifier;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,53 @@
|
|||
//
|
||||
// STDSRuntimeErrorEvent.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 3/20/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
FOUNDATION_EXTERN NSString * const kSTDSRuntimeErrorCodeParsingError;
|
||||
FOUNDATION_EXTERN NSString * const kSTDSRuntimeErrorCodeEncryptionError;
|
||||
|
||||
/**
|
||||
`STDSRuntimeErrorEvent` contains details about run-time errors encountered during authentication.
|
||||
|
||||
The following are examples of run-time errors:
|
||||
- ACS is unreachable
|
||||
- Unparseable message
|
||||
- Network issues
|
||||
*/
|
||||
@interface STDSRuntimeErrorEvent : NSObject
|
||||
|
||||
/**
|
||||
A code corresponding to the type of error this represents.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *errorCode;
|
||||
|
||||
/**
|
||||
Details about the error.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString *errorMessage;
|
||||
|
||||
/**
|
||||
Designated initializer for `STDSRuntimeErrorEvent`.
|
||||
*/
|
||||
- (instancetype)initWithErrorCode:(NSString *)errorCode errorMessage:(NSString *)errorMessage NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
/**
|
||||
A representation of the `STDSRuntimeErrorEvent` as an `NSError`
|
||||
*/
|
||||
- (NSError *)NSErrorValue;
|
||||
|
||||
/**
|
||||
`STDSRuntimeErrorEvent` should not be directly initialized.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,21 @@
|
|||
//
|
||||
// STDSRuntimeException.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Cameron Sabol on 1/22/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import "STDSException.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
`STDSRuntimeException` represents an exception that will be thrown by the
|
||||
Stripe3DS2 SDK if it encounters an internal error.
|
||||
*/
|
||||
@interface STDSRuntimeException : STDSException
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,48 @@
|
|||
//
|
||||
// STDSSelectionCustomization.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 6/11/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
A customization object that configures the appearance of
|
||||
radio buttons and checkboxes.
|
||||
*/
|
||||
@interface STDSSelectionCustomization: NSObject <NSCopying>
|
||||
|
||||
/// The default settings.
|
||||
+ (instancetype)defaultSettings;
|
||||
|
||||
/**
|
||||
The primary color of the selected state.
|
||||
Defaults to blue.
|
||||
*/
|
||||
@property (nonatomic) UIColor *primarySelectedColor;
|
||||
|
||||
/**
|
||||
The secondary color of the selected state (e.g. the checkmark color).
|
||||
Defaults to white.
|
||||
*/
|
||||
@property (nonatomic) UIColor *secondarySelectedColor;
|
||||
|
||||
/**
|
||||
The background color displayed in the unselected state.
|
||||
Defaults to light blue.
|
||||
*/
|
||||
@property (nonatomic) UIColor *unselectedBackgroundColor;
|
||||
|
||||
/**
|
||||
The color of the border drawn around the view in the unselected state.
|
||||
Defaults to blue.
|
||||
*/
|
||||
@property (nonatomic) UIColor *unselectedBorderColor;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,68 @@
|
|||
//
|
||||
// STDSStripe3DS2Error.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 3/27/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
FOUNDATION_EXPORT NSString * const STDSStripe3DS2ErrorDomain;
|
||||
|
||||
/**
|
||||
NSError.userInfo contains this key if we received an ErrorMessage instead of the expected response object.
|
||||
The value of this key is the ErrorMessage.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString * const STDSStripe3DS2ErrorMessageErrorKey;
|
||||
|
||||
/**
|
||||
NSError.userInfo contains this key if we errored parsing JSON.
|
||||
The value of this key is the invalid or missing field.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString * const STDSStripe3DS2ErrorFieldKey;
|
||||
|
||||
/**
|
||||
NSError.userInfo contains this key if we couldn't recognize critical message extension(s)
|
||||
The value of this key is an array of identifiers.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString * const STDSStripe3DS2UnrecognizedCriticalMessageExtensionsKey;
|
||||
|
||||
|
||||
typedef NS_ENUM(NSInteger, STDSErrorCode) {
|
||||
|
||||
/// Code triggered an assertion
|
||||
STDSErrorCodeAssertionFailed = 204,
|
||||
|
||||
// JSON Parsing
|
||||
/// Received invalid or malformed data
|
||||
STDSErrorCodeJSONFieldInvalid = 203,
|
||||
/// Expected field missing
|
||||
STDSErrorCodeJSONFieldMissing = 201,
|
||||
|
||||
/// Critical message extension not recognised
|
||||
STDSErrorCodeUnrecognizedCriticalMessageExtension = 202,
|
||||
|
||||
/// Decryption or verification error
|
||||
STDSErrorCodeDecryptionVerification = 302,
|
||||
|
||||
/// Error code corresponding to a `STDSRuntimeErrorEvent` for an unparseable network response
|
||||
STDSErrorCodeRuntimeParsing = 400,
|
||||
/// Error code corresponding to a `STDSRuntimeErrorEvent` for an error with decrypting or verifying a network response
|
||||
STDSErrorCodeRuntimeEncryption = 401,
|
||||
|
||||
// Networking
|
||||
/// We received an ErrorMessage instead of the expected response object. `userInfo[STDSStripe3DS2ErrorMessageErrorKey]` will contain the ErrorMessage object.
|
||||
STDSErrorCodeReceivedErrorMessage = 1000,
|
||||
/// We received an unknown message type.
|
||||
STDSErrorCodeUnknownMessageType = 1001,
|
||||
/// Request timed out
|
||||
STDSErrorCodeTimeout = 1002,
|
||||
|
||||
/// Unknown
|
||||
STDSErrorCodeUnknownError = 2000,
|
||||
};
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,50 @@
|
|||
//
|
||||
// STDSSwiftTryCatch.h
|
||||
//
|
||||
// Created by William Falcon on 10/10/14.
|
||||
// Copyright (c) 2014 William Falcon. All rights reserved.
|
||||
//
|
||||
/*
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, 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.
|
||||
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.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
Provides try catch functionality for swift by wrapping around Objective-C
|
||||
*/
|
||||
@interface STDSSwiftTryCatch : NSObject
|
||||
|
||||
/**
|
||||
Provides try catch functionality for swift by wrapping around Objective-C
|
||||
*/
|
||||
+ (void)tryBlock:(void(^)(void))tryBlock catchBlock:(void(^)(NSException*exception))catchBlock finallyBlock:(void(^)(void))finallyBlock;
|
||||
/**
|
||||
Throws Objective-C exception with name and reason set to `s`
|
||||
*/
|
||||
+ (void)throwString:(NSString*)s;
|
||||
|
||||
/**
|
||||
Throws exception `e`
|
||||
*/
|
||||
+ (void)throwException:(NSException*)e;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,47 @@
|
|||
//
|
||||
// STDSTextFieldCustomization.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Andrew Harrison on 3/14/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "STDSCustomization.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
A customization object to use to configure the UI of a text field.
|
||||
|
||||
The font and textColor inherited from `STDSCustomization` configure
|
||||
the user input text.
|
||||
*/
|
||||
@interface STDSTextFieldCustomization : STDSCustomization
|
||||
|
||||
/**
|
||||
The default settings.
|
||||
|
||||
The default textColor is black.
|
||||
*/
|
||||
+ (instancetype)defaultSettings;
|
||||
|
||||
/// The border width of the text field. Defaults to 2.
|
||||
@property (nonatomic) CGFloat borderWidth;
|
||||
|
||||
/// The color of the border of the text field. Defaults to clear.
|
||||
@property (nonatomic) UIColor *borderColor;
|
||||
|
||||
/// The corner radius of the edges of the text field. Defaults to 8.
|
||||
@property (nonatomic) CGFloat cornerRadius;
|
||||
|
||||
/// The appearance of the keyboard. Defaults to UIKeyboardAppearanceDefault.
|
||||
@property (nonatomic) UIKeyboardAppearance keyboardAppearance;
|
||||
|
||||
/// The color of the placeholder text. Defaults to light gray.
|
||||
@property (nonatomic) UIColor *placeholderTextColor;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,84 @@
|
|||
//
|
||||
// STDSThreeDS2Service.h
|
||||
// Stripe3DS2
|
||||
//
|
||||
// Created by Cameron Sabol on 1/22/19.
|
||||
// Copyright © 2019 Stripe. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class STDSConfigParameters;
|
||||
@class STDSTransaction;
|
||||
@class STDSUICustomization;
|
||||
@class STDSWarning;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
`STDSThreeDS2Service` is the main 3DS SDK interface and provides methods to process transactions.
|
||||
*/
|
||||
@interface STDSThreeDS2Service : NSObject
|
||||
|
||||
/**
|
||||
A list of warnings that may be populated once the SDK has been initialized.
|
||||
*/
|
||||
@property (nonatomic, readonly, nullable) NSArray<STDSWarning *> *warnings;
|
||||
|
||||
/**
|
||||
Initializes the 3DS SDK instance.
|
||||
|
||||
This method should be called at the start of the payment stage of a transaction.
|
||||
**Note: Until the `STDSThreeDS2Service instance is initialized, it will be unusable.**
|
||||
|
||||
- Performs security checks
|
||||
- Collects device information
|
||||
|
||||
@param config Configuration information that will be used during initialization. @see STDSConfigParameters
|
||||
@param locale Optional override for the locale to use in UI. If `nil`, will default to the current system locale.
|
||||
@param uiSettings Optional custom UI settings. If `nil`, will default to `[STDSUICustomization defaultSettings]`.
|
||||
This argument is copied; any further changes to the customization object have no effect. @see STDSUICustomization
|
||||
|
||||
@exception STDSInvalidInputException Will throw an `STDSInvalidInputException` if `config` is `nil` or any of `config`, `locale`, or `uiSettings` are invalid. @see STDSInvalidInputException
|
||||
@exception STDSAlreadyInitializedException Will throw an `STDSAlreadyInitializedException` if the 3DS SDK instance has already been initialized. @see STDSSDKAlreadyInitializedException
|
||||
@exception STDSRuntimeException Will throw an `STDSRuntimeException` if there is an internal error in the SDK. @see STDSRuntimeException
|
||||
*/
|
||||
- (void)initializeWithConfig:(STDSConfigParameters *)config
|
||||
locale:(nullable NSLocale *)locale
|
||||
uiSettings:(nullable STDSUICustomization *)uiSettings;
|
||||
|
||||
/**
|
||||
Creates and returns an instance of `STDSTransaction`.
|
||||
|
||||
@param directoryServerID The Directory Server identifier returned in the authentication response
|
||||
@param protocolVersion 3DS protocol version according to which the transaction will be created. Uses the default value of 2.1.0 if nil
|
||||
|
||||
@exception STDSNotInitializedException Will throw an `STDSNotInitializedException` if the the `STDSThreeDS2Service` instance hasn't been initialized with a call to `initializeWithConfig:locale:uiSettings:`. @see STDSNotInitializedException
|
||||
@exception STDSInvalidInputException Will throw an `STDSInvalidInputException` if `directoryServerID` is not recognized or if the `protocolVersion` is not supported by this version of the SDK. @see STDSInvalidInputException
|
||||
@exception STDSRuntimeException Will throw an `STDSRuntimeException` if there is an internal error in the SDK. @see STDSRuntimeException
|
||||
*/
|
||||
- (STDSTransaction *)createTransactionForDirectoryServer:(NSString *)directoryServerID
|
||||
withProtocolVersion:(nullable NSString *)protocolVersion;
|
||||
|
||||
/**
|
||||
Creates and returns an instance of `STDSTransaction` using a custom directory server certificate.
|
||||
Will return nil if unable to create a certificate from the provided params.
|
||||
|
||||
@param directoryServerID The Directory Server identifier returned in the authentication response
|
||||
@param serverKeyID An additional authentication key used by some Directory Servers
|
||||
@param certificateString A Base64-encoded PEM or DER formatted certificate string containing the directory server's public key
|
||||
@param rootCertificateStrings An arry of base64-encoded PEM or DER formatted certificate strings containing the DS root certificate used for signature checks
|
||||
@param protocolVersion 3DS protocol version according to which the transaction will be created. Uses the default value of 2.1.0 if nil
|
||||
|
||||
@exception STDSNotInitializedException Will throw an `STDSNotInitializedException` if the the `STDSThreeDS2Service` instance hasn't been initialized with a call to `initializeWithConfig:locale:uiSettings:`. @see STDSNotInitializedException
|
||||
@exception STDSInvalidInputException Will throw an `STDSInvalidInputException` if the `protocolVersion` is not supported by this version of the SDK. @see STDSInvalidInputException
|
||||
*/
|
||||
- (nullable STDSTransaction *)createTransactionForDirectoryServer:(NSString *)directoryServerID
|
||||
serverKeyID:(nullable NSString *)serverKeyID
|
||||
certificateString:(NSString *)certificateString
|
||||
rootCertificateStrings:(NSArray<NSString *> *)rootCertificateStrings
|
||||
withProtocolVersion:(nullable NSString *)protocolVersion;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue