Skip to content

Commit

Permalink
Merge pull request #451 from checkout/hotifx/rename-paymentviewcontro…
Browse files Browse the repository at this point in the history
…ller

Rename PaymentViewController
  • Loading branch information
okhan-okbay-cko authored Aug 25, 2023
2 parents 65c2f97 + cfccc83 commit 26fde07
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Source/UI/PaymentForm/Factory/PaymentFormFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public enum PaymentFormFactory {
supportedSchemes: configuration.supportedSchemes)
viewModel.preventDuplicateCardholderInput()

let viewController = PaymentViewController(viewModel: viewModel)
let viewController = FramesPaymentViewController(viewModel: viewModel)
viewModel.cardTokenRequested = completionHandler
logger.log(.paymentFormInitialised(environment: configuration.environment))
if #available(iOS 13.0, *) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ protocol PaymentViewControllerDelegate: AnyObject {
}

// swiftlint:disable file_length
final class PaymentViewController: UIViewController {
final class FramesPaymentViewController: UIViewController {

// MARK: - Variables

Expand Down Expand Up @@ -173,7 +173,7 @@ final class PaymentViewController: UIViewController {

// MARK: View Model Integration

extension PaymentViewController {
extension FramesPaymentViewController {
private func setupViewModel() {
delegate = self.viewModel as? PaymentViewControllerDelegate
updateBackgroundViews()
Expand Down Expand Up @@ -323,7 +323,7 @@ extension PaymentViewController {

// MARK: Setup Views

extension PaymentViewController {
extension FramesPaymentViewController {
private func setupViewsInOrder() {
setupScrollView()
setupStackView()
Expand Down Expand Up @@ -387,43 +387,43 @@ extension PaymentViewController {
}
}

extension PaymentViewController: SelectionButtonViewDelegate {
extension FramesPaymentViewController: SelectionButtonViewDelegate {
func selectionButtonIsPressed() {
delegate?.addBillingButtonIsPressed(sender: navigationController)
}
}

extension PaymentViewController: BillingFormSummaryViewDelegate {
extension FramesPaymentViewController: BillingFormSummaryViewDelegate {
func summaryButtonIsPressed() {
delegate?.editBillingButtonIsPressed(sender: navigationController)
}
}

extension PaymentViewController: ExpiryDateViewDelegate {
extension FramesPaymentViewController: ExpiryDateViewDelegate {
func update(result: Result<ExpiryDate, ValidationError.ExpiryDate>) {
delegate?.expiryDateIsUpdated(result: result)
}
}

extension PaymentViewController: CardholderDelegate {
extension FramesPaymentViewController: CardholderDelegate {
func cardholderUpdated(to cardholderInput: String) {
delegate?.cardholderIsUpdated(value: cardholderInput)
}
}

extension PaymentViewController: SecurityCodeViewDelegate {
extension FramesPaymentViewController: SecurityCodeViewDelegate {
func update(securityCode: String) {
delegate?.securityCodeIsUpdated(to: securityCode)
}
}

extension PaymentViewController: ButtonViewDelegate {
extension FramesPaymentViewController: ButtonViewDelegate {
func selectionButtonIsPressed(sender: UIView) {
delegate?.payButtonIsPressed()
}
}

extension PaymentViewController: UIScrollViewDelegate {
extension FramesPaymentViewController: UIScrollViewDelegate {
func scrollViewDidScroll(_ scrollView: UIScrollView) {
let contentOffsetY = scrollView.contentOffset.y + scrollView.adjustedContentInset.top

Expand Down
2 changes: 1 addition & 1 deletion Tests/UI/Factory/FramesFactoryTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class FramesFactoryTests: XCTestCase {
let formConfig = PaymentFormConfiguration(apiKey: "", environment: .sandbox, supportedSchemes: [.visa], billingFormData: billingForm)
let formStyle = PaymentStyle(paymentFormStyle: paymentFormStyle, billingFormStyle: billingFormStyle)
let viewController = PaymentFormFactory.buildViewController(configuration: formConfig, style: formStyle) { _ in }
let paymentViewController = try XCTUnwrap(viewController as? PaymentViewController)
let paymentViewController = try XCTUnwrap(viewController as? FramesPaymentViewController)
let viewModel = try XCTUnwrap(paymentViewController.viewModel)

XCTAssertNotNil(paymentViewController.viewModel)
Expand Down
8 changes: 4 additions & 4 deletions Tests/UI/PaymentForm/PaymentViewControllerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Checkout
@testable import Frames

class PaymentViewControllerTests: XCTestCase {
var viewController: PaymentViewController!
var viewController: FramesPaymentViewController!
var viewModel: DefaultPaymentViewModel!
let delegate = PaymentViewControllerMockDelegate()
let stubCheckoutAPIService = StubCheckoutAPIService()
Expand All @@ -34,7 +34,7 @@ class PaymentViewControllerTests: XCTestCase {
paymentFormStyle: DefaultPaymentFormStyle(),
billingFormStyle: DefaultBillingFormStyle(),
supportedSchemes: [.discover, .mada])
viewController = PaymentViewController(viewModel: viewModel)
viewController = FramesPaymentViewController(viewModel: viewModel)
}

func testPaymentViewsHierarchy() {
Expand Down Expand Up @@ -155,7 +155,7 @@ class PaymentViewControllerTests: XCTestCase {
paymentFormStyle: nil,
billingFormStyle: nil,
supportedSchemes: [])
let testVC = PaymentViewController(viewModel: testViewModel)
let testVC = FramesPaymentViewController(viewModel: testViewModel)

let expect = expectation(description: "Free up main thread in case UI work influences outcome")
testVC.viewDidLoad()
Expand Down Expand Up @@ -183,7 +183,7 @@ class PaymentViewControllerTests: XCTestCase {
paymentFormStyle: nil,
billingFormStyle: nil,
supportedSchemes: [])
let testVC = PaymentViewController(viewModel: testViewModel)
let testVC = FramesPaymentViewController(viewModel: testViewModel)

XCTAssertTrue(testLogger.addCalledWithMetadataPairs.isEmpty)
XCTAssertTrue(testLogger.logCalledWithFramesLogEvents.isEmpty)
Expand Down

0 comments on commit 26fde07

Please sign in to comment.