Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
okhan-okbay-cko committed Oct 26, 2023
1 parent 2067a7d commit 5ccc783
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 20 deletions.
6 changes: 6 additions & 0 deletions Source/UI/SecurityCodeComponent/SecurityCodeComponent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ public final class SecurityCodeComponent: UIView {
}

extension SecurityCodeComponent {
/**
Method to configure SecurityCodeComponent and get the validation updates
- configuration: See SecurityCodeComponentConfiguration documentation for the details
- isSecurityCodeValid: A boolean value that indicates if the security code that was input by the user is valid or not.
If a cardScheme is passed in the configuration, validation is being evaluated for the scheme. If no cardScheme is passed, then the security code is considered as valid for 3 and 4 digits.
*/
public func configure(with configuration: SecurityCodeComponentConfiguration,
isSecurityCodeValid: @escaping (Bool) -> Void) {
self.configuration = configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Checkout
import UIKit

/**
Lets you configure and style the SecurityCodeComponent
Configures and styles the SecurityCodeComponent

- apiKey: The API Key you receive from checkout.com
- environment: Production or sandbox
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
16857B7E2A65F3F3005CAE39 /* XCUIApplication+TestHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 16857B7D2A65F3F3005CAE39 /* XCUIApplication+TestHelpers.swift */; };
168CEC952AC5C71700BB52B0 /* SecurityCodeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 168CEC942AC5C71700BB52B0 /* SecurityCodeViewController.swift */; };
16900D442AE6BA38009A7CE9 /* SecurityCodeComponentUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 16900D432AE6BA38009A7CE9 /* SecurityCodeComponentUITests.swift */; };
16900D522AE7508C009A7CE9 /* Frames in Frameworks */ = {isa = PBXBuildFile; productRef = 16900D512AE7508C009A7CE9 /* Frames */; };
16900D542AE7C021009A7CE9 /* Frames in Frameworks */ = {isa = PBXBuildFile; productRef = 16900D532AE7C021009A7CE9 /* Frames */; };
16900D562AE7C025009A7CE9 /* Frames in Frameworks */ = {isa = PBXBuildFile; productRef = 16900D552AE7C025009A7CE9 /* Frames */; };
16900D602AE96752009A7CE9 /* Frames in Frameworks */ = {isa = PBXBuildFile; productRef = 16900D5F2AE96752009A7CE9 /* Frames */; };
16900D622AE96759009A7CE9 /* Frames in Frameworks */ = {isa = PBXBuildFile; productRef = 16900D612AE96759009A7CE9 /* Frames */; };
16900D642AE9675D009A7CE9 /* Frames in Frameworks */ = {isa = PBXBuildFile; productRef = 16900D632AE9675D009A7CE9 /* Frames */; };
169DF1482A7BFB1B00891DF0 /* CardSchemeFormatSnapshotTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 169DF1472A7BFB1B00891DF0 /* CardSchemeFormatSnapshotTests.swift */; };
16C3F8402A7927ED00690639 /* SnapshotTesting in Frameworks */ = {isa = PBXBuildFile; productRef = 16C3F83F2A7927ED00690639 /* SnapshotTesting */; };
16C3F8422A7956EA00690639 /* CardValidationSnapshotTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 16C3F8412A7956EA00690639 /* CardValidationSnapshotTests.swift */; };
Expand Down Expand Up @@ -208,7 +208,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
16900D562AE7C025009A7CE9 /* Frames in Frameworks */,
16900D642AE9675D009A7CE9 /* Frames in Frameworks */,
16C3F8402A7927ED00690639 /* SnapshotTesting in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -217,15 +217,15 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
16900D542AE7C021009A7CE9 /* Frames in Frameworks */,
16900D622AE96759009A7CE9 /* Frames in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
E6646F8720CE6C0900D8353A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
16900D522AE7508C009A7CE9 /* Frames in Frameworks */,
16900D602AE96752009A7CE9 /* Frames in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -476,7 +476,7 @@
name = "iOS Example Frame Regression Tests";
packageProductDependencies = (
16C3F83F2A7927ED00690639 /* SnapshotTesting */,
16900D552AE7C025009A7CE9 /* Frames */,
16900D632AE9675D009A7CE9 /* Frames */,
);
productName = "iOS Example Frame Regression Tests";
productReference = 16857B712A65F15F005CAE39 /* iOS Example Frame Regression Tests.xctest */;
Expand All @@ -497,7 +497,7 @@
);
name = "iOS Example FrameUITests";
packageProductDependencies = (
16900D532AE7C021009A7CE9 /* Frames */,
16900D612AE96759009A7CE9 /* Frames */,
);
productName = "iOS Example FrameUITests";
productReference = 16AE74C42A5C1EBB0031F794 /* iOS Example FrameUITests.xctest */;
Expand All @@ -517,7 +517,7 @@
);
name = "iOS Example Frame";
packageProductDependencies = (
16900D512AE7508C009A7CE9 /* Frames */,
16900D5F2AE96752009A7CE9 /* Frames */,
);
productName = "iOS Example Frame";
productReference = 16AE74C32A5C1EBB0031F794 /* iOS Example Frame.app */;
Expand Down Expand Up @@ -566,7 +566,7 @@
mainGroup = E6646F8120CE6C0900D8353A;
packageReferences = (
16C3F83E2A7927ED00690639 /* XCRemoteSwiftPackageReference "swift-snapshot-testing" */,
16900D502AE7508C009A7CE9 /* XCRemoteSwiftPackageReference "frames-ios" */,
16900D5E2AE96752009A7CE9 /* XCRemoteSwiftPackageReference "frames-ios" */,
);
productRefGroup = E6646F8120CE6C0900D8353A;
projectDirPath = "";
Expand Down Expand Up @@ -1219,7 +1219,7 @@
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
16900D502AE7508C009A7CE9 /* XCRemoteSwiftPackageReference "frames-ios" */ = {
16900D5E2AE96752009A7CE9 /* XCRemoteSwiftPackageReference "frames-ios" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/checkout/frames-ios";
requirement = {
Expand All @@ -1238,19 +1238,19 @@
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
16900D512AE7508C009A7CE9 /* Frames */ = {
16900D5F2AE96752009A7CE9 /* Frames */ = {
isa = XCSwiftPackageProductDependency;
package = 16900D502AE7508C009A7CE9 /* XCRemoteSwiftPackageReference "frames-ios" */;
package = 16900D5E2AE96752009A7CE9 /* XCRemoteSwiftPackageReference "frames-ios" */;
productName = Frames;
};
16900D532AE7C021009A7CE9 /* Frames */ = {
16900D612AE96759009A7CE9 /* Frames */ = {
isa = XCSwiftPackageProductDependency;
package = 16900D502AE7508C009A7CE9 /* XCRemoteSwiftPackageReference "frames-ios" */;
package = 16900D5E2AE96752009A7CE9 /* XCRemoteSwiftPackageReference "frames-ios" */;
productName = Frames;
};
16900D552AE7C025009A7CE9 /* Frames */ = {
16900D632AE9675D009A7CE9 /* Frames */ = {
isa = XCSwiftPackageProductDependency;
package = 16900D502AE7508C009A7CE9 /* XCRemoteSwiftPackageReference "frames-ios" */;
package = 16900D5E2AE96752009A7CE9 /* XCRemoteSwiftPackageReference "frames-ios" */;
productName = Frames;
};
16C3F83F2A7927ED00690639 /* SnapshotTesting */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ final class SecurityCodeViewController: UIViewController {
configuration.cardScheme = Card.Scheme(rawValue: "VISA")

defaultSecurityCodeComponent.configure(with: configuration) { [weak self] isSecurityCodeValid in
self?.defaultPayButton.isEnabled = isSecurityCodeValid
DispatchQueue.main.async {
self?.defaultPayButton.isEnabled = isSecurityCodeValid
}
}
}

Expand All @@ -45,7 +47,9 @@ final class SecurityCodeViewController: UIViewController {
customSecurityCodeComponent.layer.cornerRadius = 8

customSecurityCodeComponent.configure(with: configuration) { [weak self] isSecurityCodeValid in
self?.customPayButton.isEnabled = isSecurityCodeValid
DispatchQueue.main.async {
self?.customPayButton.isEnabled = isSecurityCodeValid
}
}
}

Expand Down

0 comments on commit 5ccc783

Please sign in to comment.