forked from platonline/platon_ios_sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6da3691
commit 4642d75
Showing
15 changed files
with
644 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.