Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Fix YaPay
Browse files Browse the repository at this point in the history
  • Loading branch information
a.ignatov committed Apr 25, 2023
1 parent 30ef4f7 commit 51218fc
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 67 deletions.
2 changes: 1 addition & 1 deletion Cloudpayments-SDK-iOS.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Pod::Spec.new do |spec|

spec.name = "Cloudpayments"
spec.version = "1.2.10"
spec.version = "1.2.11"
spec.summary = "Core library that allows you to use internet acquiring from CloudPayments in your app"
spec.description = "Core library that allows you to use internet acquiring from CloudPayments in your app!"

Expand Down
20 changes: 1 addition & 19 deletions demo/demo/ViewControllers/Main/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,27 +99,9 @@ class MainViewController: BaseViewController, UICollectionViewDataSource, UIColl

let product = products[indexPath.item]

// cell.image.sd_cancelCurrentImageLoad()
cell.image.image = nil
cell.activityIndicator.stopAnimating()

// if let image = product.images?.first?.src {
// cell.activityIndicator.startAnimating()
// cell.image.alpha = 0
// /cell.image.sd_setImage(with: URL.init(string: image), placeholderImage: nil, options: .avoidAutoSetImage) { (image, error, cacheType, url) in
// cell.activityIndicator.stopAnimating()
//
// if cacheType == .none {
// cell.image.image = image
// UIView.animate(withDuration: 0.2, animations: {
// cell.image.alpha = 1
// })
// } else {
// cell.image.image = image
// cell.image.alpha = 1
// }
// }
// }


cell.name.text = product.name
cell.price.text = "\(product.price ?? "0") Руб."
Expand Down
2 changes: 1 addition & 1 deletion sdk/Cloudpayments.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Pod::Spec.new do |spec|

spec.name = "Cloudpayments"
spec.version = "1.2.10"
spec.version = "1.2.11"
spec.summary = "Core library that allows you to use internet acquiring from CloudPayments in your app"
spec.description = "Core library that allows you to use internet acquiring from CloudPayments in your app!"

Expand Down
54 changes: 8 additions & 46 deletions sdk/Sources/PaymentForm/PaymentOptionsForm.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class PaymentOptionsForm: PaymentForm, PKPaymentAuthorizationViewControllerDeleg

// Укажите скругления для кнопки (по умолчанию - 8px)
button.layer.cornerRadius = 8

// Установите layout для кнопки
yandexPayContainer.addSubview(button)
button.bindFrameToSuperviewBounds()
Expand Down Expand Up @@ -253,53 +253,15 @@ class PaymentOptionsForm: PaymentForm, PKPaymentAuthorizationViewControllerDeleg
// Оплата была совершена успешно
if let decodedData = Data(base64Encoded: paymentInfo.paymentToken),
let decodedToken = String(data: decodedData, encoding: .utf8) {
if (configuration.useDualMessagePayment) {
self.auth(cardCryptogramPacket: decodedToken, email: nil) { [weak self] status, canceled, transaction, errorMessage in
guard let self = self else {
return
}

let state: PaymentProcessForm.State

if status {
state = .succeeded(self.resultTransaction)
} else {
state = .failed(self.errorMessage)
}
let parent = self.presentingViewController
self.dismiss(animated: true) { [weak self] in
guard let self = self else {
return

let parent = self.presentingViewController
self.dismiss(animated: true) { [weak self] in
guard let self = self else {
return
}
if parent != nil {
PaymentProcessForm.present(with: self.configuration, cryptogram: nil, email: nil, state: state, from: parent!, completion: nil)
}
}
}
} else {
self.charge(cardCryptogramPacket: decodedToken, email: nil) { [weak self] status, canceled, transaction, errorMessage in
guard let self = self else {
return
}

let state: PaymentProcessForm.State

if status {
state = .succeeded(self.resultTransaction)
} else {
state = .failed(self.errorMessage)
}

let parent = self.presentingViewController
self.dismiss(animated: true) { [weak self] in
guard let self = self else {
return
}
if parent != nil {
PaymentProcessForm.present(with: self.configuration, cryptogram: nil, email: nil, state: state, from: parent!, completion: nil)
}
}

if parent != nil {
PaymentProcessForm.present(with: self.configuration, cryptogram: decodedToken, email: nil, state: .inProgress, from: parent!, completion: nil)
}
}
}
Expand Down

0 comments on commit 51218fc

Please sign in to comment.