Skip to content

Commit

Permalink
Update commit
Browse files Browse the repository at this point in the history
  • Loading branch information
platonline committed May 13, 2019
1 parent 6da3691 commit 4642d75
Show file tree
Hide file tree
Showing 15 changed files with 644 additions and 71 deletions.
54 changes: 17 additions & 37 deletions PlatonSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
BEB2EB7D1FC2E57100C93554 /* PlatonSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE450FA91FC2BF3400C2AB35 /* PlatonSDK.framework */; };
BEB2EB7E1FC2E57100C93554 /* PlatonSDK.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BE450FA91FC2BF3400C2AB35 /* PlatonSDK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
BEB2EB811FC2E67C00C93554 /* Alamofire.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BEB2EB821FC2E67C00C93554 /* Alamofire.framework */; };
DB0FB7772212099F008251A7 /* WebTokenSaleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB0FB7762212099F008251A7 /* WebTokenSaleViewController.swift */; };
DB0FB779221211D8008251A7 /* PlatonWebTokenSaleAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB0FB778221211D8008251A7 /* PlatonWebTokenSaleAdapter.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -170,6 +172,8 @@
BE58F9111FC2DB1F0049E828 /* Web.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Web.storyboard; sourceTree = "<group>"; };
BEB2EB821FC2E67C00C93554 /* Alamofire.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Alamofire.framework; sourceTree = BUILT_PRODUCTS_DIR; };
C84D4AFA8800935D39653666 /* Pods-Sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.release.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.release.xcconfig"; sourceTree = "<group>"; };
DB0FB7762212099F008251A7 /* WebTokenSaleViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebTokenSaleViewController.swift; sourceTree = "<group>"; };
DB0FB778221211D8008251A7 /* PlatonWebTokenSaleAdapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlatonWebTokenSaleAdapter.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -270,6 +274,7 @@
BE450FC81FC2C04E00C2AB35 /* PlatonWebRecurringAdapter.swift */,
BE450FC91FC2C04E00C2AB35 /* PlatonWebSaleAdapter.swift */,
BE450FC51FC2C04E00C2AB35 /* PlatonWebScheduleAdapter.swift */,
DB0FB778221211D8008251A7 /* PlatonWebTokenSaleAdapter.swift */,
);
path = Web;
sourceTree = "<group>";
Expand Down Expand Up @@ -393,6 +398,7 @@
BE58F8F71FC2DA5B0049E828 /* WebRecurringSaleViewController.swift */,
BE58F8F51FC2DA5A0049E828 /* WebScheduleViewController.swift */,
BE58F8F61FC2DA5A0049E828 /* WebDescheduleViewController.swift */,
DB0FB7762212099F008251A7 /* WebTokenSaleViewController.swift */,
);
path = Web;
sourceTree = "<group>";
Expand Down Expand Up @@ -454,7 +460,6 @@
BE450FA51FC2BF3400C2AB35 /* Frameworks */,
BE450FA61FC2BF3400C2AB35 /* Headers */,
BE450FA71FC2BF3400C2AB35 /* Resources */,
67C3EAAC396E1BCAF5445C3B /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand All @@ -475,7 +480,6 @@
BE58F8CA1FC2D6F00049E828 /* Resources */,
BEB2EB7C1FC2E41C00C93554 /* Embed Frameworks */,
CB8F9F184E82B5A130919EFA /* [CP] Embed Pods Frameworks */,
8953440FF846CB3A97F609B2 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand All @@ -494,7 +498,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0910;
LastUpgradeCheck = 0910;
LastUpgradeCheck = 1010;
ORGANIZATIONNAME = Devlight;
TargetAttributes = {
BE450FA81FC2BF3400C2AB35 = {
Expand Down Expand Up @@ -550,36 +554,6 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
67C3EAAC396E1BCAF5445C3B /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-PlatonSDK/Pods-PlatonSDK-resources.sh\"\n";
showEnvVarsInLog = 0;
};
8953440FF846CB3A97F609B2 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-resources.sh\"\n";
showEnvVarsInLog = 0;
};
9B3829C8C54CDFDFE61F5DD0 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -658,6 +632,7 @@
BE450FE41FC2C0AF00C2AB35 /* PlatonPayer.swift in Sources */,
BE450FE91FC2C0AF00C2AB35 /* PlatonSaleAdditional.swift in Sources */,
BE450FCA1FC2C04E00C2AB35 /* PlatonWebScheduleAdapter.swift in Sources */,
DB0FB779221211D8008251A7 /* PlatonWebTokenSaleAdapter.swift in Sources */,
BE450FFE1FC2C0F800C2AB35 /* PlatonSDKUtils.swift in Sources */,
BE450FC31FC2C03100C2AB35 /* PlatonCreditVoidAdapter.swift in Sources */,
BE450FD61FC2C07F00C2AB35 /* PlatonSDK.swift in Sources */,
Expand Down Expand Up @@ -701,6 +676,7 @@
BE58F8EC1FC2D9820049E828 /* GetTransDetailsViewController.swift in Sources */,
BE58F9071FC2DAC70049E828 /* WebViewController.swift in Sources */,
BE58F8F21FC2D9820049E828 /* RecurringSaleViewController.swift in Sources */,
DB0FB7772212099F008251A7 /* WebTokenSaleViewController.swift in Sources */,
BE58F8F91FC2DA5B0049E828 /* WebOneClickSaleViewController.swift in Sources */,
BE58F8F01FC2D9820049E828 /* SaleViewController.swift in Sources */,
BE58F8F11FC2D9820049E828 /* CreditVoidViewController.swift in Sources */,
Expand Down Expand Up @@ -751,13 +727,15 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -811,13 +789,15 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -858,7 +838,7 @@
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 2D24MZT59R;
DEVELOPMENT_TEAM = FJTUE7ZT4K;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand All @@ -883,7 +863,7 @@
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 2D24MZT59R;
DEVELOPMENT_TEAM = FJTUE7ZT4K;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand All @@ -906,7 +886,7 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 2D24MZT59R;
DEVELOPMENT_TEAM = FJTUE7ZT4K;
INFOPLIST_FILE = Sample/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand All @@ -924,7 +904,7 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 2D24MZT59R;
DEVELOPMENT_TEAM = FJTUE7ZT4K;
INFOPLIST_FILE = Sample/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand Down
8 changes: 8 additions & 0 deletions PlatonSDK.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
2 changes: 2 additions & 0 deletions PlatonSDK/Adapters/Web/PlatonWebSaleAdapter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ final public class PlatonWebSaleAdapter: PlatonWebBaseAdapter {
public func sale(productSales: [PlatonProductSale]? = nil,
successUrl: String,
orderId: String,
req_token: String,
payerWebSale: PlatonPayerWebSale? = nil,
additional: PlatonWebSaleAdditional,
completion: PlatonWebCalback = nil) {
Expand All @@ -32,6 +33,7 @@ final public class PlatonWebSaleAdapter: PlatonWebBaseAdapter {
let otherParams: PlatonParams = [PlatonMethodProperty.payment: payment,
PlatonMethodProperty.url: successUrl,
PlatonMethodProperty.order: orderId,
PlatonMethodProperty.req_token: req_token,
PlatonMethodProperty.data: data,
PlatonMethodProperty.sign: hash]

Expand Down
55 changes: 55 additions & 0 deletions PlatonSDK/Adapters/Web/PlatonWebTokenSaleAdapter.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//
// PlatonWebTokenSaleAdapter.swift
// PlatonSDK
//
// Copyright © 2019 Devlight. All rights reserved.
//


import Alamofire

/// API adapter for creating SALE transaction in web payments platform
final public class PlatonWebTokenSaleAdapter: PlatonWebBaseAdapter {

/// Following requests creates SALE transaction in payment platform
///
/// It is used for authorization and capture at a time
///
/// This operation is used for immediate web payments
///
/// - Parameters:
/// - productSales: list of products for sale transaction
/// - successUrl: url by which you proceed after successful payment
/// - orderId: order id in payment system
/// - payerWebSale: info holder of payer
/// - additional: options to control web form representation
/// - completion: callback which will hold Alamofire Requesr Data which has url for web request
public func tokenSale(productSales: [PlatonProductSale]? = nil,
successUrl: String,
cardToken: String,
payerWebSale: PlatonPayerWebSale? = nil,
additional: PlatonWebTokenSaleAdditional,
completion: PlatonWebCalback = nil) {

let payment = PlatonWebPaymentType.CCT.rawValue
let data = PlatonBase64Utils.encodeToken(products: productSales)
let hash = PlatonHashUtils.encryptSaleTokenWeb(payment: payment,
data: data,
successUrl: successUrl,
cardToken: cardToken)
let otherParams: PlatonParams = [PlatonMethodProperty.payment: payment,
PlatonMethodProperty.url: successUrl,
PlatonMethodProperty.card_token: cardToken,
PlatonMethodProperty.data: data,
PlatonMethodProperty.sign: hash]

let params: [PlatonParametersProtocol?] = [
payerWebSale,
additional,
otherParams
]

procesedWebRequest(parameters: params, completion: completion)
}
}

4 changes: 4 additions & 0 deletions PlatonSDK/Constants/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public enum PlatonMethodAction: String, Decodable, PlatonParametersProtocol {
case getTransStatus = "GET_TRANS_STATUS"
case recurringSale = "RECURRING_SALE"
case sale = "SALE"
case tokenSale = "TOKEN_SALE"
case schedule = "SCHEDULE"
case secondChargeback = "SECOND_CHARGEBACK"
case secondPresentment = "SECOND_PRESENTMENT"
Expand Down Expand Up @@ -147,6 +148,7 @@ public enum PlatonMethodProperty: String, Decodable {
case lastName = "last_name"
case md = "MD"
case order = "order"
case req_token = "req_token"
case orderAmount = "order_amount"
case orderCurrency = "order_currency"
case orderDescription = "order_description"
Expand Down Expand Up @@ -180,6 +182,7 @@ public enum PlatonMethodProperty: String, Decodable {
case transId = "trans_id"
case url = "url"
case zip = "zip"
case card_token = "card_token"
}

/// Used as convenient variable while creating different requests
Expand Down Expand Up @@ -297,4 +300,5 @@ public enum PlatonHTTPMethod: String, Decodable {
public enum PlatonWebPaymentType: String {
case CC = "CC"
case RF = "RF"
case CCT = "CCT"
}
6 changes: 6 additions & 0 deletions PlatonSDK/Core/PlatonSDK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ final public class PlatonPostPayment {
/// Aadapter for *PlatonMethodAction.sale* request
public static let sale = PlatonSaleAdapter()

/// Aadapter for *PlatonMethodAction.sale* request
public static let tokenSale = PlatonWebTokenSaleAdapter()

/// Adapter for *PlatonMethodAction.capture* request
public static let capture = PlatonCaptureAdapter()

Expand Down Expand Up @@ -152,6 +155,9 @@ final public class PlatonWebPayment {
/// Adapter for web sale requests
public static let sale = PlatonWebSaleAdapter()

/// Adapter for web token sale requests
public static let tokenSale = PlatonWebTokenSaleAdapter()

/// Adapter for web recurring sale requests
public static let oneClickSale = PlatonWebOneClickSaleAdapter()

Expand Down
57 changes: 57 additions & 0 deletions PlatonSDK/Models/Request/PlatonSaleAdditional.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ protocol PlatonWebAdditionalProtocol {
var ext4: String? { get set }
}

protocol PlatonWebTokenAdditionalProtocol {
var card_token: String? { get set }
var ext2: String? { get set }
var ext3: String? { get set }
var ext4: String? { get set }
}

/// Sale options for Single Message System (SMS) or Dual Message System (DMS) (*PlatonMethodAction.sale*)
public struct PlatonSaleAdditional: PlatonParametersProtocol {

Expand Down Expand Up @@ -127,4 +134,54 @@ public struct PlatonWebSaleAdditional: PlatonParametersProtocol, PlatonWebAdditi

}

/// This class extends *PlatonWebOptions* and provide some new fields which handle representation of requests from *PlatonWebSaleAdapter*
public struct PlatonWebTokenSaleAdditional: PlatonParametersProtocol, PlatonWebTokenAdditionalProtocol {

/// Localization language to be selected on the payment page by default
var language: String?

/// Optional URL to which the Buyer will be returned after three unsuccessful purchase attempts
var errorUrl: String?

/// Specific payment page identifier for web payments
///
/// (In case the Client's account has multiple payment pages configured)
var formId: String?

/// Client Parameter 1
var card_token: String?

/// Client Parameter 2
var ext2: String?

/// Client Parameter 3
var ext3: String?

/// Client Parameter 4
var ext4: String?

public var platonParams: PlatonParams {
return [
PlatonMethodProperty.lang: language,
PlatonMethodProperty.errorUrl: errorUrl,
PlatonMethodProperty.formId: formId,
PlatonMethodProperty.card_token: card_token,
PlatonMethodProperty.ext2: ext2,
PlatonMethodProperty.ext3: ext3,
PlatonMethodProperty.ext4: ext4,
]
}

public init(language: String?, errorUrl: String?, formId: String?, card_token: String?, ext2: String?, ext3: String?, ext4: String?) {
self.language = language
self.errorUrl = errorUrl
self.formId = formId
self.card_token = card_token
self.ext2 = ext2
self.ext3 = ext3
self.ext4 = ext4
}
}



Loading

0 comments on commit 4642d75

Please sign in to comment.