Skip to content

Commit

Permalink
Merge branch 'main' into wrap-deprecated-property
Browse files Browse the repository at this point in the history
  • Loading branch information
scannillo authored Nov 6, 2023
2 parents 74deccf + eabc83b commit b904031
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* BraintreeThreeDSecure
* Add `cardAddChallengeRequested` to `BTThreeDSecureRequest`
* Deprecate `BTThreeDSecureRequest.cardAddChallenge`
* BraintreeCard
* Deprecate unused `BTCardRequest` class

## 5.24.0 (2023-10-30)
* BraintreePayPalDataCollector
Expand Down
12 changes: 7 additions & 5 deletions SampleApps/CarthageTest/CarthageTest.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 52;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -287,12 +287,12 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand Down Expand Up @@ -339,12 +339,12 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand All @@ -360,6 +360,7 @@
"$(PROJECT_DIR)",
);
INFOPLIST_FILE = CarthageTest/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -381,6 +382,7 @@
"$(PROJECT_DIR)",
);
INFOPLIST_FILE = CarthageTest/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
15 changes: 7 additions & 8 deletions Sources/BraintreeCard/BTCardClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import BraintreeCore
@objc(tokenizeCard:completion:)
public func tokenize(_ card: BTCard, completion: @escaping (BTCardNonce?, Error?) -> Void) {
apiClient.sendAnalyticsEvent(BTCardAnalytics.cardTokenizeStarted)
let request = BTCardRequest(card: card)

apiClient.fetchOrReturnRemoteConfiguration() { configuration, error in
if let error {
Expand All @@ -47,12 +46,12 @@ import BraintreeCore
}

if self.isGraphQLEnabled(for: configuration) {
if request.card.authenticationInsightRequested && request.card.merchantAccountID == nil {
if card.authenticationInsightRequested && card.merchantAccountID == nil {
self.notifyFailure(with: BTCardError.integration, completion: completion)
return
}

let parameters = request.card.graphQLParameters()
let parameters = card.graphQLParameters()

self.apiClient.post("", parameters: parameters, httpType: .graphQLAPI) { body, _, error in
if let error = error as NSError? {
Expand Down Expand Up @@ -80,7 +79,7 @@ import BraintreeCore
return
}
} else {
let parameters = self.clientAPIParameters(for: request)
let parameters = self.clientAPIParameters(for: card)

self.apiClient.post("v1/payment_methods/credit_cards", parameters: parameters) {body, _, error in
if let error = error as NSError? {
Expand Down Expand Up @@ -137,9 +136,9 @@ import BraintreeCore
return false
}

private func clientAPIParameters(for request: BTCardRequest) -> [String: Any] {
private func clientAPIParameters(for card: BTCard) -> [String: Any] {
var parameters: [String: Any] = [:]
parameters["credit_card"] = request.card.parameters()
parameters["credit_card"] = card.parameters()

let metadata: [String: String] = [
"source": apiClient.metadata.source.stringValue,
Expand All @@ -149,9 +148,9 @@ import BraintreeCore

parameters["_meta"] = metadata

if request.card.authenticationInsightRequested {
if card.authenticationInsightRequested {
parameters["authenticationInsight"] = true
parameters["merchantAccountId"] = request.card.merchantAccountID
parameters["merchantAccountId"] = card.merchantAccountID
}

return parameters
Expand Down
2 changes: 2 additions & 0 deletions Sources/BraintreeCard/BTCardRequest.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import Foundation

/// Contains information about a card to tokenize
// TODO: - NEXT_MAJOR_VERSION remove this class
@available(*, deprecated, message: "Use BTCard directly instead")
@objcMembers public class BTCardRequest: NSObject {

/// The `BTCard` associated with this instance.
Expand Down

0 comments on commit b904031

Please sign in to comment.