### Install fastlane Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/fastlane/README.md Provides instructions for installing fastlane using RubyGems or Homebrew Cask. ```bash [sudo] gem install fastlane -NV ``` ```bash brew cask install fastlane ``` -------------------------------- ### Install Xcode Command Line Tools Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/fastlane/README.md Ensures the latest version of Xcode command line tools is installed, a prerequisite for fastlane. ```bash xcode-select --install ``` -------------------------------- ### Carthage Installation Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/docsets/MPGSDK.docset/Contents/Resources/Documents/index.html Specifies the Carthage dependency for integrating the Gateway SDK into your project. ```APIDOC github "Mastercard-Gateway/gateway-ios-sdk" ``` -------------------------------- ### Install Gateway iOS SDK with Carthage Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/README.md This snippet shows how to integrate the Mastercard Gateway iOS SDK into your project using Carthage, a decentralized dependency manager for macOS and iOS. ```bash github "Mastercard-Gateway/gateway-ios-sdk" ``` -------------------------------- ### Carthage Installation Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/index.html Specifies the Carthage dependency for integrating the Gateway SDK into your project. ```APIDOC github "Mastercard-Gateway/gateway-ios-sdk" ``` -------------------------------- ### Initialize Gateway with Region and Merchant ID Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/README.md Shows how to initialize the Gateway object with the required merchant ID and the appropriate gateway region. It lists example region values and advises consulting the GatewayRegion.swift file for a complete list. ```swift let gateway = Gateway(region: GatewayRegion.<#YOUR GATEWAY REGION#>, merchantId: "<#YOUR MERCHANT ID#>") ``` -------------------------------- ### Update Session with Card Details Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/docsets/MPGSDK.docset/Contents/Resources/Documents/index.html Provides an example of updating a session with card information using the Gateway object. It involves creating a GatewayMap to hold the card details and calling the updateSession method. ```swift var request = GatewayMap() request[at: "sourceOfFunds.provided.card.nameOnCard"] = "<#name on card#>" request[at: "sourceOfFunds.provided.card.number"] = "<#card number#>" request[at: "sourceOfFunds.provided.card.securityCode"] = "<#security code#>" request[at: "sourceOfFunds.provided.card.expiry.month"] = "<#expiration month#>" request[at: "sourceOfFunds.provided.card.expiry.year"] = "<#expiration year#>" gateway.updateSession("<#session id#>", apiVersion: <#Gateway API Version#>, payload: request) { (result) in // handle the result } ``` -------------------------------- ### Update Session with Card Details Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/index.html Provides an example of updating a session with card information using the Gateway object. It involves creating a GatewayMap to hold the card details and calling the updateSession method. ```swift var request = GatewayMap() request[at: "sourceOfFunds.provided.card.nameOnCard"] = "<#name on card#>" request[at: "sourceOfFunds.provided.card.number"] = "<#card number#>" request[at: "sourceOfFunds.provided.card.securityCode"] = "<#security code#>" request[at: "sourceOfFunds.provided.card.expiry.month"] = "<#expiration month#>" request[at: "sourceOfFunds.provided.card.expiry.year"] = "<#expiration year#>" gateway.updateSession("<#session id#>", apiVersion: <#Gateway API Version#>, payload: request) { (result) in // handle the result } ``` -------------------------------- ### Update Session with Card Information Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/README.md Provides a code example for updating a payment session with card details using an existing Session ID. It includes parameters for cardholder name, number, security code, and expiration date, and outlines the asynchronous handling of the result. ```swift var request = GatewayMap() request[at: "sourceOfFunds.provided.card.nameOnCard"] = "<#name on card#>" request[at: "sourceOfFunds.provided.card.number"] = "<#card number#>" request[at: "sourceOfFunds.provided.card.securityCode"] = "<#security code#>" request[at: "sourceOfFunds.provided.card.expiry.month"] = "<#expiration month#>" request[at: "sourceOfFunds.provided.card.expiry.year"] = "<#expiration year#>" gateway.updateSession("<#session id#>", apiVersion: <#Gateway API Version#>, payload: request) { (result) in // handle the result } ``` -------------------------------- ### Prepare iOS Release Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/fastlane/README.md Prepares the iOS project for a release by updating the version number and documentation. ```bash fastlane ios prep_release ``` -------------------------------- ### Sample App and Initial Release Features Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/CHANGES.md Describes features introduced in the initial release and sample application enhancements. ```APIDOC Sample App and Initial Release Features: - Sample app with support for Apple Pay (version 1.1.0). - Initial Release of the SDK (version 1.0.0). - Support for updating a session with card information (version 1.0.0). - 3-D Secure 1.0 support for Gateway API versions 46 and below (version 1.0.0). ``` -------------------------------- ### API Response Changes for Enrollment Check & Authentication (v47+) Source: https://github.com/mastercard-gateway/gateway-ios-sdk/wiki/3D-Secure-Authentication Highlights the changes in API response fields for 3-D Secure enrollment check and authentication starting from version 47 of the Gateway API. ```APIDOC For v46 & below: - Enrollment check: gatewayResponse.3DSecure.summaryStatus - Authentication result: 3DSecure.summaryStatus For v47 & above: - Enrollment check: gatewayResponse.response.gatewayRecommendation - Authentication result: response.gatewayRecommendation ``` -------------------------------- ### Run iOS Tests Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/fastlane/README.md Executes all tests for the iOS frameworks within the project. ```bash fastlane ios test ``` -------------------------------- ### Import MPGSDK Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/docsets/MPGSDK.docset/Contents/Resources/Documents/index.html Demonstrates how to import the Gateway SDK into your Swift project. ```swift import MPGSDK ``` -------------------------------- ### Gateway Class Initialization Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/docsets/MPGSDK.docset/Contents/Resources/Documents/Classes.html Demonstrates how to initialize the Gateway class with a URL and merchant ID. This is the primary interface for interacting with the Gateway SDK. ```swift let gateway = try Gateway(url: "https://your-gateway-url.com", merchantId: "your-merchant-id") ``` -------------------------------- ### Update iOS Documentation Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/fastlane/README.md Generates or updates the documentation for the iOS project. ```bash fastlane ios update_docs ``` -------------------------------- ### Gateway Initialization Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/docsets/MPGSDK.docset/Contents/Resources/Documents/Classes/Gateway.html Demonstrates how to create an instance of the Gateway class with a specified region and merchant ID. ```swift let gateway = try Gateway(url: "https://your-gateway-url.com", merchantId: "your-merchant-id") ``` -------------------------------- ### Initialize and Present 3-D Secure View Controller Source: https://github.com/mastercard-gateway/gateway-ios-sdk/wiki/3D-Secure-Authentication Demonstrates how to create an instance of `Gateway3DSecureViewController`, customize its appearance (title and navigation bar tint color), and present it modally. This is the initial step for initiating the 3-D Secure authentication flow. ```swift let threeDSecureView = Gateway3DSecureViewController(nibName: nil, bundle: nil) // Optionally, customize the presentation threeDSecureView.title = "3-D Secure Auth" threeDSecureView.navBar.tintColor = UIColor(red: 1, green: 0.357, blue: 0.365, alpha: 1) // present the 3DSecureViewController present(threeDSecureView, animated: true) ``` -------------------------------- ### Gateway Class Initialization Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/Classes.html Demonstrates how to initialize the Gateway class with a URL and merchant ID. This is the primary interface for interacting with the Gateway SDK. ```swift let gateway = try Gateway(url: "https://your-gateway-url.com", merchantId: "your-merchant-id") ``` -------------------------------- ### Gateway Initialization Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/Classes/Gateway.html Demonstrates how to create an instance of the Gateway class with a specified region and merchant ID. ```swift let gateway = try Gateway(url: "https://your-gateway-url.com", merchantId: "your-merchant-id") ``` -------------------------------- ### Import MPGSDK Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/index.html Demonstrates how to import the Gateway SDK into your Swift project. ```swift import MPGSDK ``` -------------------------------- ### Import Gateway SDK Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/README.md Demonstrates the necessary import statement to use the Gateway SDK functionalities within your Swift iOS application. ```swift import MPGSDK ``` -------------------------------- ### Gateway Class API Documentation Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/docsets/MPGSDK.docset/Contents/Resources/Documents/Classes/Gateway.html Provides a comprehensive reference for the Gateway class, including its properties, initializer, and methods for session updates and certificate handling. ```APIDOC Gateway: A public interface to the Gateway SDK. Properties: region: GatewayRegion The region the merchant is located in. merchantId: String The merchant’s id on the Gateway. Initializer: init(region: GatewayRegion, merchantId: String) Construct a new instance of the gateway. Parameters: _region_: The region in which the merchant is registered with the gateway. This must be one of the values provided by the GatewayRegion enum (.northAmerica, .europe, .asiaPacific). _merchantId_: A valid merchant ID. Methods: updateSession(_ session: String, apiVersion: String, payload: GatewayMap, completion: @escaping (GatewayResult) -> Void) -> URLSessionTask? Update a gateway session with payment payer data. Parameters: _session_: A session ID from the gateway. _apiVersion_: The api version which was used to create the session. _payload_: A GatewayMap containing the payload to send. _completion_: A completion handler for when the request completes or fails. Returns: The URLSessionTask being used to perform the network request for the purposes of canceling or monitoring the progress. urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) Handles certificate pinning for URL sessions. Parameters: session: The URL session. challenge: The authentication challenge received. completionHandler: A callback to handle the challenge disposition and credentials. ``` -------------------------------- ### Project and Build Configuration Updates Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/CHANGES.md Documents changes related to project configuration, build tools, and language versions. ```APIDOC Project and Build Configuration Updates: - Updated podspec file (versions 1.1.2, 1.1.9). - Updated Swift.package file version to specify swift 5.0 (version 1.1.4). - Updated Fastlane versions (version 1.1.3). - Updated the project and source code to Swift 5 (version 1.1.2). - Syncing Changes.md with releases (version 1.1.4). ``` -------------------------------- ### Gateway3DSecureViewController Initializers Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/docsets/MPGSDK.docset/Contents/Resources/Documents/Classes/Gateway3DSecureViewController.html Initializers for the Gateway3DSecureViewController class. These are standard initializers for UIViewController subclasses, used for creating instances from code or from a nib file. ```APIDOC Gateway3DSecureViewController: init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) Undocumented init?(coder aDecoder: NSCoder) Undocumented ``` -------------------------------- ### Gateway Class API Documentation Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/Classes/Gateway.html Provides a comprehensive reference for the Gateway class, including its properties, initializer, and methods for session updates and certificate handling. ```APIDOC Gateway: A public interface to the Gateway SDK. Properties: region: GatewayRegion The region the merchant is located in. merchantId: String The merchant’s id on the Gateway. Initializer: init(region: GatewayRegion, merchantId: String) Construct a new instance of the gateway. Parameters: _region_: The region in which the merchant is registered with the gateway. This must be one of the values provided by the GatewayRegion enum (.northAmerica, .europe, .asiaPacific). _merchantId_: A valid merchant ID. Methods: updateSession(_ session: String, apiVersion: String, payload: GatewayMap, completion: @escaping (GatewayResult) -> Void) -> URLSessionTask? Update a gateway session with payment payer data. Parameters: _session_: A session ID from the gateway. _apiVersion_: The api version which was used to create the session. _payload_: A GatewayMap containing the payload to send. _completion_: A completion handler for when the request completes or fails. Returns: The URLSessionTask being used to perform the network request for the purposes of canceling or monitoring the progress. urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) Handles certificate pinning for URL sessions. Parameters: session: The URL session. challenge: The authentication challenge received. completionHandler: A callback to handle the challenge disposition and credentials. ``` -------------------------------- ### GatewayMap ExpressibleByDictionaryLiteral Conformance Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/docsets/MPGSDK.docset/Contents/Resources/Documents/Structs/GatewayMap.html Allows GatewayMap to be initialized using dictionary literal syntax. ```swift public init(dictionaryLiteral elements: (String, Any)...) ``` -------------------------------- ### WKNavigationDelegate Methods Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/docsets/MPGSDK.docset/Contents/Resources/Documents/Classes/Gateway3DSecureViewController.html Provides documentation for key WKNavigationDelegate methods used in the Gateway3DSecureViewController. These methods handle the lifecycle of web navigation within the SDK. ```APIDOC WKNavigationDelegate Methods: webView(_:didStartProvisionalNavigation:) - Description: Undocumented. Called when a provisional navigation is starting. - Declaration: public func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) webView(_:didFinish:) - Description: Undocumented. Called when a web view finishes loading. - Declaration: public func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) webView(_:decidePolicyFor:decisionHandler:) - Description: Undocumented. Called to decide whether to allow or cancel a navigation. - Declaration: public func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) ``` -------------------------------- ### Gateway3DSecureViewController Initializers Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/Classes/Gateway3DSecureViewController.html Initializers for the Gateway3DSecureViewController class. These are standard initializers for UIViewController subclasses, used for creating instances from code or from a nib file. ```APIDOC Gateway3DSecureViewController: init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) Undocumented init?(coder aDecoder: NSCoder) Undocumented ``` -------------------------------- ### Initialize Gateway Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/docsets/MPGSDK.docset/Contents/Resources/Documents/index.html Shows how to initialize the Gateway object with the merchant ID and gateway region. It requires specifying the correct region from the GatewayRegion enum. ```swift let gateway = Gateway(region: GatewayRegion.<#YOUR GATEWAY REGION#>, merchantId: "<#YOUR MERCHANT ID#>") ``` -------------------------------- ### GatewayMap Initializers Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/docsets/MPGSDK.docset/Contents/Resources/Documents/Structs/GatewayMap.html Initializes a new GatewayMap, either empty or from an existing dictionary. The dictionary initializer supports various value types and drops unsupported ones. ```swift public init() public init(_ dictionary: [String : Any]) ``` -------------------------------- ### WKNavigationDelegate Methods Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/Classes/Gateway3DSecureViewController.html Provides documentation for key WKNavigationDelegate methods used in the Gateway3DSecureViewController. These methods handle the lifecycle of web navigation within the SDK. ```APIDOC WKNavigationDelegate Methods: webView(_:didStartProvisionalNavigation:) - Description: Undocumented. Called when a provisional navigation is starting. - Declaration: public func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) webView(_:didFinish:) - Description: Undocumented. Called when a web view finishes loading. - Declaration: public func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) webView(_:decidePolicyFor:decisionHandler:) - Description: Undocumented. Called to decide whether to allow or cancel a navigation. - Declaration: public func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) ``` -------------------------------- ### Update iOS SDK Version Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/fastlane/README.md Updates the SDK version number across all frameworks in the iOS project. ```bash fastlane ios update_version ``` -------------------------------- ### GatewayMap ExpressibleByDictionaryLiteral Conformance Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/Structs/GatewayMap.html Allows GatewayMap to be initialized using dictionary literal syntax. ```swift public init(dictionaryLiteral elements: (String, Any)...) ``` -------------------------------- ### Initialize Gateway Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/index.html Shows how to initialize the Gateway object with the merchant ID and gateway region. It requires specifying the correct region from the GatewayRegion enum. ```swift let gateway = Gateway(region: GatewayRegion.<#YOUR GATEWAY REGION#>, merchantId: "<#YOUR MERCHANT ID#>") ``` -------------------------------- ### Codable Conformance Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/docsets/MPGSDK.docset/Contents/Resources/Documents/Structs/GatewayMap.html Provides methods for encoding and decoding objects to and from data formats, essential for data serialization and deserialization within the SDK. ```APIDOC Codable: encode(to: Encoder) throws Encodes the receiver to the given encoder. init(from: Decoder) throws Initializes the receiver from the given decoder. ``` -------------------------------- ### GatewayMap Initializers Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/Structs/GatewayMap.html Initializes a new GatewayMap, either empty or from an existing dictionary. The dictionary initializer supports various value types and drops unsupported ones. ```swift public init() public init(_ dictionary: [String : Any]) ``` -------------------------------- ### GatewayMap Properties Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/docsets/MPGSDK.docset/Contents/Resources/Documents/Structs/GatewayMap.html Provides access to the underlying dictionary representation of the GatewayMap and a string description of its contents. ```swift public var dictionary: [String : Any] { get } public var description: String { get } ``` -------------------------------- ### Regional Support and URL Pattern Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/CHANGES.md Highlights the addition of new regions and the standardization of URL patterns for regional access. ```APIDOC Regional Support and URL Pattern: - Added Saudi region (KSA) URL (version 1.1.7). - Added the China on-soil region (version 1.1.5). - Providing a way for integrators to use regions that have not yet been added to the SDK (version 1.1.5). - Converting all URLs to use the ".gateway.mastercard.com" pattern (version 1.1.5). - Added the India regions (version 1.1.3). ``` -------------------------------- ### Private Utility Methods Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/docsets/MPGSDK.docset/Contents/Resources/Documents/Structs/GatewayMap.html Contains private methods and properties used internally by the SDK, including equality checks and debug descriptions for internal data structures. ```APIDOC PRIVATE: == (lhs: GatewayMap, rhs: GatewayMap) -> Bool Compares two GatewayMap instances for equality. debugDescription: String { get } Returns a string that is the debug description of the GatewayMap instance. ``` -------------------------------- ### Gateway3DSecureViewController Usage Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/docsets/MPGSDK.docset/Contents/Resources/Documents/Classes.html Explains the purpose of Gateway3DSecureViewController for handling 3DSecure 1.0 authentication. It listens for specific redirects to process authentication results. ```swift A view controller to perform 3DSecure 1.0 authentication using an embeded web view. This view listens for a redirect in the form of “gatewaysdk://3dsecure?summaryStatus=&3DSecureId=”. When that redirect occours, it will parse the parameters and return that to the handler provided to the “authenticatePayer” function. ``` -------------------------------- ### Gateway API - Session Update Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/README.md This API documentation outlines the process of updating a payment session with card details. It specifies the parameters required, including the session ID, API version, and a payload containing the card information. The response handling is asynchronous. ```APIDOC Gateway.updateSession(sessionId: String, apiVersion: String, payload: GatewayMap, completion: (Result) -> Void) Parameters: - sessionId: The unique identifier for the payment session. - apiVersion: The version of the Gateway API to use for the request. - payload: A GatewayMap object containing the card details to update the session with. Expected keys include: - "sourceOfFunds.provided.card.nameOnCard": The name of the cardholder. - "sourceOfFunds.provided.card.number": The credit card number. - "sourceOfFound.provided.card.securityCode": The CVV or security code. - "sourceOfFunds.provided.card.expiry.month": The expiration month of the card. - "sourceOfFunds.provided.card.expiry.year": The expiration year of the card. - completion: A closure that handles the result of the session update operation. It receives either a success (Void) or an Error. Usage: This method is used to securely transmit card information from a mobile device to the Mastercard Gateway, updating an existing session without the need for server-side handling of sensitive card data. ``` -------------------------------- ### Codable Conformance Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/Structs/GatewayMap.html Provides methods for encoding and decoding objects to and from data formats, essential for data serialization and deserialization within the SDK. ```APIDOC Codable: encode(to: Encoder) throws Encodes the receiver to the given encoder. init(from: Decoder) throws Initializes the receiver from the given decoder. ``` -------------------------------- ### Authenticate Payer and Handle Results Source: https://github.com/mastercard-gateway/gateway-ios-sdk/wiki/3D-Secure-Authentication Shows how to provide the HTML content received from the 'Check Enrollment Status' call to the `authenticatePayer` function of the `Gateway3DSecureViewController`. It also includes a completion handler to process the authentication result, dismiss the view controller, and handle different outcomes (completed with status, cancelled). ```swift threeDSecureView.authenticatePayer(htmlBodyContent: "HTML STRING FROM CHECK ENROLLMENT") { (threeDSView, result) in // dismiss the 3-D Secure view controller threeDSView.dismiss(animated: true) // handle the result case switch result { case .completed(status: "", id: _): // failed authentication case .completed(status: _, id: let id): // continue with the payment for all other statuses default: // authentication was cancelled } } ``` -------------------------------- ### HTTPMethod Enumeration Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/docsets/MPGSDK.docset/Contents/Resources/Documents/Enums/HTTPMethod.html The HTTPMethod enumeration defines the standard HTTP request methods supported by the SDK. Each case represents a method and is associated with its string representation. ```APIDOC HTTPMethod: public enum HTTPMethod : String Cases: get: Represents the HTTP GET method. Declaration: Swift case get = "GET" put: Represents the HTTP PUT method. Declaration: Swift case put = "PUT" post: Represents the HTTP POST method. Declaration: Swift case post = "POST" delete: Represents the HTTP DELETE method. Declaration: Swift case delete = "DELETE" head: Represents the HTTP HEAD method. Declaration: Swift case head = "HEAD" trace: Represents the HTTP TRACE method. Declaration: Swift case trace = "TRACE" ``` -------------------------------- ### 3-D Secure Transaction Lifecycle Steps Source: https://github.com/mastercard-gateway/gateway-ios-sdk/wiki/3D-Secure-Authentication Details the sequence of operations for a 3-D Secure transaction, from session creation to final transaction completion. It highlights interactions between the mobile app, merchant service, and Gateway. ```APIDOC 1. Mobile app requests new Session from merchant service. 2. Merchant service calls Create a Session on the Gateway. 3. Gateway returns Session Id to merchant service. 4. Session Id and API version returned to mobile app. 5. Card information collected and sent to Gateway via SDK method. 6. Success/fail message returned to app. 7. Mobile app requests merchant server to check 3DS enrollment using Session Id. 8. Merchant service calls Check 3DS Enrollment on Gateway, including redirect URL. 9. Gateway returns enrollment status and HTML for SDK web view. 10. Enrollment status and HTML returned to mobile app. - v46 & below: check gatewayResponse.3DSecure.summaryStatus - v47 & above: check gatewayResponse.response.gatewayRecommendation 11. If enrolled, mobile app passes HTML to SDK web view for authentication. 12. Issuer redirects response data to Merchant Redirect Page. - v46: check 3DSecure.summaryStatus - v47: check response.gatewayRecommendation 13. App requests transaction completion by sending 3DSecureId to merchant service. 14. Merchant service performs transaction operation with Gateway. 15. Gateway returns transaction attempt summary to merchant service. 16. Success/fail status returned to mobile app. ``` -------------------------------- ### GatewayMap Properties Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/Structs/GatewayMap.html Provides access to the underlying dictionary representation of the GatewayMap and a string description of its contents. ```swift public var dictionary: [String : Any] { get } public var description: String { get } ``` -------------------------------- ### Private Utility Methods Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/Structs/GatewayMap.html Contains private methods and properties used internally by the SDK, including equality checks and debug descriptions for internal data structures. ```APIDOC PRIVATE: == (lhs: GatewayMap, rhs: GatewayMap) -> Bool Compares two GatewayMap instances for equality. debugDescription: String { get } Returns a string that is the debug description of the GatewayMap instance. ``` -------------------------------- ### authenticatePayer Method - Gateway3DSecureViewController Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/docsets/MPGSDK.docset/Contents/Resources/Documents/Classes/Gateway3DSecureViewController.html Initiates the 3DSecure 1.0 payer authentication process. It takes the HTML content from the enrollment check and a handler to process the authentication result. ```APIDOC Gateway3DSecureViewController: authenticatePayer(htmlBodyContent: String, handler: @escaping (Gateway3DSecureViewController, Gateway3DSecureResult) -> Void) Used to authenticate the payer using 3DSecure 1.0 Parameters: htmlBodyContent: The HTML body provided by the Check3DSecureEnrollment operation handler: A closure to handle the 3DSecure ‘WebAuthResult’ ``` -------------------------------- ### Gateway Region Enum Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/docsets/MPGSDK.docset/Contents/Resources/Documents/index.html Lists possible values for the Gateway region when initializing the Gateway object. For a complete list, refer to GatewayRegion.swift. ```APIDOC GatewayRegion.northAmerica GatewayRegion.asiaPacific GatewayRegion.india GatewayRegion.china GatewayRegion.europe ``` -------------------------------- ### Gateway3DSecureViewController Usage Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/Classes.html Explains the purpose of Gateway3DSecureViewController for handling 3DSecure 1.0 authentication. It listens for specific redirects to process authentication results. ```swift A view controller to perform 3DSecure 1.0 authentication using an embeded web view. This view listens for a redirect in the form of “gatewaysdk://3dsecure?summaryStatus=&3DSecureId=”. When that redirect occours, it will parse the parameters and return that to the handler provided to the “authenticatePayer” function. ``` -------------------------------- ### Gateway Class Declaration Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/docsets/MPGSDK.docset/Contents/Resources/Documents/Classes.html Provides the declaration for the Gateway class, indicating it inherits from NSObject and conforms to the URLSessionDelegate protocol. ```apidoc Gateway: Inherits from: NSObject Conforms to: URLSessionDelegate ``` -------------------------------- ### Gateway3DSecureViewController Declaration Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/docsets/MPGSDK.docset/Contents/Resources/Documents/Classes.html Provides the declaration for the Gateway3DSecureViewController class, indicating it inherits from UIViewController and conforms to the WKNavigationDelegate protocol. ```apidoc Gateway3DSecureViewController: Inherits from: UIViewController Conforms to: WKNavigationDelegate ``` -------------------------------- ### HTTPMethod Enumeration Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/Enums/HTTPMethod.html The HTTPMethod enumeration defines the standard HTTP request methods supported by the SDK. Each case represents a method and is associated with its string representation. ```APIDOC HTTPMethod: public enum HTTPMethod : String Cases: get: Represents the HTTP GET method. Declaration: Swift case get = "GET" put: Represents the HTTP PUT method. Declaration: Swift case put = "PUT" post: Represents the HTTP POST method. Declaration: Swift case post = "POST" delete: Represents the HTTP DELETE method. Declaration: Swift case delete = "DELETE" head: Represents the HTTP HEAD method. Declaration: Swift case head = "HEAD" trace: Represents the HTTP TRACE method. Declaration: Swift case trace = "TRACE" ``` -------------------------------- ### Gateway SDK 3-D Secure Redirect URL Format Source: https://github.com/mastercard-gateway/gateway-ios-sdk/wiki/3D-Secure-Authentication Defines the expected URL format for merchant redirect pages after 3-D Secure authentication. This URL pattern, containing `summaryStatus` and `3DSecureId`, signals the SDK to process the result and deliver the message back to the app via the appropriate callback. ```APIDOC URL Pattern for SDK Notification: gatewaysdk://3dsecure?summaryStatus=&3DSecureId= Description: This URL format is used by the merchant's redirect page to inform the Gateway SDK that 3-D Secure authentication has completed. The SDK intercepts this URL, extracts the `summaryStatus` and `3DSecureId` parameters, and uses them to process the authentication result. The app receives the final outcome through the completion handler provided to `authenticatePayer`. ``` -------------------------------- ### Gateway API Version Support Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/CHANGES.md Details changes in SDK support for Mastercard Gateway API versions, specifically for updating session calls. ```APIDOC Gateway API Version Support: - Updated the update session call to support Gateway API versions 50 and up (versions 1.1.1, 1.1.0). - Support for 3-D Secure 1.0 for Gateway API versions 46 and below (version 1.0.0). ``` -------------------------------- ### HTTPMethod Enum Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/docsets/MPGSDK.docset/Contents/Resources/Documents/Enums.html Represents the standard HTTP methods used for making API requests. This enumeration helps in abstracting HTTP request types. ```swift public enum HTTPMethod : String ``` -------------------------------- ### Update Session with Card Details Source: https://github.com/mastercard-gateway/gateway-ios-sdk/wiki/Home This snippet demonstrates how to update an existing session with card details using the Gateway SDK. It requires a session ID, API version, and a payload containing the card information. The result is handled via a completion handler, which provides either a success response or an error. ```swift var request = GatewayMap() request["sourceOfFunds.provided.card.nameOnCard"] = "<#name on card#>" request["sourceOfFunds.provided.card.number"] = "<#card number#>" request["sourceOfFunds.provided.card.securityCode"] = "<#security code#>" request["sourceOfFunds.provided.card.expiry.month"] = "<#expiration month#>" request["sourceOfFunds.provided.card.expiry.year"] = "<#expiration year#>" gateway.updateSession("<#session id#>", apiVersion: <#Gateway API Version#>, payload: request) { (result) in switch result { case .success(let response): print(response.description) case .error(let error): print(error) } } ``` -------------------------------- ### GatewayMap Equatable Conformance Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/docsets/MPGSDK.docset/Contents/Resources/Documents/Structs/GatewayMap.html Indicates that GatewayMap conforms to the Equatable protocol, allowing for equality comparisons between GatewayMap instances. ```apidoc GatewayMap conforms to Equatable. ``` -------------------------------- ### GatewayMap Codable Conformance Source: https://github.com/mastercard-gateway/gateway-ios-sdk/blob/master/docs/docsets/MPGSDK.docset/Contents/Resources/Documents/Structs/GatewayMap.html Indicates that GatewayMap conforms to the Codable protocol, enabling encoding and decoding to/from external representations like JSON. ```apidoc GatewayMap conforms to Codable. ```