Skip to content

Commit

Permalink
[OPEN DEV] Add Swiftlint to BraintreeApplePay (#1366)
Browse files Browse the repository at this point in the history
* Add BraintreeApplePay module to .swiftlint.yml
* Address all swiftlint violations in BraintreeApplePay
  • Loading branch information
jaxdesmarais authored Jul 16, 2024
1 parent 10a0254 commit 64afdc8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

# Paths to include in lint
included:
- Sources/BraintreeCore
- Sources/BraintreeAmericanExpress
- Sources/BraintreeApplePay
- Sources/BraintreeCore

excluded:
- Sources/BraintreeCore/BTAPIPinnedCertificates.swift
Expand Down
4 changes: 2 additions & 2 deletions Sources/BraintreeApplePay/BTApplePayClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import BraintreeCore
/// - Throws: An `Error` describing the failure
public func makePaymentRequest() async throws -> PKPaymentRequest {
try await withCheckedThrowingContinuation { continuation in
makePaymentRequest() { paymentRequest, error in
makePaymentRequest { paymentRequest, error in
if let error {
continuation.resume(throwing: error)
} else if let paymentRequest {
Expand Down Expand Up @@ -102,7 +102,7 @@ import BraintreeCore
return
}

guard let applePayNonce: BTApplePayCardNonce = BTApplePayCardNonce(json: body["applePayCards"][0]) else {
guard let applePayNonce = BTApplePayCardNonce(json: body["applePayCards"][0]) else {
self.notifyFailure(with: BTApplePayError.failedToCreateNonce, completion: completion)
return
}
Expand Down
2 changes: 2 additions & 0 deletions Sources/BraintreeApplePay/BTApplePayError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ public enum BTApplePayError: Int, Error, CustomNSError, LocalizedError, Equatabl
case .unknown:
return ""
case .unsupported:
// swiftlint:disable line_length
return "Apple Pay is not enabled for this merchant. Please ensure that Apple Pay is enabled in the control panel and then try saving an Apple Pay payment method again."
// swiftlint:enable line_length
case .noApplePayCardsReturned:
return "No Apple Pay Card data was returned. Please contact support."
case .failedToCreateNonce:
Expand Down

0 comments on commit 64afdc8

Please sign in to comment.