Skip to content

Commit

Permalink
periphery detected dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
joyceqin-stripe committed Sep 30, 2024
1 parent 105364d commit 6b57a59
Show file tree
Hide file tree
Showing 19 changed files with 4 additions and 1,699 deletions.
5 changes: 2 additions & 3 deletions Stripe.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "2ad13697f5d60ad400147e34535361f52e72d2f7a280df77bb3c3521cc5623bc",
"originHash" : "c2f4a8c2436760fc0134632c1cdcb8e7f9b44493c60679a155d27d6838da7d8e",
"pins" : [
{
"identity" : "capture-core-sp",
Expand Down Expand Up @@ -38,6 +38,5 @@
}
}
],
"version" : 2
"version" : 3
}

32 changes: 0 additions & 32 deletions Stripe/Stripe.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -24,38 +24,7 @@ typealias STPShippingAddressSelectionBlock = (
STPAddress, @escaping STPShippingAddressValidationBlock
) -> Void
typealias STPPaymentAuthorizationBlock = (PKPayment) -> Void
extension PKPaymentAuthorizationViewController {
class func stp_controller(
with paymentRequest: PKPaymentRequest,
apiClient: STPAPIClient,
onShippingAddressSelection: @escaping STPShippingAddressSelectionBlock,
onShippingMethodSelection: @escaping STPShippingMethodSelectionBlock,
onPaymentAuthorization: @escaping STPPaymentAuthorizationBlock,
onPaymentMethodCreation: @escaping STPApplePayPaymentMethodHandlerBlock,
onFinish: @escaping STPPaymentCompletionBlock
) -> Self? {
let delegate = STPBlockBasedApplePayDelegate()
delegate.apiClient = apiClient
delegate.onShippingAddressSelection = onShippingAddressSelection
delegate.onShippingMethodSelection = onShippingMethodSelection
delegate.onPaymentAuthorization = onPaymentAuthorization
delegate.onPaymentMethodCreation = onPaymentMethodCreation
delegate.onFinish = onFinish
let viewController = self.init(paymentRequest: paymentRequest)
viewController?.delegate = delegate
if let viewController = viewController {
objc_setAssociatedObject(
viewController,
UnsafeRawPointer(&kSTPBlockBasedApplePayDelegateAssociatedObjectKey),
delegate,
.OBJC_ASSOCIATION_RETAIN_NONATOMIC
)
}
return viewController
}
}

private var kSTPBlockBasedApplePayDelegateAssociatedObjectKey = 0
typealias STPApplePayShippingMethodCompletionBlock = (
PKPaymentAuthorizationStatus, [PKPaymentSummaryItem]?
) -> Void
Expand Down
103 changes: 0 additions & 103 deletions Stripe/StripeiOS/Source/STPAPIClient+BasicUI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,109 +47,6 @@ extension STPAPIClient {
}
}

/// Update a customer with parameters
/// - seealso: https://stripe.com/docs/api#update_customer
func updateCustomer(
withParameters parameters: [String: Any],
using ephemeralKey: STPEphemeralKey,
completion: @escaping STPCustomerCompletionBlock
) {
let endpoint = "\(APIEndpointCustomers)/\(ephemeralKey.customerID ?? "")"
APIRequest<STPCustomer>.post(
with: self,
endpoint: endpoint,
additionalHeaders: authorizationHeader(using: ephemeralKey),
parameters: parameters
) { object, _, error in
completion(object, error)
}
}

/// Attach a Payment Method to a customer
/// - seealso: https://stripe.com/docs/api/payment_methods/attach
func attachPaymentMethod(
_ paymentMethodID: String,
toCustomerUsing ephemeralKey: STPEphemeralKey,
completion: @escaping STPErrorBlock
) {
guard let customerID = ephemeralKey.customerID else {
assertionFailure()
completion(nil)
return
}
let endpoint = "\(APIEndpointPaymentMethods)/\(paymentMethodID)/attach"
APIRequest<STPPaymentMethod>.post(
with: self,
endpoint: endpoint,
additionalHeaders: authorizationHeader(using: ephemeralKey),
parameters: [
"customer": customerID
]
) { _, _, error in
completion(error)
}
}

/// Detach a Payment Method from a customer
/// - seealso: https://stripe.com/docs/api/payment_methods/detach
func detachPaymentMethod(
_ paymentMethodID: String,
fromCustomerUsing ephemeralKey: STPEphemeralKey,
completion: @escaping STPErrorBlock
) {
let endpoint = "\(APIEndpointPaymentMethods)/\(paymentMethodID)/detach"
APIRequest<STPPaymentMethod>.post(
with: self,
endpoint: endpoint,
additionalHeaders: authorizationHeader(using: ephemeralKey),
parameters: [:]
) { _, _, error in
completion(error)
}
}

/// Retrieves a list of Payment Methods attached to a customer.
/// @note This only fetches card type Payment Methods
func listPaymentMethodsForCustomer(
using ephemeralKey: STPEphemeralKey,
completion: @escaping STPPaymentMethodsCompletionBlock
) {
let header = authorizationHeader(using: ephemeralKey)
let params: [String: Any] = [
"customer": ephemeralKey.customerID ?? "",
"type": "card",
]
APIRequest<STPPaymentMethodListDeserializer>.getWith(
self,
endpoint: APIEndpointPaymentMethods,
additionalHeaders: header,
parameters: params as [String: Any]
) { deserializer, _, error in
if let error = error {
completion(nil, error)
} else if let paymentMethods = deserializer?.paymentMethods {
completion(paymentMethods, nil)
}
}
}

/// Retrieve a customer
/// - seealso: https://stripe.com/docs/api#retrieve_customer
func retrieveCustomer(
using ephemeralKey: STPEphemeralKey,
completion: @escaping STPCustomerCompletionBlock
) {
let endpoint = "\(APIEndpointCustomers)/\(ephemeralKey.customerID ?? "")"
APIRequest<STPCustomer>.getWith(
self,
endpoint: endpoint,
additionalHeaders: authorizationHeader(using: ephemeralKey),
parameters: [:]
) { object, _, error in
completion(object, error)
}
}

// MARK: FPX
/// Retrieves the online status of the FPX banks from the Stripe API.
/// - Parameter completion: The callback to run with the returned FPX bank list, or an error.
Expand Down
5 changes: 0 additions & 5 deletions Stripe/StripeiOS/Source/STPBankSelectionViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ public class STPBankSelectionViewController: STPCoreTableViewController, UITable
private var selectedBank: STPFPXBankBrand = .unknown
private var configuration: STPPaymentConfiguration?
private weak var imageView: UIImageView?
private var headerView: STPSectionHeaderView?
private var loading = false
private var bankStatus: STPFPXBankStatusResponse?

Expand Down Expand Up @@ -128,10 +127,6 @@ public class STPBankSelectionViewController: STPCoreTableViewController, UITable
tableView?.reloadData()
}

@objc override func useSystemBackButton() -> Bool {
return true
}

func _update(withBankStatus bankStatusResponse: STPFPXBankStatusResponse) {
bankStatus = bankStatusResponse

Expand Down
9 changes: 0 additions & 9 deletions Stripe/StripeiOS/Source/STPCameraView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@ import UIKit
class STPCameraView: UIView {
private var flashLayer: CALayer?

var captureSession: AVCaptureSession? {
get {
return (videoPreviewLayer.session)!
}
set(captureSession) {
videoPreviewLayer.session = captureSession
}
}

var videoPreviewLayer: AVCaptureVideoPreviewLayer {
return layer as! AVCaptureVideoPreviewLayer
}
Expand Down
Loading

0 comments on commit 6b57a59

Please sign in to comment.