Skip to content

Commit

Permalink
Merge branch 'main' into fix/update-how-frames-options-are-sent-to-ri…
Browse files Browse the repository at this point in the history
…sk-sdk
  • Loading branch information
precious-ossai-cko authored Apr 25, 2024
2 parents 8cf4c57 + 1b5505b commit ad55bf5
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 15 deletions.
9 changes: 9 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.

#### 4.x Releases

## [4.3.4](https://github.com/checkout/frames-ios/releases/tag/4.3.4)

Released on 2024-04-17

Updates:

- Small internal logging data structure alteration. No public or breaking changes.


## [4.3.3](https://github.com/checkout/frames-ios/releases/tag/4.3.3)

Released on 2024-04-04
Expand Down
2 changes: 1 addition & 1 deletion Checkout.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Checkout'
s.version = '4.3.3'
s.version = '4.3.4'
s.summary = 'Checkout SDK for iOS'

s.description = <<-DESC
Expand Down
2 changes: 1 addition & 1 deletion Checkout/Samples/CocoapodsSample/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ target 'CheckoutCocoapodsSample' do
use_frameworks!

# Pods for CheckoutSDKCocoapodsSample
pod 'Checkout', '4.3.3'
pod 'Checkout', '4.3.4'

end
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@
repositoryURL = "https://github.com/checkout/frames-ios";
requirement = {
kind = exactVersion;
version = 4.3.3;
version = 4.3.4;
};
};
/* End XCRemoteSwiftPackageReference section */
Expand Down
16 changes: 10 additions & 6 deletions Checkout/Source/Tokenisation/CheckoutAPIService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ final public class CheckoutAPIService: CheckoutAPIProtocol {
tokenType: tokenRequest.type,
publicKey: publicKey
)))
createToken(requestParameters: requestParameters, completion: completion)
createToken(requestParameters: requestParameters, paymentType: tokenRequest.type, completion: completion)
case .failure(let error):
switch error {
case .baseURLCouldNotBeConvertedToComponents, .couldNotBuildURL:
Expand All @@ -145,13 +145,15 @@ final public class CheckoutAPIService: CheckoutAPIProtocol {
}
}

private func createToken(requestParameters: NetworkManager.RequestParameters, completion: @escaping (Result<TokenDetails, TokenisationError.TokenRequest>) -> Void) {
private func createToken(requestParameters: NetworkManager.RequestParameters,
paymentType: TokenRequest.TokenType,
completion: @escaping (Result<TokenDetails, TokenisationError.TokenRequest>) -> Void) {
requestExecutor.execute(
requestParameters,
responseType: TokenResponse.self,
responseErrorType: TokenisationError.ServerError.self
) { [weak self, tokenDetailsFactory, logManager, logTokenResponse] tokenResponseResult, httpURLResponse in
logTokenResponse(tokenResponseResult, httpURLResponse)
logTokenResponse(tokenResponseResult, paymentType, httpURLResponse)

switch tokenResponseResult {
case .response(let tokenResponse):
Expand All @@ -177,10 +179,12 @@ final public class CheckoutAPIService: CheckoutAPIProtocol {
}
}

private func logTokenResponse(tokenResponseResult: NetworkRequestResult<TokenResponse, TokenisationError.ServerError>, httpURLResponse: HTTPURLResponse?) {
private func logTokenResponse(tokenResponseResult: NetworkRequestResult<TokenResponse, TokenisationError.ServerError>,
paymentType: TokenRequest.TokenType,
httpURLResponse: HTTPURLResponse?) {
switch tokenResponseResult {
case .response(let tokenResponse):
let tokenRequestData = CheckoutLogEvent.TokenRequestData(tokenType: tokenResponse.type, publicKey: publicKey)
let tokenRequestData = CheckoutLogEvent.TokenRequestData(tokenType: paymentType, publicKey: publicKey)
let tokenResponseData = CheckoutLogEvent.TokenResponseData(
tokenID: tokenResponse.token,
scheme: tokenResponse.scheme,
Expand All @@ -190,7 +194,7 @@ final public class CheckoutAPIService: CheckoutAPIProtocol {

logManager.queue(event: .tokenResponse(tokenRequestData, tokenResponseData))
case .errorResponse(let errorResponse):
let tokenRequestData = CheckoutLogEvent.TokenRequestData(tokenType: nil, publicKey: publicKey)
let tokenRequestData = CheckoutLogEvent.TokenRequestData(tokenType: paymentType, publicKey: publicKey)
let tokenResponseData = CheckoutLogEvent.TokenResponseData(
tokenID: nil,
scheme: nil,
Expand Down
4 changes: 2 additions & 2 deletions CheckoutTests/Tokenisation/CheckoutAPIServiceTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ final class CheckoutAPIServiceTests: XCTestCase {
XCTAssertEqual(result, .failure(.couldNotBuildURLForRequest))
}

func test_createToken_failure_serverError() {
func test_createToken_failure_card_payment_serverError() {
let card = StubProvider.createCard()
let tokenRequest = StubProvider.createTokenRequest()
let requestParameters = StubProvider.createRequestParameters()
Expand All @@ -148,7 +148,7 @@ final class CheckoutAPIServiceTests: XCTestCase {
stubRequestExecutor.executeCalledWithCompletion?(.errorResponse(serverError), HTTPURLResponse())

XCTAssertEqual(StubLogManager.queueCalledWith.last, .tokenResponse(
.init(tokenType: nil, publicKey: "publicKey"),
.init(tokenType: .card, publicKey: "publicKey"),
.init(
tokenID: nil,
scheme: nil,
Expand Down
4 changes: 2 additions & 2 deletions Frames.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Frames"
s.version = "4.3.3"
s.version = "4.3.4"
s.summary = "Checkout API Client, Payment Form UI and Utilities in Swift"
s.description = <<-DESC
Checkout API Client and Payment Form Utilities in Swift.
Expand All @@ -21,6 +21,6 @@ Pod::Spec.new do |s|

s.dependency 'PhoneNumberKit'
s.dependency 'CheckoutEventLoggerKit', '~> 1.2.4'
s.dependency 'Checkout', '4.3.3'
s.dependency 'Checkout', '4.3.4'

end
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,7 @@
repositoryURL = "https://github.com/checkout/frames-ios";
requirement = {
kind = exactVersion;
version = 4.3.3;
version = 4.3.4;
};
};
16C3F83E2A7927ED00690639 /* XCRemoteSwiftPackageReference "swift-snapshot-testing" */ = {
Expand Down
2 changes: 1 addition & 1 deletion iOS Example Frame/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ target 'iOS Example Frame' do
use_frameworks!

# Pods for iOS Example Custom
pod 'Frames', '4.3.3'
pod 'Frames', '4.3.4'

end

Expand Down

0 comments on commit ad55bf5

Please sign in to comment.