Skip to content

Commit

Permalink
Rename authorizedURL to authorizeURL
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei Solovev committed Mar 13, 2024
1 parent b03b87f commit 7b19f49
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions ExampleApp/Views/ProductDetailViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ProductDetailViewController: BaseViewController {

@IBAction private func handlingAuthorizingPayment(_ sender: UIBarButtonItem) {
let alertController = UIAlertController(title: "Authorizing Payment",
message: "Please input your given authorized URL",
message: "Please input your given authorize URL",
preferredStyle: .alert)
alertController.addTextField(configurationHandler: nil)
alertController.addAction(UIAlertAction(title: "Cancel", style: UIAlertAction.Style.cancel, handler: nil))
Expand All @@ -59,7 +59,7 @@ class ProductDetailViewController: BaseViewController {

self.omiseSDK.presentAuthorizedController(
from: self,
authorizedURL: url,
authorizeURL: url,
expectedReturnURLPatterns: [expectedReturnURL],
delegate: self
)
Expand Down
6 changes: 3 additions & 3 deletions OmiseSDK/Sources/OmiseSDK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -157,21 +157,21 @@ public class OmiseSDK {
/// - Parameters:
/// - from: ViewController is used to present Choose Payment Methods
/// - animated: Presents controller with animation if `true`
/// - authorizedURL: The authorized URL given in `Charge` object
/// - authorizeURL: The authorize URL given in `Charge` object
/// - expectedReturnURLPatterns: The expected return URL patterns.
/// - delegate: A delegate object that will recieved authorizing payment events.
@available(iOSApplicationExtension, unavailable)
public func presentAuthorizedController(
from topViewController: UIViewController,
animated: Bool = true,
authorizedURL: URL,
authorizeURL: URL,
expectedReturnURLPatterns: [URLComponents],
delegate: AuthorizingPaymentViewControllerDelegate
) {
dismiss(animated: false)

let viewController = AuthorizingPaymentViewController(nibName: nil, bundle: .omiseSDK)
viewController.authorizedURL = authorizedURL
viewController.authorizeURL = authorizeURL
viewController.expectedReturnURLPatterns = expectedReturnURLPatterns
viewController.delegate = delegate
viewController.applyNavigationBarStyle()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public protocol AuthorizingPaymentViewControllerDelegate: AnyObject {
*/
@available(iOSApplicationExtension, unavailable)
public class AuthorizingPaymentViewController: UIViewController {
/// Authorized URL given from Omise in the created `Charge` object.
var authorizedURL: URL? {
/// Authorize URL given from Omise in the created `Charge` object.
var authorizeURL: URL? {
didSet {
guard isViewLoaded else {
return
Expand Down Expand Up @@ -82,14 +82,14 @@ public class AuthorizingPaymentViewController: UIViewController {
}

private func startAuthorizingPaymentProcess() {
guard let authorizedURL = authorizedURL, !expectedReturnURLPatterns.isEmpty else {
guard let authorizeURL = authorizeURL, !expectedReturnURLPatterns.isEmpty else {
assertionFailure("Insufficient authorizing payment information")
os_log("Refusing to initialize sdk client with a non-public key: %{private}@", log: uiLogObject, type: .error)
return
}

os_log("Starting the authorizing process with %{private}@ URL", log: uiLogObject, type: .info, authorizedURL.absoluteString)
let request = URLRequest(url: authorizedURL, cachePolicy: .reloadIgnoringLocalAndRemoteCacheData, timeoutInterval: 60.0)
os_log("Starting the authorizing process with %{private}@ URL", log: uiLogObject, type: .info, authorizeURL.absoluteString)
let request = URLRequest(url: authorizeURL, cachePolicy: .reloadIgnoringLocalAndRemoteCacheData, timeoutInterval: 60.0)
webView.load(request)
}

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,19 +331,19 @@ extension ProductDetailViewController: ChoosePaymentMethodDelegate {

### Authorizing payment

Some payment methods require customers to authorize the payment uaing an authorized URL. This includes [3-D Secure verification](https://docs.opn.ooo/fraud-protection#3-d-secure), [Internet Banking payment](https://docs.opn.ooo/internet-banking), and [Alipay](https://docs.opn.ooo/alipay). The Opn Payments iOS SDK provides a built-in class to authorize payments.
Some payment methods require customers to authorize the payment using an authorize URL. This includes [3-D Secure verification](https://docs.opn.ooo/fraud-protection#3-d-secure), [Internet Banking payment](https://docs.opn.ooo/internet-banking), and [Alipay](https://docs.opn.ooo/alipay). The Opn Payments iOS SDK provides a built-in class to authorize payments.

On payment methods that require opening the external application (e.g., mobile banking application) to authorize the transaction, set the *return_uri* to a **deep link** or **app link** to be able to open the merchant application. Otherwise, after the cardholder authorizes the transaction on the external application, the flow redirects to the normal link in the *return_uri*, and opens it on the browser application, resulting in the payment not being completed.

#### Using built-in authorizing payment view controller

You can use the built-in authorizing payment view controller with the `authorized URL` provided with the charge and expected `return URL` patterns you create.
You can use the built-in authorizing payment view controller with the `authorizeURL` provided with the charge and expected `return URL` patterns you create.

```swift

omiseSDK.presentAuthorizedController(
from: self,
authorizedURL: url,
authorizeURL: url,
expectedReturnURLPatterns: [expectedReturnURL],
delegate: self
)
Expand Down

0 comments on commit 7b19f49

Please sign in to comment.