From df45cfb60abb6631c67946cca701f3009cae48c7 Mon Sep 17 00:00:00 2001 From: Yuki Tokuhiro Date: Mon, 4 Mar 2019 15:07:23 -0800 Subject: [PATCH 01/11] Rename STPPaymentMethod -> STPPaymentOption, STPPaymentMethodType -> STPPaymentOptionType, STPApplePayPaymentMethod -> STPApplePay --- .../SettingsViewController.swift | 4 +- Stripe.xcodeproj/project.pbxproj | 44 +++++++++---------- ...PApplePayPaymentMethod.h => STPApplePay.h} | 8 ++-- Stripe/PublicHeaders/STPCard.h | 4 +- .../PublicHeaders/STPPaymentConfiguration.h | 6 +-- Stripe/PublicHeaders/STPPaymentContext.h | 8 ++-- .../STPPaymentMethodsViewController.h | 6 +-- ...{STPPaymentMethod.h => STPPaymentOption.h} | 14 +++--- Stripe/PublicHeaders/STPSource.h | 2 +- Stripe/PublicHeaders/Stripe.h | 4 +- Stripe/STPAnalyticsClient.m | 4 +- ...PApplePayPaymentMethod.m => STPApplePay.m} | 10 ++--- Stripe/STPCard.m | 2 +- Stripe/STPCustomer+SourceTuple.m | 4 +- Stripe/STPPaymentConfiguration.m | 16 +++---- Stripe/STPPaymentContext+Private.h | 2 +- Stripe/STPPaymentContext.m | 18 ++++---- Stripe/STPPaymentMethodTableViewCell.h | 4 +- Stripe/STPPaymentMethodTableViewCell.m | 12 ++--- Stripe/STPPaymentMethodTuple.h | 14 +++--- Stripe/STPPaymentMethodTuple.m | 18 ++++---- .../STPPaymentMethodsInternalViewController.h | 6 +-- .../STPPaymentMethodsInternalViewController.m | 16 +++---- .../STPPaymentMethodsViewController+Private.h | 2 +- Stripe/STPPaymentMethodsViewController.m | 8 ++-- Stripe/STPShippingAddressViewController.m | 2 +- Stripe/STPSource.m | 2 +- ...TPAddCardViewControllerLocalizationTests.m | 2 +- ...dTest.m => STPApplePayPaymentOptionTest.m} | 20 ++++----- Tests/Tests/STPCardTest.m | 2 +- Tests/Tests/STPCustomerSourceTupleTest.m | 4 +- Tests/Tests/STPMocks.m | 2 +- Tests/Tests/STPPaymentConfigurationTest.m | 14 +++--- Tests/Tests/STPPaymentContextSnapshotTests.m | 2 +- ...ntMethodsViewControllerLocalizationTests.m | 2 +- .../STPPaymentMethodsViewControllerTest.m | 8 ++-- Tests/Tests/STPSourceTest.m | 2 +- 37 files changed, 149 insertions(+), 149 deletions(-) rename Stripe/PublicHeaders/{STPApplePayPaymentMethod.h => STPApplePay.h} (74%) rename Stripe/PublicHeaders/{STPPaymentMethod.h => STPPaymentOption.h} (83%) rename Stripe/{STPApplePayPaymentMethod.m => STPApplePay.m} (75%) rename Tests/Tests/{STPApplePayPaymentMethodTest.m => STPApplePayPaymentOptionTest.m} (52%) diff --git a/Example/Standard Integration (Swift)/SettingsViewController.swift b/Example/Standard Integration (Swift)/SettingsViewController.swift index 493aa112103..c35407d2f6e 100644 --- a/Example/Standard Integration (Swift)/SettingsViewController.swift +++ b/Example/Standard Integration (Swift)/SettingsViewController.swift @@ -11,7 +11,7 @@ import Stripe struct Settings { let theme: STPTheme - let additionalPaymentMethods: STPPaymentMethodType + let additionalPaymentMethods: STPPaymentOptionType let requiredBillingAddressFields: STPBillingAddressFields let requiredShippingAddressFields: Set let shippingType: STPShippingType @@ -20,7 +20,7 @@ struct Settings { class SettingsViewController: UITableViewController { var settings: Settings { return Settings(theme: self.theme.stpTheme, - additionalPaymentMethods: self.applePay.enabled ? .all : STPPaymentMethodType(), + additionalPaymentMethods: self.applePay.enabled ? .all : STPPaymentOptionType(), requiredBillingAddressFields: self.requiredBillingAddressFields.stpBillingAddressFields, requiredShippingAddressFields: self.requiredShippingAddressFields.stpContactFields, shippingType: self.shippingType.stpShippingType) diff --git a/Stripe.xcodeproj/project.pbxproj b/Stripe.xcodeproj/project.pbxproj index 7b924e94ff6..a26bc2a9920 100644 --- a/Stripe.xcodeproj/project.pbxproj +++ b/Stripe.xcodeproj/project.pbxproj @@ -169,9 +169,9 @@ 049A3FA11CC8006800F57DE7 /* stp_icon_add@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 049A3F9E1CC8006800F57DE7 /* stp_icon_add@3x.png */; }; 049A3FA61CC8071100F57DE7 /* stp_card_applepay@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 049A3FA31CC8071100F57DE7 /* stp_card_applepay@2x.png */; }; 049A3FA71CC8071100F57DE7 /* stp_card_applepay@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 049A3FA41CC8071100F57DE7 /* stp_card_applepay@3x.png */; }; - 049A3FA81CC963EB00F57DE7 /* STPPaymentMethod.h in Headers */ = {isa = PBXBuildFile; fileRef = C11810851CC6AF4C0022FB55 /* STPPaymentMethod.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 049A3FA81CC963EB00F57DE7 /* STPPaymentOption.h in Headers */ = {isa = PBXBuildFile; fileRef = C11810851CC6AF4C0022FB55 /* STPPaymentOption.h */; settings = {ATTRIBUTES = (Public, ); }; }; 049A3FA91CC96B3B00F57DE7 /* STPBackendAPIAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = C11810A61CC6E2160022FB55 /* STPBackendAPIAdapter.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 049A3FAA1CC96B7C00F57DE7 /* STPApplePayPaymentMethod.h in Headers */ = {isa = PBXBuildFile; fileRef = C11810871CC6B00D0022FB55 /* STPApplePayPaymentMethod.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 049A3FAA1CC96B7C00F57DE7 /* STPApplePay.h in Headers */ = {isa = PBXBuildFile; fileRef = C11810871CC6B00D0022FB55 /* STPApplePay.h */; settings = {ATTRIBUTES = (Public, ); }; }; 049A3FAE1CC9AA9900F57DE7 /* STPAddressViewModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 049A3FAC1CC9AA9900F57DE7 /* STPAddressViewModel.h */; }; 049A3FAF1CC9AA9900F57DE7 /* STPAddressViewModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 049A3FAD1CC9AA9900F57DE7 /* STPAddressViewModel.m */; }; 049A3FB21CC9FEFC00F57DE7 /* UIToolbar+Stripe_InputAccessory.h in Headers */ = {isa = PBXBuildFile; fileRef = 049A3FB01CC9FEFC00F57DE7 /* UIToolbar+Stripe_InputAccessory.h */; }; @@ -312,7 +312,7 @@ 04F94DAE1D229F54004FC826 /* STPColorUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 0426B96D1CEADC98006AC8DD /* STPColorUtils.m */; }; 04F94DAF1D229F59004FC826 /* STPPaymentMethodsViewController+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 04E39F561CECF9A800AF3B96 /* STPPaymentMethodsViewController+Private.h */; }; 04F94DB41D229F71004FC826 /* STPPaymentActivityIndicatorView.m in Sources */ = {isa = PBXBuildFile; fileRef = 046FE9A01CE55D1D00DA6A7B /* STPPaymentActivityIndicatorView.m */; }; - 04F94DB91D229F86004FC826 /* STPApplePayPaymentMethod.m in Sources */ = {isa = PBXBuildFile; fileRef = C11810881CC6B00D0022FB55 /* STPApplePayPaymentMethod.m */; }; + 04F94DB91D229F86004FC826 /* STPApplePay.m in Sources */ = {isa = PBXBuildFile; fileRef = C11810881CC6B00D0022FB55 /* STPApplePay.m */; }; 04F94DBA1D229F8A004FC826 /* PKPaymentAuthorizationViewController+Stripe_Blocks.h in Headers */ = {isa = PBXBuildFile; fileRef = C11810931CC6C4700022FB55 /* PKPaymentAuthorizationViewController+Stripe_Blocks.h */; }; 04F94DBB1D229F8D004FC826 /* PKPaymentAuthorizationViewController+Stripe_Blocks.m in Sources */ = {isa = PBXBuildFile; fileRef = C11810941CC6C4700022FB55 /* PKPaymentAuthorizationViewController+Stripe_Blocks.m */; }; 04F94DBC1D229F92004FC826 /* UIToolbar+Stripe_InputAccessory.m in Sources */ = {isa = PBXBuildFile; fileRef = 049A3FB11CC9FEFC00F57DE7 /* UIToolbar+Stripe_InputAccessory.m */; }; @@ -351,7 +351,7 @@ 8B5B4B441EFDD925005CF475 /* STPSourceOwnerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B5B4B431EFDD925005CF475 /* STPSourceOwnerTest.m */; }; 8B6DC9751F0171D20025E811 /* STPSourceReceiverTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B6DC9741F0171D20025E811 /* STPSourceReceiverTest.m */; }; 8B6DC9771F0172640025E811 /* STPSourceSEPADebitDetailsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B6DC9761F0172640025E811 /* STPSourceSEPADebitDetailsTest.m */; }; - 8B82C5CA1F2BC78F009639F7 /* STPApplePayPaymentMethodTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B82C5C91F2BC78F009639F7 /* STPApplePayPaymentMethodTest.m */; }; + 8B82C5CA1F2BC78F009639F7 /* STPApplePayPaymentOptionTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B82C5C91F2BC78F009639F7 /* STPApplePayPaymentOptionTest.m */; }; 8B8DDBB31EF887A4004B141F /* STPBankAccountParamsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B8DDBB21EF887A4004B141F /* STPBankAccountParamsTest.m */; }; 8BB890322056E55B00EB51AB /* stp_card_unionpay_template_en.png in Resources */ = {isa = PBXBuildFile; fileRef = 8BCB6E4A2053389600629978 /* stp_card_unionpay_template_en.png */; }; 8BB890332056E55F00EB51AB /* stp_card_unionpay_template_en@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 8BCB6E4E2053389700629978 /* stp_card_unionpay_template_en@2x.png */; }; @@ -452,9 +452,9 @@ C113D21A1EBB9A36006FACC2 /* STPEphemeralKey.h in Headers */ = {isa = PBXBuildFile; fileRef = C113D2171EBB9A36006FACC2 /* STPEphemeralKey.h */; }; C113D21B1EBB9A36006FACC2 /* STPEphemeralKey.m in Sources */ = {isa = PBXBuildFile; fileRef = C113D2181EBB9A36006FACC2 /* STPEphemeralKey.m */; }; C113D21C1EBB9A36006FACC2 /* STPEphemeralKey.m in Sources */ = {isa = PBXBuildFile; fileRef = C113D2181EBB9A36006FACC2 /* STPEphemeralKey.m */; }; - C11810861CC6AF4C0022FB55 /* STPPaymentMethod.h in Headers */ = {isa = PBXBuildFile; fileRef = C11810851CC6AF4C0022FB55 /* STPPaymentMethod.h */; settings = {ATTRIBUTES = (Public, ); }; }; - C11810891CC6B00D0022FB55 /* STPApplePayPaymentMethod.h in Headers */ = {isa = PBXBuildFile; fileRef = C11810871CC6B00D0022FB55 /* STPApplePayPaymentMethod.h */; settings = {ATTRIBUTES = (Public, ); }; }; - C118108A1CC6B00D0022FB55 /* STPApplePayPaymentMethod.m in Sources */ = {isa = PBXBuildFile; fileRef = C11810881CC6B00D0022FB55 /* STPApplePayPaymentMethod.m */; }; + C11810861CC6AF4C0022FB55 /* STPPaymentOption.h in Headers */ = {isa = PBXBuildFile; fileRef = C11810851CC6AF4C0022FB55 /* STPPaymentOption.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C11810891CC6B00D0022FB55 /* STPApplePay.h in Headers */ = {isa = PBXBuildFile; fileRef = C11810871CC6B00D0022FB55 /* STPApplePay.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C118108A1CC6B00D0022FB55 /* STPApplePay.m in Sources */ = {isa = PBXBuildFile; fileRef = C11810881CC6B00D0022FB55 /* STPApplePay.m */; }; C11810951CC6C4700022FB55 /* PKPaymentAuthorizationViewController+Stripe_Blocks.h in Headers */ = {isa = PBXBuildFile; fileRef = C11810931CC6C4700022FB55 /* PKPaymentAuthorizationViewController+Stripe_Blocks.h */; }; C11810961CC6C4700022FB55 /* PKPaymentAuthorizationViewController+Stripe_Blocks.m in Sources */ = {isa = PBXBuildFile; fileRef = C11810941CC6C4700022FB55 /* PKPaymentAuthorizationViewController+Stripe_Blocks.m */; }; C11810991CC6D46D0022FB55 /* NSDecimalNumber+StripeTest.m in Sources */ = {isa = PBXBuildFile; fileRef = C11810981CC6D46D0022FB55 /* NSDecimalNumber+StripeTest.m */; }; @@ -1103,7 +1103,7 @@ 8B5B4B431EFDD925005CF475 /* STPSourceOwnerTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPSourceOwnerTest.m; sourceTree = ""; }; 8B6DC9741F0171D20025E811 /* STPSourceReceiverTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPSourceReceiverTest.m; sourceTree = ""; }; 8B6DC9761F0172640025E811 /* STPSourceSEPADebitDetailsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPSourceSEPADebitDetailsTest.m; sourceTree = ""; }; - 8B82C5C91F2BC78F009639F7 /* STPApplePayPaymentMethodTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPApplePayPaymentMethodTest.m; sourceTree = ""; }; + 8B82C5C91F2BC78F009639F7 /* STPApplePayPaymentOptionTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPApplePayPaymentOptionTest.m; sourceTree = ""; }; 8B8DDBB21EF887A4004B141F /* STPBankAccountParamsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPBankAccountParamsTest.m; sourceTree = ""; }; 8BB97F071F26645B0095122A /* NSDictionary+StripeTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDictionary+StripeTest.m"; sourceTree = ""; }; 8BCB6E4A2053389600629978 /* stp_card_unionpay_template_en.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = stp_card_unionpay_template_en.png; sourceTree = ""; }; @@ -1166,9 +1166,9 @@ C1080F4B1CBED48A007B2D89 /* STPAddressTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPAddressTests.m; sourceTree = ""; }; C113D2171EBB9A36006FACC2 /* STPEphemeralKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STPEphemeralKey.h; sourceTree = ""; }; C113D2181EBB9A36006FACC2 /* STPEphemeralKey.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPEphemeralKey.m; sourceTree = ""; }; - C11810851CC6AF4C0022FB55 /* STPPaymentMethod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = STPPaymentMethod.h; path = PublicHeaders/STPPaymentMethod.h; sourceTree = ""; }; - C11810871CC6B00D0022FB55 /* STPApplePayPaymentMethod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = STPApplePayPaymentMethod.h; path = PublicHeaders/STPApplePayPaymentMethod.h; sourceTree = ""; }; - C11810881CC6B00D0022FB55 /* STPApplePayPaymentMethod.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPApplePayPaymentMethod.m; sourceTree = ""; }; + C11810851CC6AF4C0022FB55 /* STPPaymentOption.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = STPPaymentOption.h; path = PublicHeaders/STPPaymentOption.h; sourceTree = ""; }; + C11810871CC6B00D0022FB55 /* STPApplePay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = STPApplePay.h; path = PublicHeaders/STPApplePay.h; sourceTree = ""; }; + C11810881CC6B00D0022FB55 /* STPApplePay.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPApplePay.m; sourceTree = ""; }; C11810931CC6C4700022FB55 /* PKPaymentAuthorizationViewController+Stripe_Blocks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "PKPaymentAuthorizationViewController+Stripe_Blocks.h"; sourceTree = ""; }; C11810941CC6C4700022FB55 /* PKPaymentAuthorizationViewController+Stripe_Blocks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "PKPaymentAuthorizationViewController+Stripe_Blocks.m"; sourceTree = ""; }; C11810981CC6D46D0022FB55 /* NSDecimalNumber+StripeTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDecimalNumber+StripeTest.m"; sourceTree = ""; }; @@ -1720,7 +1720,7 @@ C124A1841CCAB750007D42EE /* STPAnalyticsClientTest.m */, 04CDB51E1A5F3A9300B854EE /* STPAPIClientTest.m */, C14C4DB01EC3B34500C2FDF6 /* STPAPIRequestTest.m */, - 8B82C5C91F2BC78F009639F7 /* STPApplePayPaymentMethodTest.m */, + 8B82C5C91F2BC78F009639F7 /* STPApplePayPaymentOptionTest.m */, C1AED1551EE0C8C6008BEFBF /* STPApplePayTest.m */, 8B8DDBB21EF887A4004B141F /* STPBankAccountParamsTest.m */, 04CDB5231A5F3A9300B854EE /* STPBankAccountTest.m */, @@ -2042,8 +2042,8 @@ F1728CF31EAAA43B002E0C29 /* PaymentContext */ = { isa = PBXGroup; children = ( - C11810871CC6B00D0022FB55 /* STPApplePayPaymentMethod.h */, - C11810881CC6B00D0022FB55 /* STPApplePayPaymentMethod.m */, + C11810871CC6B00D0022FB55 /* STPApplePay.h */, + C11810881CC6B00D0022FB55 /* STPApplePay.m */, C11810A61CC6E2160022FB55 /* STPBackendAPIAdapter.h */, C192269B1EBA99F900BED563 /* STPCustomerContext.h */, C192269E1EBA9A0800BED563 /* STPCustomerContext.m */, @@ -2051,7 +2051,7 @@ 049880FB1CED5A2300EA4FFD /* STPPaymentConfiguration.m */, 049A3F871CC73C7100F57DE7 /* STPPaymentContext.h */, 049A3F881CC73C7100F57DE7 /* STPPaymentContext.m */, - C11810851CC6AF4C0022FB55 /* STPPaymentMethod.h */, + C11810851CC6AF4C0022FB55 /* STPPaymentOption.h */, 0451CC421C49AE1C003B2CA6 /* STPPaymentResult.h */, 0451CC431C49AE1C003B2CA6 /* STPPaymentResult.m */, ); @@ -2246,7 +2246,7 @@ C1C1012E1E57A26F00C7BFAE /* STPSource+Private.h in Headers */, 04A488431CA3580700506E53 /* UINavigationController+Stripe_Completion.h in Headers */, C124A1711CCA968B007D42EE /* STPAnalyticsClient.h in Headers */, - 049A3FA81CC963EB00F57DE7 /* STPPaymentMethod.h in Headers */, + 049A3FA81CC963EB00F57DE7 /* STPPaymentOption.h in Headers */, F1D3A2661EBA5BAE0095BFA9 /* STPPaymentCardTextField+Private.h in Headers */, F1DEB8911E2052150066B8E8 /* STPCoreScrollViewController.h in Headers */, C1785F5D1EC60B5E00E9CFAC /* STPCardIOProxy.h in Headers */, @@ -2316,7 +2316,7 @@ 04F94DCF1D22A234004FC826 /* NSDecimalNumber+Stripe_Currency.h in Headers */, 8BD87B931EFB1C1E00269C2B /* STPSourceVerification+Private.h in Headers */, C1BD9B231E393FFE00CEE925 /* STPSourceReceiver.h in Headers */, - 049A3FAA1CC96B7C00F57DE7 /* STPApplePayPaymentMethod.h in Headers */, + 049A3FAA1CC96B7C00F57DE7 /* STPApplePay.h in Headers */, 04F94DA51D229F21004FC826 /* STPPaymentContext+Private.h in Headers */, F12829DB1D7747E4008B10D6 /* STPBundleLocator.h in Headers */, 8BD87B891EFB131800269C2B /* STPSourceCardDetails+Private.h in Headers */, @@ -2395,7 +2395,7 @@ C158AB3F1E1EE98900348D01 /* STPSectionHeaderView.h in Headers */, 04EBC7571B7533C300A0E6AE /* STPCardValidator.h in Headers */, 046FE9A11CE55D1D00DA6A7B /* STPPaymentActivityIndicatorView.h in Headers */, - C11810861CC6AF4C0022FB55 /* STPPaymentMethod.h in Headers */, + C11810861CC6AF4C0022FB55 /* STPPaymentOption.h in Headers */, 04695AD91C77F9EF00E08063 /* STPDelegateProxy.h in Headers */, 0433EB491BD06313003912B4 /* NSDictionary+Stripe.h in Headers */, C124A1701CCA968B007D42EE /* STPAnalyticsClient.h in Headers */, @@ -2458,7 +2458,7 @@ F1C7B8D51DBECF2400D9F6F0 /* STPDispatchFunctions.h in Headers */, 0426B9761CEBD001006AC8DD /* UINavigationBar+Stripe_Theme.h in Headers */, 04E39F581CECF9A800AF3B96 /* STPPaymentMethodsViewController+Private.h in Headers */, - C11810891CC6B00D0022FB55 /* STPApplePayPaymentMethod.h in Headers */, + C11810891CC6B00D0022FB55 /* STPApplePay.h in Headers */, 0426B9721CEAE3EB006AC8DD /* UITableViewCell+Stripe_Borders.h in Headers */, 04CDE5C91BC20B1D00548833 /* STPBankAccountParams.h in Headers */, 049A3F891CC73C7100F57DE7 /* STPPaymentContext.h in Headers */, @@ -2984,7 +2984,7 @@ C1CFCB751ED5E12400BE45DF /* STPFileTest.m in Sources */, C11810991CC6D46D0022FB55 /* NSDecimalNumber+StripeTest.m in Sources */, 8B5B4B441EFDD925005CF475 /* STPSourceOwnerTest.m in Sources */, - 8B82C5CA1F2BC78F009639F7 /* STPApplePayPaymentMethodTest.m in Sources */, + 8B82C5CA1F2BC78F009639F7 /* STPApplePayPaymentOptionTest.m in Sources */, B32B176320F6D722000D6EF8 /* STPGenericStripeObjectTest.m in Sources */, B3BDCACF20EEF4640034F7F5 /* STPPaymentIntentFunctionalTest.m in Sources */, 8B013C891F1E784A00DD831B /* STPPaymentConfigurationTest.m in Sources */, @@ -3078,7 +3078,7 @@ B36C6D762193676600D17575 /* STPPaymentIntentSourceActionAuthorizeWithURL.m in Sources */, B3A99BC61FEAF2CA003F6ED3 /* STPLegalEntityParams.m in Sources */, C180211D1E3A58710089D712 /* STPSourcePoller.m in Sources */, - 04F94DB91D229F86004FC826 /* STPApplePayPaymentMethod.m in Sources */, + 04F94DB91D229F86004FC826 /* STPApplePay.m in Sources */, B3A2413C1FFEB57400A2F00D /* STPConnectAccountParams.m in Sources */, C1BD9B2B1E39406C00CEE925 /* STPSourceOwner.m in Sources */, C1BD9B311E3940A200CEE925 /* STPSourceRedirect.m in Sources */, @@ -3209,7 +3209,7 @@ 04695ADC1C77F9EF00E08063 /* STPPhoneNumberValidator.m in Sources */, C1785F5E1EC60B5E00E9CFAC /* STPCardIOProxy.m in Sources */, 04CDB5141A5F30A700B854EE /* STPToken.m in Sources */, - C118108A1CC6B00D0022FB55 /* STPApplePayPaymentMethod.m in Sources */, + C118108A1CC6B00D0022FB55 /* STPApplePay.m in Sources */, 04A488341CA34D3000506E53 /* STPEmailAddressValidator.m in Sources */, 0433EB4C1BD06313003912B4 /* NSDictionary+Stripe.m in Sources */, F12C8DC31D63DE9F00ADA0D7 /* STPPaymentContextAmountModel.m in Sources */, diff --git a/Stripe/PublicHeaders/STPApplePayPaymentMethod.h b/Stripe/PublicHeaders/STPApplePay.h similarity index 74% rename from Stripe/PublicHeaders/STPApplePayPaymentMethod.h rename to Stripe/PublicHeaders/STPApplePay.h index cc2019be77d..56bc5facf85 100644 --- a/Stripe/PublicHeaders/STPApplePayPaymentMethod.h +++ b/Stripe/PublicHeaders/STPApplePay.h @@ -1,5 +1,5 @@ // -// STPApplePayPaymentMethod.h +// STPApplePay.h // Stripe // // Created by Ben Guo on 4/19/16. @@ -7,18 +7,18 @@ // #import -#import "STPPaymentMethod.h" +#import "STPPaymentOption.h" /** An empty class representing that the user wishes to pay via Apple Pay. This can be checked on an `STPPaymentContext`, e.g: ``` - if ([paymentContext.selectedPaymentMethod isKindOfClass:[STPApplePayPaymentMethod class]]) { + if ([paymentContext.selectedPaymentMethod isKindOfClass:[STPApplePay class]]) { // Don't ask the user for their card number; they want to pay with apple pay. } ``` */ -@interface STPApplePayPaymentMethod : NSObject +@interface STPApplePay : NSObject @end diff --git a/Stripe/PublicHeaders/STPCard.h b/Stripe/PublicHeaders/STPCard.h index 93f04f15955..966b2ae623b 100644 --- a/Stripe/PublicHeaders/STPCard.h +++ b/Stripe/PublicHeaders/STPCard.h @@ -11,7 +11,7 @@ #import "STPAPIResponseDecodable.h" #import "STPCardBrand.h" #import "STPCardParams.h" -#import "STPPaymentMethod.h" +#import "STPPaymentOption.h" #import "STPSourceProtocol.h" NS_ASSUME_NONNULL_BEGIN @@ -47,7 +47,7 @@ typedef NS_ENUM(NSInteger, STPCardFundingType) { @see https://stripe.com/docs/api#cards */ -@interface STPCard : NSObject +@interface STPCard : NSObject /** You cannot directly instantiate an `STPCard`. You should only use one that has diff --git a/Stripe/PublicHeaders/STPPaymentConfiguration.h b/Stripe/PublicHeaders/STPPaymentConfiguration.h index 1de7ce63777..9985998b64f 100644 --- a/Stripe/PublicHeaders/STPPaymentConfiguration.h +++ b/Stripe/PublicHeaders/STPPaymentConfiguration.h @@ -8,7 +8,7 @@ #import #import "STPBackendAPIAdapter.h" -#import "STPPaymentMethod.h" +#import "STPPaymentOption.h" #import "STPTheme.h" NS_ASSUME_NONNULL_BEGIN @@ -40,9 +40,9 @@ NS_ASSUME_NONNULL_BEGIN /** An enum value representing which payment methods you will accept from your user in addition to credit cards. Unless you have a very specific reason not to, you - should leave this at the default, `STPPaymentMethodTypeAll`. + should leave this at the default, `STPPaymentOptionTypeAll`. */ -@property (nonatomic, assign, readwrite) STPPaymentMethodType additionalPaymentMethods; +@property (nonatomic, assign, readwrite) STPPaymentOptionType additionalPaymentMethods; /** The billing address fields the user must fill out when prompted for their diff --git a/Stripe/PublicHeaders/STPPaymentContext.h b/Stripe/PublicHeaders/STPPaymentContext.h index 29f2264c0bc..587e00cae88 100644 --- a/Stripe/PublicHeaders/STPPaymentContext.h +++ b/Stripe/PublicHeaders/STPPaymentContext.h @@ -13,14 +13,14 @@ #import "STPAddress.h" #import "STPBlocks.h" #import "STPPaymentConfiguration.h" -#import "STPPaymentMethod.h" +#import "STPPaymentOption.h" #import "STPPaymentResult.h" #import "STPUserInformation.h" NS_ASSUME_NONNULL_BEGIN @class STPPaymentContext, STPAPIClient, STPTheme, STPCustomerContext; -@protocol STPBackendAPIAdapter, STPPaymentMethod, STPPaymentContextDelegate; +@protocol STPBackendAPIAdapter, STPPaymentOption, STPPaymentContextDelegate; /** An `STPPaymentContext` keeps track of all of the state around a payment. It will manage fetching a user's saved payment methods, tracking any information they select, and prompting them for required additional information before completing their purchase. It can be used to power your application's "payment confirmation" page with just a few lines of code. @@ -139,12 +139,12 @@ NS_ASSUME_NONNULL_BEGIN /** The user's currently selected payment method. May be nil. */ -@property (nonatomic, readonly, nullable) id selectedPaymentMethod; +@property (nonatomic, readonly, nullable) id selectedPaymentMethod; /** The available payment methods the user can choose between. May be nil. */ -@property (nonatomic, readonly, nullable) NSArray> *paymentMethods; +@property (nonatomic, readonly, nullable) NSArray> *paymentMethods; /** The user's currently selected shipping method. May be nil. diff --git a/Stripe/PublicHeaders/STPPaymentMethodsViewController.h b/Stripe/PublicHeaders/STPPaymentMethodsViewController.h index 07ac9278c92..a740a89f09f 100644 --- a/Stripe/PublicHeaders/STPPaymentMethodsViewController.h +++ b/Stripe/PublicHeaders/STPPaymentMethodsViewController.h @@ -11,12 +11,12 @@ #import "STPBackendAPIAdapter.h" #import "STPCoreViewController.h" #import "STPPaymentConfiguration.h" -#import "STPPaymentMethod.h" +#import "STPPaymentOption.h" #import "STPUserInformation.h" NS_ASSUME_NONNULL_BEGIN -@protocol STPPaymentMethod, STPPaymentMethodsViewControllerDelegate; +@protocol STPPaymentOption, STPPaymentMethodsViewControllerDelegate; @class STPPaymentContext, STPPaymentMethodsViewController, STPCustomerContext; /** @@ -202,7 +202,7 @@ NS_ASSUME_NONNULL_BEGIN @param paymentMethod the selected payment method */ - (void)paymentMethodsViewController:(STPPaymentMethodsViewController *)paymentMethodsViewController - didSelectPaymentMethod:(id)paymentMethod; + didSelectPaymentMethod:(id)paymentMethod; @end diff --git a/Stripe/PublicHeaders/STPPaymentMethod.h b/Stripe/PublicHeaders/STPPaymentOption.h similarity index 83% rename from Stripe/PublicHeaders/STPPaymentMethod.h rename to Stripe/PublicHeaders/STPPaymentOption.h index 33e9725f6b4..7288f5771c3 100644 --- a/Stripe/PublicHeaders/STPPaymentMethod.h +++ b/Stripe/PublicHeaders/STPPaymentOption.h @@ -1,5 +1,5 @@ // -// STPPaymentMethod.h +// STPPaymentOption.h // Stripe // // Created by Ben Guo on 4/19/16. @@ -15,35 +15,35 @@ NS_ASSUME_NONNULL_BEGIN configuring an `STPPaymentContext`. This is in addition to card payments, which are always enabled. */ -typedef NS_OPTIONS(NSUInteger, STPPaymentMethodType) { +typedef NS_OPTIONS(NSUInteger, STPPaymentOptionType) { /** Don't allow any payment methods except for cards. */ - STPPaymentMethodTypeNone = 0, + STPPaymentOptionTypeNone = 0, /** The user is allowed to pay with Apple Pay if it's configured and available on their device. */ - STPPaymentMethodTypeApplePay = 1 << 0, + STPPaymentOptionTypeApplePay = 1 << 0, /** The user is allowed to use any available payment method to pay. */ - STPPaymentMethodTypeAll = STPPaymentMethodTypeApplePay + STPPaymentOptionTypeAll = STPPaymentOptionTypeApplePay }; /** This protocol represents a payment method that a user can select and use to pay. Currently the only classes that conform to it are `STPCard`, which represents that the user wants to pay with a specific card, - `STPApplePayPaymentMethod`, which represents that the user wants to pay with + `STPApplePay`, which represents that the user wants to pay with Apple Pay, and `STPSource`. Only `STPSource.type == STPSourceTypeCard` payment methods are supported by `STPPaymentContext` and `STPPaymentMethodViewController`, but the other types do have basic support for this protocol for use in a custom integration. */ -@protocol STPPaymentMethod +@protocol STPPaymentOption /** A small (32 x 20 points) logo image representing the payment method. For diff --git a/Stripe/PublicHeaders/STPSource.h b/Stripe/PublicHeaders/STPSource.h index 98ce410365d..3fd19b05cce 100644 --- a/Stripe/PublicHeaders/STPSource.h +++ b/Stripe/PublicHeaders/STPSource.h @@ -25,7 +25,7 @@ NS_ASSUME_NONNULL_BEGIN /** Representation of a customer's payment instrument created with the Stripe API. @see https://stripe.com/docs/api#sources */ -@interface STPSource : NSObject +@interface STPSource : NSObject /** You cannot directly instantiate an `STPSource`. You should only use one that diff --git a/Stripe/PublicHeaders/Stripe.h b/Stripe/PublicHeaders/Stripe.h index 6e8cefea3d6..69bb3eb3d82 100644 --- a/Stripe/PublicHeaders/Stripe.h +++ b/Stripe/PublicHeaders/Stripe.h @@ -12,7 +12,7 @@ #import "STPAPIClient+ApplePay.h" #import "STPAPIClient.h" #import "STPAPIResponseDecodable.h" -#import "STPApplePayPaymentMethod.h" +#import "STPApplePay.h" #import "STPBackendAPIAdapter.h" #import "STPBankAccount.h" #import "STPBankAccountParams.h" @@ -42,7 +42,7 @@ #import "STPPaymentIntentParams.h" #import "STPPaymentIntentSourceAction.h" #import "STPPaymentIntentSourceActionAuthorizeWithURL.h" -#import "STPPaymentMethod.h" +#import "STPPaymentOption.h" #import "STPPaymentMethodsViewController.h" #import "STPPaymentResult.h" #import "STPRedirectContext.h" diff --git a/Stripe/STPAnalyticsClient.m b/Stripe/STPAnalyticsClient.m index c1000ab7904..65427e6615e 100644 --- a/Stripe/STPAnalyticsClient.m +++ b/Stripe/STPAnalyticsClient.m @@ -254,9 +254,9 @@ + (NSDictionary *)serializeConfiguration:(STPPaymentConfiguration *)configuratio NSMutableDictionary *dictionary = [NSMutableDictionary dictionary]; dictionary[@"publishable_key"] = configuration.publishableKey ?: @"unknown"; switch (configuration.additionalPaymentMethods) { - case STPPaymentMethodTypeAll: + case STPPaymentOptionTypeAll: dictionary[@"additional_payment_methods"] = @"all"; - case STPPaymentMethodTypeNone: + case STPPaymentOptionTypeNone: dictionary[@"additional_payment_methods"] = @"none"; } switch (configuration.requiredBillingAddressFields) { diff --git a/Stripe/STPApplePayPaymentMethod.m b/Stripe/STPApplePay.m similarity index 75% rename from Stripe/STPApplePayPaymentMethod.m rename to Stripe/STPApplePay.m index 05390e83372..a47aa66b3aa 100644 --- a/Stripe/STPApplePayPaymentMethod.m +++ b/Stripe/STPApplePay.m @@ -1,20 +1,20 @@ // -// STPApplePayPaymentMethod.m +// STPApplePay.m // Stripe // // Created by Ben Guo on 4/19/16. // Copyright © 2016 Stripe, Inc. All rights reserved. // -#import "STPApplePayPaymentMethod.h" +#import "STPApplePay.h" #import "STPImageLibrary.h" #import "STPImageLibrary+Private.h" #import "STPLocalizationUtils.h" -@implementation STPApplePayPaymentMethod +@implementation STPApplePay -#pragma mark - STPPaymentMethod +#pragma mark - STPPaymentOption - (UIImage *)image { return [STPImageLibrary applePayCardImage]; @@ -32,7 +32,7 @@ - (NSString *)label { #pragma mark - Equality - (BOOL)isEqual:(id)object { - return [object isKindOfClass:[STPApplePayPaymentMethod class]]; + return [object isKindOfClass:[STPApplePay class]]; } - (NSUInteger)hash { diff --git a/Stripe/STPCard.m b/Stripe/STPCard.m index 395eb928bc1..60130ba7fe9 100644 --- a/Stripe/STPCard.m +++ b/Stripe/STPCard.m @@ -224,7 +224,7 @@ + (nullable instancetype)decodedObjectFromAPIResponse:(nullable NSDictionary *)r return card; } -#pragma mark - STPPaymentMethod +#pragma mark - STPPaymentOption - (UIImage *)image { return [STPImageLibrary brandImageForCardBrand:self.brand]; diff --git a/Stripe/STPCustomer+SourceTuple.m b/Stripe/STPCustomer+SourceTuple.m index 6deca2c23ed..2f8f1c80777 100644 --- a/Stripe/STPCustomer+SourceTuple.m +++ b/Stripe/STPCustomer+SourceTuple.m @@ -18,8 +18,8 @@ @implementation STPCustomer (SourceTuple) - (STPPaymentMethodTuple *)filteredSourceTupleForUIWithConfiguration:(STPPaymentConfiguration *)configuration { - id _Nullable selectedMethod = nil; - NSMutableArray> *methods = [NSMutableArray array]; + id _Nullable selectedMethod = nil; + NSMutableArray> *methods = [NSMutableArray array]; for (id customerSource in self.sources) { if ([customerSource isKindOfClass:[STPCard class]]) { STPCard *card = (STPCard *)customerSource; diff --git a/Stripe/STPPaymentConfiguration.m b/Stripe/STPPaymentConfiguration.m index c7c013b15a0..aaca917cde8 100644 --- a/Stripe/STPPaymentConfiguration.m +++ b/Stripe/STPPaymentConfiguration.m @@ -39,7 +39,7 @@ + (instancetype)sharedConfiguration { - (instancetype)init { self = [super init]; if (self) { - _additionalPaymentMethods = STPPaymentMethodTypeAll; + _additionalPaymentMethods = STPPaymentOptionTypeAll; _requiredBillingAddressFields = STPBillingAddressFieldsNone; _requiredShippingAddressFields = nil; _verifyPrefilledShippingAddress = YES; @@ -53,7 +53,7 @@ - (instancetype)init { - (BOOL)applePayEnabled { return self.appleMerchantIdentifier && - (self.additionalPaymentMethods & STPPaymentMethodTypeApplePay) && + (self.additionalPaymentMethods & STPPaymentOptionTypeApplePay) && [Stripe deviceSupportsApplePay]; } @@ -62,17 +62,17 @@ - (BOOL)applePayEnabled { - (NSString *)description { NSString *additionalPaymentMethodsDescription; - if (self.additionalPaymentMethods == STPPaymentMethodTypeAll) { - additionalPaymentMethodsDescription = @"STPPaymentMethodTypeAll"; + if (self.additionalPaymentMethods == STPPaymentOptionTypeAll) { + additionalPaymentMethodsDescription = @"STPPaymentOptionTypeAll"; } - else if (self.additionalPaymentMethods == STPPaymentMethodTypeNone) { - additionalPaymentMethodsDescription = @"STPPaymentMethodTypeNone"; + else if (self.additionalPaymentMethods == STPPaymentOptionTypeNone) { + additionalPaymentMethodsDescription = @"STPPaymentOptionTypeNone"; } else { NSMutableArray *paymentMethodOptions = [[NSMutableArray alloc] init]; - if (self.additionalPaymentMethods & STPPaymentMethodTypeApplePay) { - [paymentMethodOptions addObject:@"STPPaymentMethodTypeApplePay"]; + if (self.additionalPaymentMethods & STPPaymentOptionTypeApplePay) { + [paymentMethodOptions addObject:@"STPPaymentOptionTypeApplePay"]; } additionalPaymentMethodsDescription = [paymentMethodOptions componentsJoinedByString:@"|"]; diff --git a/Stripe/STPPaymentContext+Private.h b/Stripe/STPPaymentContext+Private.h index 4b6b48f6b20..6562b38b4bd 100644 --- a/Stripe/STPPaymentContext+Private.h +++ b/Stripe/STPPaymentContext+Private.h @@ -18,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, readonly) STPPromise *currentValuePromise; -- (void)removePaymentMethod:(id)paymentMethodToRemove; +- (void)removePaymentMethod:(id)paymentMethodToRemove; @end diff --git a/Stripe/STPPaymentContext.m b/Stripe/STPPaymentContext.m index 890606a97e6..e784b696277 100644 --- a/Stripe/STPPaymentContext.m +++ b/Stripe/STPPaymentContext.m @@ -51,8 +51,8 @@ @interface STPPaymentContext() selectedPaymentMethod; -@property (nonatomic) NSArray> *paymentMethods; +@property (nonatomic) id selectedPaymentMethod; +@property (nonatomic) NSArray> *paymentMethods; @property (nonatomic) STPAddress *shippingAddress; @property (nonatomic) PKShippingMethod *selectedShippingMethod; @property (nonatomic) NSArray *shippingMethods; @@ -206,9 +206,9 @@ - (void)setPrefilledInformation:(STPUserInformation *)prefilledInformation { } } -- (void)setPaymentMethods:(NSArray> *)paymentMethods { - _paymentMethods = [paymentMethods sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) { - Class applePayKlass = [STPApplePayPaymentMethod class]; +- (void)setPaymentMethods:(NSArray> *)paymentMethods { + _paymentMethods = [paymentMethods sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) { + Class applePayKlass = [STPApplePay class]; Class cardKlass = [STPCard class]; if ([obj1 isKindOfClass:applePayKlass]) { return NSOrderedAscending; @@ -223,7 +223,7 @@ - (void)setPaymentMethods:(NSArray> *)paymentMethods { }]; } -- (void)setSelectedPaymentMethod:(id)selectedPaymentMethod { +- (void)setSelectedPaymentMethod:(id)selectedPaymentMethod { if (selectedPaymentMethod && ![self.paymentMethods containsObject:selectedPaymentMethod]) { self.paymentMethods = [self.paymentMethods arrayByAddingObject:selectedPaymentMethod]; } @@ -267,7 +267,7 @@ - (void)setShippingMethods:(NSArray *)shippingMethods { } } -- (void)removePaymentMethod:(id)paymentMethodToRemove { +- (void)removePaymentMethod:(id)paymentMethodToRemove { // Remove payment method from cached representation NSMutableArray *paymentMethods = [self.paymentMethods mutableCopy]; [paymentMethods removeObject:paymentMethodToRemove]; @@ -345,7 +345,7 @@ - (void)pushPaymentMethodsViewController { } - (void)paymentMethodsViewController:(__unused STPPaymentMethodsViewController *)paymentMethodsViewController - didSelectPaymentMethod:(id)paymentMethod { + didSelectPaymentMethod:(id)paymentMethod { self.selectedPaymentMethod = paymentMethod; } @@ -596,7 +596,7 @@ - (void)requestPayment { }); }]; } - else if ([self.selectedPaymentMethod isKindOfClass:[STPApplePayPaymentMethod class]]) { + else if ([self.selectedPaymentMethod isKindOfClass:[STPApplePay class]]) { self.state = STPPaymentContextStateRequestingPayment; PKPaymentRequest *paymentRequest = [self buildPaymentRequest]; STPShippingAddressSelectionBlock shippingAddressHandler = ^(STPAddress *shippingAddress, STPShippingAddressValidationBlock completion) { diff --git a/Stripe/STPPaymentMethodTableViewCell.h b/Stripe/STPPaymentMethodTableViewCell.h index 285693a3b5f..62a5a3b45cf 100644 --- a/Stripe/STPPaymentMethodTableViewCell.h +++ b/Stripe/STPPaymentMethodTableViewCell.h @@ -10,14 +10,14 @@ @class STPTheme; -@protocol STPPaymentMethod; +@protocol STPPaymentOption; NS_ASSUME_NONNULL_BEGIN @interface STPPaymentMethodTableViewCell : UITableViewCell - (void)configureForNewCardRowWithTheme:(STPTheme *)theme; -- (void)configureWithPaymentMethod:(id)paymentMethod theme:(STPTheme *)theme selected:(BOOL)selected; +- (void)configureWithPaymentMethod:(id)paymentMethod theme:(STPTheme *)theme selected:(BOOL)selected; @end diff --git a/Stripe/STPPaymentMethodTableViewCell.m b/Stripe/STPPaymentMethodTableViewCell.m index 804748d185e..43abe14cca1 100644 --- a/Stripe/STPPaymentMethodTableViewCell.m +++ b/Stripe/STPPaymentMethodTableViewCell.m @@ -8,17 +8,17 @@ #import "STPPaymentMethodTableViewCell.h" -#import "STPApplePayPaymentMethod.h" +#import "STPApplePay.h" #import "STPCard.h" #import "STPImageLibrary+Private.h" #import "STPLocalizationUtils.h" -#import "STPPaymentMethod.h" +#import "STPPaymentOption.h" #import "STPSource.h" #import "STPTheme.h" @interface STPPaymentMethodTableViewCell () -@property (nonatomic, strong, nullable, readwrite) id paymentMethod; +@property (nonatomic, strong, nullable, readwrite) id paymentMethod; @property (nonatomic, strong, readwrite) STPTheme *theme; @property (nonatomic, strong, readwrite) UIImageView *leftIcon; @@ -94,7 +94,7 @@ - (void)configureForNewCardRowWithTheme:(STPTheme *)theme { [self setNeedsLayout]; } -- (void)configureWithPaymentMethod:(id)paymentMethod theme:(STPTheme *)theme selected:(BOOL)selected { +- (void)configureWithPaymentMethod:(id)paymentMethod theme:(STPTheme *)theme selected:(BOOL)selected { self.paymentMethod = paymentMethod; self.theme = theme; @@ -119,7 +119,7 @@ - (UIColor *)primaryColorForPaymentMethodWithSelected:(BOOL)selected { return selected ? self.theme.accentColor : [self.theme.primaryForegroundColor colorWithAlphaComponent:0.6f]; } -- (NSAttributedString *)buildAttributedStringWithPaymentMethod:(id)paymentMethod selected:(BOOL)selected { +- (NSAttributedString *)buildAttributedStringWithPaymentMethod:(id)paymentMethod selected:(BOOL)selected { if ([paymentMethod isKindOfClass:[STPCard class]]) { return [self buildAttributedStringWithCard:(STPCard *)paymentMethod selected:selected]; } @@ -131,7 +131,7 @@ - (NSAttributedString *)buildAttributedStringWithPaymentMethod:(id -#import "STPPaymentMethod.h" +#import "STPPaymentOption.h" NS_ASSUME_NONNULL_BEGIN @interface STPPaymentMethodTuple : NSObject -+ (instancetype)tupleWithPaymentMethods:(NSArray> *)paymentMethods - selectedPaymentMethod:(nullable id)selectedPaymentMethod; ++ (instancetype)tupleWithPaymentMethods:(NSArray> *)paymentMethods + selectedPaymentMethod:(nullable id)selectedPaymentMethod; -+ (instancetype)tupleWithPaymentMethods:(NSArray> *)paymentMethods - selectedPaymentMethod:(nullable id)selectedPaymentMethod ++ (instancetype)tupleWithPaymentMethods:(NSArray> *)paymentMethods + selectedPaymentMethod:(nullable id)selectedPaymentMethod addApplePayMethod:(BOOL)applePayEnabled; -@property (nonatomic, nullable, readonly) id selectedPaymentMethod; -@property (nonatomic, readonly) NSArray> *paymentMethods; +@property (nonatomic, nullable, readonly) id selectedPaymentMethod; +@property (nonatomic, readonly) NSArray> *paymentMethods; @end diff --git a/Stripe/STPPaymentMethodTuple.m b/Stripe/STPPaymentMethodTuple.m index e97ebc15ce1..07f2d65b249 100644 --- a/Stripe/STPPaymentMethodTuple.m +++ b/Stripe/STPPaymentMethodTuple.m @@ -7,36 +7,36 @@ // #import "STPPaymentMethodTuple.h" -#import "STPApplePayPaymentMethod.h" +#import "STPApplePay.h" #import "STPCard.h" NS_ASSUME_NONNULL_BEGIN @interface STPPaymentMethodTuple() -@property (nonatomic, nullable) id selectedPaymentMethod; -@property (nonatomic) NSArray> *paymentMethods; +@property (nonatomic, nullable) id selectedPaymentMethod; +@property (nonatomic) NSArray> *paymentMethods; @end @implementation STPPaymentMethodTuple -+ (instancetype)tupleWithPaymentMethods:(NSArray> *)paymentMethods - selectedPaymentMethod:(nullable id)selectedPaymentMethod { ++ (instancetype)tupleWithPaymentMethods:(NSArray> *)paymentMethods + selectedPaymentMethod:(nullable id)selectedPaymentMethod { STPPaymentMethodTuple *tuple = [self new]; tuple.paymentMethods = paymentMethods ?: @[]; tuple.selectedPaymentMethod = selectedPaymentMethod; return tuple; } -+ (instancetype)tupleWithPaymentMethods:(NSArray> *)paymentMethods - selectedPaymentMethod:(nullable id)selectedPaymentMethod ++ (instancetype)tupleWithPaymentMethods:(NSArray> *)paymentMethods + selectedPaymentMethod:(nullable id)selectedPaymentMethod addApplePayMethod:(BOOL)applePayEnabled { NSMutableArray *mutablePaymentMethods = paymentMethods.mutableCopy; - id _Nullable selected = selectedPaymentMethod; + id _Nullable selected = selectedPaymentMethod; if (applePayEnabled) { - STPApplePayPaymentMethod *applePay = [STPApplePayPaymentMethod new]; + STPApplePay *applePay = [STPApplePay new]; [mutablePaymentMethods addObject:applePay]; if (!selected) { diff --git a/Stripe/STPPaymentMethodsInternalViewController.h b/Stripe/STPPaymentMethodsInternalViewController.h index 5e35803e3bc..499bc669093 100644 --- a/Stripe/STPPaymentMethodsInternalViewController.h +++ b/Stripe/STPPaymentMethodsInternalViewController.h @@ -11,14 +11,14 @@ @class STPAddress, STPCustomerContext, STPPaymentConfiguration, STPPaymentMethodTuple, STPToken, STPUserInformation; -@protocol STPPaymentMethod; +@protocol STPPaymentOption; NS_ASSUME_NONNULL_BEGIN @protocol STPPaymentMethodsInternalViewControllerDelegate -- (void)internalViewControllerDidSelectPaymentMethod:(id)paymentMethod; -- (void)internalViewControllerDidDeletePaymentMethod:(id)paymentMethod; +- (void)internalViewControllerDidSelectPaymentMethod:(id)paymentMethod; +- (void)internalViewControllerDidDeletePaymentMethod:(id)paymentMethod; - (void)internalViewControllerDidCreateSource:(id)source completion:(STPErrorBlock)completion; - (void)internalViewControllerDidCancel; diff --git a/Stripe/STPPaymentMethodsInternalViewController.m b/Stripe/STPPaymentMethodsInternalViewController.m index 2ed10396a12..5ddddcc5f78 100644 --- a/Stripe/STPPaymentMethodsInternalViewController.m +++ b/Stripe/STPPaymentMethodsInternalViewController.m @@ -38,8 +38,8 @@ @interface STPPaymentMethodsInternalViewController () apiAdapter; @property (nonatomic, strong, nullable, readwrite) STPUserInformation *prefilledInformation; @property (nonatomic, strong, nullable, readwrite) STPAddress *shippingAddress; -@property (nonatomic, strong, readwrite) NSArray> *paymentMethods; -@property (nonatomic, strong, nullable, readwrite) id selectedPaymentMethod; +@property (nonatomic, strong, readwrite) NSArray> *paymentMethods; +@property (nonatomic, strong, nullable, readwrite) id selectedPaymentMethod; @property (nonatomic, weak, nullable, readwrite) id delegate; @property (nonatomic, strong, readwrite) UIImageView *cardImageView; @@ -129,7 +129,7 @@ - (void)reloadRightBarButtonItemWithTableViewIsEditing:(BOOL)tableViewIsEditing } - (BOOL)isAnyPaymentMethodDetachable { - for (id paymentMethod in self.paymentMethods) { + for (id paymentMethod in self.paymentMethods) { if ([self isPaymentMethodDetachable:paymentMethod]) { return YES; } @@ -138,7 +138,7 @@ - (BOOL)isAnyPaymentMethodDetachable { return NO; } -- (BOOL)isPaymentMethodDetachable:(id)paymentMethod { +- (BOOL)isPaymentMethodDetachable:(id)paymentMethod { if (!self.configuration.canDeletePaymentMethods) { // Feature is disabled return NO; @@ -236,7 +236,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N STPPaymentMethodTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:PaymentMethodCellReuseIdentifier forIndexPath:indexPath]; if (indexPath.section == PaymentMethodSectionCardList) { - id paymentMethod = [self.paymentMethods stp_boundSafeObjectAtIndex:indexPath.row]; + id paymentMethod = [self.paymentMethods stp_boundSafeObjectAtIndex:indexPath.row]; BOOL selected = [paymentMethod isEqual:self.selectedPaymentMethod]; [cell configureWithPaymentMethod:paymentMethod theme:self.theme selected:selected]; @@ -250,7 +250,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N - (BOOL)tableView:(__unused UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.section == PaymentMethodSectionCardList) { - id paymentMethod = [self.paymentMethods stp_boundSafeObjectAtIndex:indexPath.row]; + id paymentMethod = [self.paymentMethods stp_boundSafeObjectAtIndex:indexPath.row]; if ([self isPaymentMethodDetachable:paymentMethod]) { return YES; @@ -274,7 +274,7 @@ - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEd return; } - id paymentMethodToDelete = [self.paymentMethods stp_boundSafeObjectAtIndex:indexPath.row]; + id paymentMethodToDelete = [self.paymentMethods stp_boundSafeObjectAtIndex:indexPath.row]; if (![self isPaymentMethodDetachable:paymentMethodToDelete]) { // Showed the user a delete option for a payment method when we shouldn't have @@ -314,7 +314,7 @@ - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEd - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.section == PaymentMethodSectionCardList) { // Update data source - id paymentMethod = [self.paymentMethods stp_boundSafeObjectAtIndex:indexPath.row]; + id paymentMethod = [self.paymentMethods stp_boundSafeObjectAtIndex:indexPath.row]; self.selectedPaymentMethod = paymentMethod; // Perform selection animation diff --git a/Stripe/STPPaymentMethodsViewController+Private.h b/Stripe/STPPaymentMethodsViewController+Private.h index 318553a6275..1a8de6a625f 100644 --- a/Stripe/STPPaymentMethodsViewController+Private.h +++ b/Stripe/STPPaymentMethodsViewController+Private.h @@ -10,7 +10,7 @@ #import "STPBackendAPIAdapter.h" #import "STPPaymentConfiguration.h" -#import "STPPaymentMethod.h" +#import "STPPaymentOption.h" #import "STPPaymentMethodTuple.h" #import "STPPromise.h" diff --git a/Stripe/STPPaymentMethodsViewController.m b/Stripe/STPPaymentMethodsViewController.m index a897b97df2c..c83249457d8 100644 --- a/Stripe/STPPaymentMethodsViewController.m +++ b/Stripe/STPPaymentMethodsViewController.m @@ -170,7 +170,7 @@ - (void)updateAppearance { self.activityIndicator.tintColor = self.theme.accentColor; } -- (void)finishWithPaymentMethod:(id)paymentMethod { +- (void)finishWithPaymentMethod:(id)paymentMethod { BOOL methodIsCardToken = [paymentMethod isKindOfClass:[STPCard class]]; BOOL methodIsCardSource = ([paymentMethod isKindOfClass:[STPSource class]] && ((STPSource *)paymentMethod).type == STPSourceTypeCard); @@ -202,11 +202,11 @@ - (void)finishWithPaymentMethod:(id)paymentMethod { [self.delegate paymentMethodsViewControllerDidFinish:self]; } -- (void)internalViewControllerDidSelectPaymentMethod:(id)paymentMethod { +- (void)internalViewControllerDidSelectPaymentMethod:(id)paymentMethod { [self finishWithPaymentMethod:paymentMethod]; } -- (void)internalViewControllerDidDeletePaymentMethod:(id)paymentMethod { +- (void)internalViewControllerDidDeletePaymentMethod:(id)paymentMethod { if ([self.delegate isKindOfClass:[STPPaymentContext class]]) { // Notify payment context to update its copy of payment methods STPPaymentContext *paymentContext = (STPPaymentContext *)self.delegate; @@ -236,7 +236,7 @@ - (void)internalViewControllerDidCreateSource:(id)source comp // created a card source else if ([source isKindOfClass:[STPSource class]] && ((STPSource *)source).type == STPSourceTypeCard) { - [self finishWithPaymentMethod:(id)source]; + [self finishWithPaymentMethod:(id)source]; } } }); diff --git a/Stripe/STPShippingAddressViewController.m b/Stripe/STPShippingAddressViewController.m index d39fb394536..83dda433c24 100644 --- a/Stripe/STPShippingAddressViewController.m +++ b/Stripe/STPShippingAddressViewController.m @@ -49,7 +49,7 @@ - (instancetype)init { - (instancetype)initWithPaymentContext:(STPPaymentContext *)paymentContext { STPAddress *billingAddress = nil; - id paymentMethod = paymentContext.selectedPaymentMethod; + id paymentMethod = paymentContext.selectedPaymentMethod; if ([paymentMethod isKindOfClass:[STPCard class]]) { STPCard *card = (STPCard *)paymentMethod; billingAddress = [card address]; diff --git a/Stripe/STPSource.m b/Stripe/STPSource.m index 160096f35e7..9cdb8461d7f 100644 --- a/Stripe/STPSource.m +++ b/Stripe/STPSource.m @@ -266,7 +266,7 @@ + (instancetype)decodedObjectFromAPIResponse:(NSDictionary *)response { return source; } -#pragma mark - STPPaymentMethod +#pragma mark - STPPaymentOption - (UIImage *)image { if (self.type == STPSourceTypeCard && self.cardDetails != nil) { diff --git a/Tests/Tests/STPAddCardViewControllerLocalizationTests.m b/Tests/Tests/STPAddCardViewControllerLocalizationTests.m index 19ce816c129..e5aef79aad3 100644 --- a/Tests/Tests/STPAddCardViewControllerLocalizationTests.m +++ b/Tests/Tests/STPAddCardViewControllerLocalizationTests.m @@ -44,7 +44,7 @@ - (void)performSnapshotTestForLanguage:(NSString *)language delivery:(BOOL)deliv STPPaymentConfiguration *config = [STPFixtures paymentConfiguration]; config.companyName = @"Test Company"; config.requiredBillingAddressFields = STPBillingAddressFieldsFull; - config.additionalPaymentMethods = STPPaymentMethodTypeAll; + config.additionalPaymentMethods = STPPaymentOptionTypeAll; config.shippingType = (delivery) ? STPShippingTypeDelivery : STPShippingTypeShipping; [STPLocalizationUtils overrideLanguageTo:language]; diff --git a/Tests/Tests/STPApplePayPaymentMethodTest.m b/Tests/Tests/STPApplePayPaymentOptionTest.m similarity index 52% rename from Tests/Tests/STPApplePayPaymentMethodTest.m rename to Tests/Tests/STPApplePayPaymentOptionTest.m index 639a9f94f5a..87552de2504 100644 --- a/Tests/Tests/STPApplePayPaymentMethodTest.m +++ b/Tests/Tests/STPApplePayPaymentOptionTest.m @@ -1,5 +1,5 @@ // -// STPApplePayPaymentMethodTest.m +// STPApplePayPaymentOptionTest.m // Stripe // // Created by Joey Dong on 7/28/17. @@ -8,36 +8,36 @@ #import -#import "STPApplePayPaymentMethod.h" +#import "STPApplePay.h" -@interface STPApplePayPaymentMethodTest : XCTestCase +@interface STPApplePayPaymentOptionTest : XCTestCase @end -@implementation STPApplePayPaymentMethodTest +@implementation STPApplePayPaymentOptionTest -#pragma mark - STPPaymentMethod Tests +#pragma mark - STPPaymentOption Tests - (void)testImage { - STPApplePayPaymentMethod *applePay = [[STPApplePayPaymentMethod alloc] init]; + STPApplePay *applePay = [[STPApplePay alloc] init]; XCTAssert([applePay image]); } - (void)testTemplateImage { - STPApplePayPaymentMethod *applePay = [[STPApplePayPaymentMethod alloc] init]; + STPApplePay *applePay = [[STPApplePay alloc] init]; XCTAssert([applePay templateImage]); } - (void)testLabel { - STPApplePayPaymentMethod *applePay = [[STPApplePayPaymentMethod alloc] init]; + STPApplePay *applePay = [[STPApplePay alloc] init]; XCTAssertEqualObjects([applePay label], @"Apple Pay"); } #pragma mark - Equality Tests - (void)testApplePayEquals { - STPApplePayPaymentMethod *applePay1 = [[STPApplePayPaymentMethod alloc] init]; - STPApplePayPaymentMethod *applePay2 = [[STPApplePayPaymentMethod alloc] init]; + STPApplePay *applePay1 = [[STPApplePay alloc] init]; + STPApplePay *applePay2 = [[STPApplePay alloc] init]; XCTAssertNotEqual(applePay1, applePay2); diff --git a/Tests/Tests/STPCardTest.m b/Tests/Tests/STPCardTest.m index b8a23e997fe..528ba45f3fd 100644 --- a/Tests/Tests/STPCardTest.m +++ b/Tests/Tests/STPCardTest.m @@ -305,7 +305,7 @@ - (void)testStripeID { XCTAssertEqualObjects(card.stripeID, @"card_103kbR2eZvKYlo2CDczLmw4K"); } -#pragma mark - STPPaymentMethod Tests +#pragma mark - STPPaymentOption Tests - (void)testImage { STPCard *card = [STPFixtures card]; diff --git a/Tests/Tests/STPCustomerSourceTupleTest.m b/Tests/Tests/STPCustomerSourceTupleTest.m index 0e546940af4..d473606cf29 100644 --- a/Tests/Tests/STPCustomerSourceTupleTest.m +++ b/Tests/Tests/STPCustomerSourceTupleTest.m @@ -38,7 +38,7 @@ - (void)performSourceTupleTestWithCustomer:(STPCustomer *)sut expectedValidSources:(NSUInteger)expectedSourceCount expectedSelectedSource:(id)expectedSelectedSource { STPPaymentConfiguration *config = [STPMocks paymentConfigurationWithApplePaySupportingDevice]; - config.additionalPaymentMethods = applePayEnabled ? STPPaymentMethodTypeAll : STPPaymentMethodTypeNone; + config.additionalPaymentMethods = applePayEnabled ? STPPaymentOptionTypeAll : STPPaymentOptionTypeNone; STPPaymentMethodTuple *tuple = [sut filteredSourceTupleForUIWithConfiguration:config]; XCTAssertNotNil(tuple); @@ -72,7 +72,7 @@ - (void)performSourceTupleTestWithCustomer:(STPCustomer *)sut [self performSourceTupleTestWithCustomer:sut applePayEnabled:YES expectedValidSources:expectedSourceCount + 1 - expectedSelectedSource:expectedSelectedSource ?: [STPApplePayPaymentMethod new]]; + expectedSelectedSource:expectedSelectedSource ?: [STPApplePay new]]; } - (void)testSourceTupleCreationNoSources { diff --git a/Tests/Tests/STPMocks.m b/Tests/Tests/STPMocks.m index a423ca317df..8af4cbc3c9d 100644 --- a/Tests/Tests/STPMocks.m +++ b/Tests/Tests/STPMocks.m @@ -68,7 +68,7 @@ + (STPPaymentConfiguration *)paymentConfigurationWithApplePaySupportingDevice { @implementation STPPaymentConfiguration (STPMocks) - (BOOL)stpmock_applePayEnabled { - return (self.additionalPaymentMethods & STPPaymentMethodTypeApplePay); + return (self.additionalPaymentMethods & STPPaymentOptionTypeApplePay); } @end diff --git a/Tests/Tests/STPPaymentConfigurationTest.m b/Tests/Tests/STPPaymentConfigurationTest.m index aecc2691bca..0bf3fbae634 100644 --- a/Tests/Tests/STPPaymentConfigurationTest.m +++ b/Tests/Tests/STPPaymentConfigurationTest.m @@ -32,7 +32,7 @@ - (void)testInit { STPPaymentConfiguration *paymentConfiguration = [[STPPaymentConfiguration alloc] init]; XCTAssertNil(paymentConfiguration.publishableKey); - XCTAssertEqual(paymentConfiguration.additionalPaymentMethods, STPPaymentMethodTypeAll); + XCTAssertEqual(paymentConfiguration.additionalPaymentMethods, STPPaymentOptionTypeAll); XCTAssertEqual(paymentConfiguration.requiredBillingAddressFields, STPBillingAddressFieldsNone); XCTAssertNil(paymentConfiguration.requiredShippingAddressFields); XCTAssert(paymentConfiguration.verifyPrefilledShippingAddress); @@ -48,7 +48,7 @@ - (void)testApplePayEnabledSatisfied { STPPaymentConfiguration *paymentConfiguration = [[STPPaymentConfiguration alloc] init]; paymentConfiguration.appleMerchantIdentifier = @"appleMerchantIdentifier"; - paymentConfiguration.additionalPaymentMethods = STPPaymentMethodTypeAll; + paymentConfiguration.additionalPaymentMethods = STPPaymentOptionTypeAll; XCTAssert([paymentConfiguration applePayEnabled]); } @@ -59,7 +59,7 @@ - (void)testApplePayEnabledMissingAppleMerchantIdentifier { STPPaymentConfiguration *paymentConfiguration = [[STPPaymentConfiguration alloc] init]; paymentConfiguration.appleMerchantIdentifier = nil; - paymentConfiguration.additionalPaymentMethods = STPPaymentMethodTypeAll; + paymentConfiguration.additionalPaymentMethods = STPPaymentOptionTypeAll; XCTAssertFalse([paymentConfiguration applePayEnabled]); } @@ -70,7 +70,7 @@ - (void)testApplePayEnabledDisallowAdditionalPaymentMethods { STPPaymentConfiguration *paymentConfiguration = [[STPPaymentConfiguration alloc] init]; paymentConfiguration.appleMerchantIdentifier = @"appleMerchantIdentifier"; - paymentConfiguration.additionalPaymentMethods = STPPaymentMethodTypeNone; + paymentConfiguration.additionalPaymentMethods = STPPaymentOptionTypeNone; XCTAssertFalse([paymentConfiguration applePayEnabled]); } @@ -81,7 +81,7 @@ - (void)testApplePayEnabledMisisngDeviceSupport { STPPaymentConfiguration *paymentConfiguration = [[STPPaymentConfiguration alloc] init]; paymentConfiguration.appleMerchantIdentifier = @"appleMerchantIdentifier"; - paymentConfiguration.additionalPaymentMethods = STPPaymentMethodTypeAll; + paymentConfiguration.additionalPaymentMethods = STPPaymentOptionTypeAll; XCTAssertFalse([paymentConfiguration applePayEnabled]); } @@ -103,7 +103,7 @@ - (void)testCopyWithZone { STPPaymentConfiguration *paymentConfigurationA = [[STPPaymentConfiguration alloc] init]; paymentConfigurationA.publishableKey = @"publishableKey"; - paymentConfigurationA.additionalPaymentMethods = STPPaymentMethodTypeApplePay; + paymentConfigurationA.additionalPaymentMethods = STPPaymentOptionTypeApplePay; paymentConfigurationA.requiredBillingAddressFields = STPBillingAddressFieldsFull; paymentConfigurationA.requiredShippingAddressFields = allFields; paymentConfigurationA.verifyPrefilledShippingAddress = NO; @@ -116,7 +116,7 @@ - (void)testCopyWithZone { XCTAssertNotEqual(paymentConfigurationA, paymentConfigurationB); XCTAssertEqualObjects(paymentConfigurationB.publishableKey, @"publishableKey"); - XCTAssertEqual(paymentConfigurationB.additionalPaymentMethods, STPPaymentMethodTypeApplePay); + XCTAssertEqual(paymentConfigurationB.additionalPaymentMethods, STPPaymentOptionTypeApplePay); XCTAssertEqual(paymentConfigurationB.requiredBillingAddressFields, STPBillingAddressFieldsFull); XCTAssertEqualObjects(paymentConfigurationB.requiredShippingAddressFields, allFields); XCTAssertFalse(paymentConfigurationB.verifyPrefilledShippingAddress); diff --git a/Tests/Tests/STPPaymentContextSnapshotTests.m b/Tests/Tests/STPPaymentContextSnapshotTests.m index 02db3c39555..dad400d96ab 100644 --- a/Tests/Tests/STPPaymentContextSnapshotTests.m +++ b/Tests/Tests/STPPaymentContextSnapshotTests.m @@ -30,7 +30,7 @@ - (void)setUp { STPPaymentConfiguration *config = [STPFixtures paymentConfiguration]; config.companyName = @"Test Company"; config.requiredBillingAddressFields = STPBillingAddressFieldsFull; - config.additionalPaymentMethods = STPPaymentMethodTypeAll; + config.additionalPaymentMethods = STPPaymentOptionTypeAll; config.shippingType = STPShippingTypeShipping; self.config = config; STPCustomerContext *customerContext = [STPMocks staticCustomerContextWithCustomer:[STPFixtures customerWithCardTokenAndSourceSources]]; diff --git a/Tests/Tests/STPPaymentMethodsViewControllerLocalizationTests.m b/Tests/Tests/STPPaymentMethodsViewControllerLocalizationTests.m index 3e681b286f9..e3fade1da81 100644 --- a/Tests/Tests/STPPaymentMethodsViewControllerLocalizationTests.m +++ b/Tests/Tests/STPPaymentMethodsViewControllerLocalizationTests.m @@ -29,7 +29,7 @@ - (void)performSnapshotTestForLanguage:(NSString *)language { STPPaymentConfiguration *config = [STPFixtures paymentConfiguration]; config.companyName = @"Test Company"; config.requiredBillingAddressFields = STPBillingAddressFieldsFull; - config.additionalPaymentMethods = STPPaymentMethodTypeAll; + config.additionalPaymentMethods = STPPaymentOptionTypeAll; STPTheme *theme = [STPTheme defaultTheme]; id customerContext = [STPMocks staticCustomerContextWithCustomer:[STPFixtures customerWithCardTokenAndSourceSources]]; id delegate = OCMProtocolMock(@protocol(STPPaymentMethodsViewControllerDelegate)); diff --git a/Tests/Tests/STPPaymentMethodsViewControllerTest.m b/Tests/Tests/STPPaymentMethodsViewControllerTest.m index 84ee3b49efd..2004862d0bd 100644 --- a/Tests/Tests/STPPaymentMethodsViewControllerTest.m +++ b/Tests/Tests/STPPaymentMethodsViewControllerTest.m @@ -43,7 +43,7 @@ - (STPPaymentMethodsViewController *)buildViewControllerWithCustomer:(STPCustome - (void)testInitWithNoSourcesAndConfigWithUseSourcesOffAndCardAvailable { STPCustomer *customer = [STPFixtures customerWithNoSources]; STPPaymentConfiguration *config = [STPFixtures paymentConfiguration]; - config.additionalPaymentMethods = STPPaymentMethodTypeNone; + config.additionalPaymentMethods = STPPaymentOptionTypeNone; iddelegate = OCMProtocolMock(@protocol(STPPaymentMethodsViewControllerDelegate)); STPPaymentMethodsViewController *sut = [self buildViewControllerWithCustomer:customer configuration:config @@ -58,7 +58,7 @@ - (void)testInitWithNoSourcesAndConfigWithUseSourcesOffAndCardAvailable { - (void)testInitWithSingleCardTokenSourceAndCardAvailable { STPCustomer *customer = [STPFixtures customerWithSingleCardTokenSource]; STPPaymentConfiguration *config = [STPFixtures paymentConfiguration]; - config.additionalPaymentMethods = STPPaymentMethodTypeAll; + config.additionalPaymentMethods = STPPaymentOptionTypeAll; iddelegate = OCMProtocolMock(@protocol(STPPaymentMethodsViewControllerDelegate)); STPPaymentMethodsViewController *sut = [self buildViewControllerWithCustomer:customer configuration:config @@ -73,7 +73,7 @@ - (void)testInitWithSingleCardTokenSourceAndCardAvailable { - (void)testInitWithSingleCardSourceSourceAndCardAvailable { STPCustomer *customer = [STPFixtures customerWithSingleCardSourceSource]; STPPaymentConfiguration *config = [STPFixtures paymentConfiguration]; - config.additionalPaymentMethods = STPPaymentMethodTypeNone; + config.additionalPaymentMethods = STPPaymentOptionTypeNone; iddelegate = OCMProtocolMock(@protocol(STPPaymentMethodsViewControllerDelegate)); STPPaymentMethodsViewController *sut = [self buildViewControllerWithCustomer:customer configuration:config @@ -204,7 +204,7 @@ - (void)testCreatesCardSources { STPSource *source = (STPSource *)obj; return source.stripeID == expectedSource.stripeID; }; - BOOL (^paymentMethodChecker)(id) = ^BOOL(id obj) { + BOOL (^paymentMethodChecker)(id) = ^BOOL(id obj) { STPSource *source = (STPSource *)obj; return source.cardDetails.last4 == expectedSource.cardDetails.last4; }; diff --git a/Tests/Tests/STPSourceTest.m b/Tests/Tests/STPSourceTest.m index eb6e33b5899..d5f455251dd 100644 --- a/Tests/Tests/STPSourceTest.m +++ b/Tests/Tests/STPSourceTest.m @@ -455,7 +455,7 @@ - (void)testDecodingSource_sepa_debit { XCTAssertEqualObjects(source.allResponseFields, [response stp_dictionaryByRemovingNulls]); } -#pragma mark - STPPaymentMethod Tests +#pragma mark - STPPaymentOption Tests - (NSArray *)possibleAPIResponses { return @[[STPTestUtils jsonNamed:STPTestJSONSourceCard], From 2bdf4a5937eceb0b868f263bbac42f06eb3b10f1 Mon Sep 17 00:00:00 2001 From: Yuki Tokuhiro Date: Mon, 4 Mar 2019 15:38:17 -0800 Subject: [PATCH 02/11] Rename STPPaymentMethodTuple -> STPPaymentOptionTuple --- Stripe.xcodeproj/project.pbxproj | 24 ++++----- Stripe/STPCustomer+SourceTuple.h | 4 +- Stripe/STPCustomer+SourceTuple.m | 10 ++-- Stripe/STPPaymentContext+Private.h | 4 +- Stripe/STPPaymentContext.m | 22 ++++---- Stripe/STPPaymentMethodTuple.h | 28 ---------- Stripe/STPPaymentMethodTuple.m | 53 ------------------- .../STPPaymentMethodsInternalViewController.h | 6 +-- .../STPPaymentMethodsInternalViewController.m | 18 +++---- .../STPPaymentMethodsViewController+Private.h | 4 +- Stripe/STPPaymentMethodsViewController.m | 28 +++++----- Stripe/STPPaymentOptionTuple.h | 28 ++++++++++ Stripe/STPPaymentOptionTuple.m | 53 +++++++++++++++++++ Tests/Tests/STPCustomerSourceTupleTest.m | 10 ++-- 14 files changed, 146 insertions(+), 146 deletions(-) delete mode 100644 Stripe/STPPaymentMethodTuple.h delete mode 100644 Stripe/STPPaymentMethodTuple.m create mode 100644 Stripe/STPPaymentOptionTuple.h create mode 100644 Stripe/STPPaymentOptionTuple.m diff --git a/Stripe.xcodeproj/project.pbxproj b/Stripe.xcodeproj/project.pbxproj index a26bc2a9920..0ba1a7a34f7 100644 --- a/Stripe.xcodeproj/project.pbxproj +++ b/Stripe.xcodeproj/project.pbxproj @@ -276,8 +276,8 @@ 04E01F8A21AA55E30061402F /* recorded_network_traffic in Resources */ = {isa = PBXBuildFile; fileRef = 04E01F8921AA55E30061402F /* recorded_network_traffic */; }; 04E32A9D1B7A9490009C9E35 /* STPPaymentCardTextField.h in Headers */ = {isa = PBXBuildFile; fileRef = 04E32A9C1B7A9490009C9E35 /* STPPaymentCardTextField.h */; settings = {ATTRIBUTES = (Public, ); }; }; 04E32AA01B7A9490009C9E35 /* STPPaymentCardTextField.h in Headers */ = {isa = PBXBuildFile; fileRef = 04E32A9C1B7A9490009C9E35 /* STPPaymentCardTextField.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 04E39F541CECF7A100AF3B96 /* STPPaymentMethodTuple.h in Headers */ = {isa = PBXBuildFile; fileRef = 04E39F501CECF7A100AF3B96 /* STPPaymentMethodTuple.h */; }; - 04E39F551CECF7A100AF3B96 /* STPPaymentMethodTuple.m in Sources */ = {isa = PBXBuildFile; fileRef = 04E39F511CECF7A100AF3B96 /* STPPaymentMethodTuple.m */; }; + 04E39F541CECF7A100AF3B96 /* STPPaymentOptionTuple.h in Headers */ = {isa = PBXBuildFile; fileRef = 04E39F501CECF7A100AF3B96 /* STPPaymentOptionTuple.h */; }; + 04E39F551CECF7A100AF3B96 /* STPPaymentOptionTuple.m in Sources */ = {isa = PBXBuildFile; fileRef = 04E39F511CECF7A100AF3B96 /* STPPaymentOptionTuple.m */; }; 04E39F581CECF9A800AF3B96 /* STPPaymentMethodsViewController+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 04E39F561CECF9A800AF3B96 /* STPPaymentMethodsViewController+Private.h */; }; 04E39F5C1CECFAFD00AF3B96 /* STPPaymentContext+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 04E39F5A1CECFAFD00AF3B96 /* STPPaymentContext+Private.h */; }; 04E39F6A1CED48D500AF3B96 /* UIBarButtonItem+Stripe.h in Headers */ = {isa = PBXBuildFile; fileRef = 04E39F681CED48D500AF3B96 /* UIBarButtonItem+Stripe.h */; }; @@ -303,8 +303,8 @@ 04F94DA31D229F18004FC826 /* STPAddressViewModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 049A3FAC1CC9AA9900F57DE7 /* STPAddressViewModel.h */; }; 04F94DA41D229F1C004FC826 /* STPAddressViewModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 049A3FAD1CC9AA9900F57DE7 /* STPAddressViewModel.m */; }; 04F94DA51D229F21004FC826 /* STPPaymentContext+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 04E39F5A1CECFAFD00AF3B96 /* STPPaymentContext+Private.h */; }; - 04F94DA81D229F2F004FC826 /* STPPaymentMethodTuple.h in Headers */ = {isa = PBXBuildFile; fileRef = 04E39F501CECF7A100AF3B96 /* STPPaymentMethodTuple.h */; }; - 04F94DA91D229F32004FC826 /* STPPaymentMethodTuple.m in Sources */ = {isa = PBXBuildFile; fileRef = 04E39F511CECF7A100AF3B96 /* STPPaymentMethodTuple.m */; }; + 04F94DA81D229F2F004FC826 /* STPPaymentOptionTuple.h in Headers */ = {isa = PBXBuildFile; fileRef = 04E39F501CECF7A100AF3B96 /* STPPaymentOptionTuple.h */; }; + 04F94DA91D229F32004FC826 /* STPPaymentOptionTuple.m in Sources */ = {isa = PBXBuildFile; fileRef = 04E39F511CECF7A100AF3B96 /* STPPaymentOptionTuple.m */; }; 04F94DAA1D229F36004FC826 /* STPTheme.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BC29A31CD8697900318357 /* STPTheme.m */; }; 04F94DAB1D229F3F004FC826 /* UIBarButtonItem+Stripe.h in Headers */ = {isa = PBXBuildFile; fileRef = 04E39F681CED48D500AF3B96 /* UIBarButtonItem+Stripe.h */; }; 04F94DAC1D229F42004FC826 /* UIBarButtonItem+Stripe.m in Sources */ = {isa = PBXBuildFile; fileRef = 04E39F691CED48D500AF3B96 /* UIBarButtonItem+Stripe.m */; }; @@ -1051,8 +1051,8 @@ 04E01F8421AA36320061402F /* STPNetworkStubbingTestCase.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = STPNetworkStubbingTestCase.m; sourceTree = ""; }; 04E01F8921AA55E30061402F /* recorded_network_traffic */ = {isa = PBXFileReference; lastKnownFileType = folder; name = recorded_network_traffic; path = Tests/recorded_network_traffic; sourceTree = SOURCE_ROOT; }; 04E32A9C1B7A9490009C9E35 /* STPPaymentCardTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = STPPaymentCardTextField.h; path = PublicHeaders/STPPaymentCardTextField.h; sourceTree = ""; }; - 04E39F501CECF7A100AF3B96 /* STPPaymentMethodTuple.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STPPaymentMethodTuple.h; sourceTree = ""; }; - 04E39F511CECF7A100AF3B96 /* STPPaymentMethodTuple.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPPaymentMethodTuple.m; sourceTree = ""; }; + 04E39F501CECF7A100AF3B96 /* STPPaymentOptionTuple.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STPPaymentOptionTuple.h; sourceTree = ""; }; + 04E39F511CECF7A100AF3B96 /* STPPaymentOptionTuple.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPPaymentOptionTuple.m; sourceTree = ""; }; 04E39F561CECF9A800AF3B96 /* STPPaymentMethodsViewController+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "STPPaymentMethodsViewController+Private.h"; sourceTree = ""; }; 04E39F5A1CECFAFD00AF3B96 /* STPPaymentContext+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "STPPaymentContext+Private.h"; sourceTree = ""; }; 04E39F681CED48D500AF3B96 /* UIBarButtonItem+Stripe.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIBarButtonItem+Stripe.h"; sourceTree = ""; }; @@ -2031,8 +2031,8 @@ 04B31DD81D09A4DC00EF1631 /* STPPaymentConfiguration+Private.h */, F12C8DBE1D63DE9F00ADA0D7 /* STPPaymentContextAmountModel.h */, F12C8DBF1D63DE9F00ADA0D7 /* STPPaymentContextAmountModel.m */, - 04E39F501CECF7A100AF3B96 /* STPPaymentMethodTuple.h */, - 04E39F511CECF7A100AF3B96 /* STPPaymentMethodTuple.m */, + 04E39F501CECF7A100AF3B96 /* STPPaymentOptionTuple.h */, + 04E39F511CECF7A100AF3B96 /* STPPaymentOptionTuple.m */, F1728CF61EAAA8B2002E0C29 /* View Controllers */, F1728CF81EAAA945002E0C29 /* Views */, ); @@ -2296,7 +2296,7 @@ 8B429AD91EF9D4B500F95F34 /* STPBankAccountParams+Private.h in Headers */, F1BEB2FE1F3508BB0043F48C /* NSError+Stripe.h in Headers */, 04E32AA01B7A9490009C9E35 /* STPPaymentCardTextField.h in Headers */, - 04F94DA81D229F2F004FC826 /* STPPaymentMethodTuple.h in Headers */, + 04F94DA81D229F2F004FC826 /* STPPaymentOptionTuple.h in Headers */, 0438EF491B74183100D506CC /* STPCardBrand.h in Headers */, F12C8DC21D63DE9F00ADA0D7 /* STPPaymentContextAmountModel.h in Headers */, F1D96F971DC7D82400477E64 /* STPLocalizationUtils.h in Headers */, @@ -2463,7 +2463,7 @@ 04CDE5C91BC20B1D00548833 /* STPBankAccountParams.h in Headers */, 049A3F891CC73C7100F57DE7 /* STPPaymentContext.h in Headers */, B36C6D6D2193671400D17575 /* STPPaymentIntentSourceAction.h in Headers */, - 04E39F541CECF7A100AF3B96 /* STPPaymentMethodTuple.h in Headers */, + 04E39F541CECF7A100AF3B96 /* STPPaymentOptionTuple.h in Headers */, F15232241EA9303800D65C67 /* STPURLCallbackHandler.h in Headers */, C18410761EC2529400178149 /* STPEphemeralKeyManager.h in Headers */, F1A7A0531FE053CE00B47D4A /* FauxPasAnnotations.h in Headers */, @@ -3026,7 +3026,7 @@ C1271A3E1E3FA4E800F25DFE /* STPSectionHeaderView.m in Sources */, B36C6D702193671400D17575 /* STPPaymentIntentSourceAction.m in Sources */, F12829DD1D7747E4008B10D6 /* STPBundleLocator.m in Sources */, - 04F94DA91D229F32004FC826 /* STPPaymentMethodTuple.m in Sources */, + 04F94DA91D229F32004FC826 /* STPPaymentOptionTuple.m in Sources */, C15608E01FE08F2E0032AE66 /* UIView+Stripe_SafeAreaBounds.m in Sources */, F1A2F92F1EEB6A70006B0456 /* NSCharacterSet+Stripe.m in Sources */, 36A734282121F8A700784615 /* STPCardValidator+Private.m in Sources */, @@ -3223,7 +3223,7 @@ 04CDE5B81BC1F1F100548833 /* STPCardParams.m in Sources */, F152322C1EA9306100D65C67 /* NSURLComponents+Stripe.m in Sources */, 0451CC461C49AE1C003B2CA6 /* STPPaymentResult.m in Sources */, - 04E39F551CECF7A100AF3B96 /* STPPaymentMethodTuple.m in Sources */, + 04E39F551CECF7A100AF3B96 /* STPPaymentOptionTuple.m in Sources */, C11810961CC6C4700022FB55 /* PKPaymentAuthorizationViewController+Stripe_Blocks.m in Sources */, 0439B9891C454F97005A1ED5 /* STPPaymentMethodsViewController.m in Sources */, 04A488441CA3580700506E53 /* UINavigationController+Stripe_Completion.m in Sources */, diff --git a/Stripe/STPCustomer+SourceTuple.h b/Stripe/STPCustomer+SourceTuple.h index 3a2b3d0af09..5ab47a9dd15 100644 --- a/Stripe/STPCustomer+SourceTuple.h +++ b/Stripe/STPCustomer+SourceTuple.h @@ -8,7 +8,7 @@ #import -#import "STPPaymentMethodTuple.h" +#import "STPPaymentOptionTuple.h" NS_ASSUME_NONNULL_BEGIN @@ -22,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN @return A new tuple ready to be used by the SDK's UI elements */ -- (STPPaymentMethodTuple *)filteredSourceTupleForUIWithConfiguration:(STPPaymentConfiguration *)configuration; +- (STPPaymentOptionTuple *)filteredSourceTupleForUIWithConfiguration:(STPPaymentConfiguration *)configuration; @end diff --git a/Stripe/STPCustomer+SourceTuple.m b/Stripe/STPCustomer+SourceTuple.m index 2f8f1c80777..8232f77b3af 100644 --- a/Stripe/STPCustomer+SourceTuple.m +++ b/Stripe/STPCustomer+SourceTuple.m @@ -10,14 +10,14 @@ #import "STPCard.h" #import "STPPaymentConfiguration+Private.h" -#import "STPPaymentMethodTuple.h" +#import "STPPaymentOptionTuple.h" #import "STPSource+Private.h" NS_ASSUME_NONNULL_BEGIN @implementation STPCustomer (SourceTuple) -- (STPPaymentMethodTuple *)filteredSourceTupleForUIWithConfiguration:(STPPaymentConfiguration *)configuration { +- (STPPaymentOptionTuple *)filteredSourceTupleForUIWithConfiguration:(STPPaymentConfiguration *)configuration { id _Nullable selectedMethod = nil; NSMutableArray> *methods = [NSMutableArray array]; for (id customerSource in self.sources) { @@ -40,9 +40,9 @@ - (STPPaymentMethodTuple *)filteredSourceTupleForUIWithConfiguration:(STPPayment } } - return [STPPaymentMethodTuple tupleWithPaymentMethods:methods - selectedPaymentMethod:selectedMethod - addApplePayMethod:configuration.applePayEnabled]; + return [STPPaymentOptionTuple tupleWithPaymentOptions:methods + selectedPaymentOption:selectedMethod + addApplePayOption:configuration.applePayEnabled]; } @end diff --git a/Stripe/STPPaymentContext+Private.h b/Stripe/STPPaymentContext+Private.h index 6562b38b4bd..1b94a32958d 100644 --- a/Stripe/STPPaymentContext+Private.h +++ b/Stripe/STPPaymentContext+Private.h @@ -8,7 +8,7 @@ #import -#import "STPPaymentMethodTuple.h" +#import "STPPaymentOptionTuple.h" #import "STPPromise.h" #import "STPShippingAddressViewController.h" @@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN @interface STPPaymentContext (Private) -@property (nonatomic, readonly) STPPromise *currentValuePromise; +@property (nonatomic, readonly) STPPromise *currentValuePromise; - (void)removePaymentMethod:(id)paymentMethodToRemove; diff --git a/Stripe/STPPaymentContext.m b/Stripe/STPPaymentContext.m index e784b696277..b1e0ea746b3 100644 --- a/Stripe/STPPaymentContext.m +++ b/Stripe/STPPaymentContext.m @@ -17,7 +17,7 @@ #import "STPPaymentConfiguration+Private.h" #import "STPPaymentContext+Private.h" #import "STPPaymentContextAmountModel.h" -#import "STPPaymentMethodTuple.h" +#import "STPPaymentOptionTuple.h" #import "STPPromise.h" #import "STPShippingMethodsViewController.h" #import "STPWeakStrongMacros.h" @@ -44,7 +44,7 @@ @interface STPPaymentContext() apiAdapter; @property (nonatomic) STPAPIClient *apiClient; -@property (nonatomic) STPPromise *loadingPromise; +@property (nonatomic) STPPromise *loadingPromise; // these wrap hostViewController's promises because the hostVC is nil at init-time @property (nonatomic) STPVoidPromise *willAppearPromise; @@ -118,10 +118,10 @@ - (void)retryLoading { [customerContext clearCachedCustomer]; } WEAK(self); - self.loadingPromise = [[[STPPromise new] onSuccess:^(STPPaymentMethodTuple *tuple) { + self.loadingPromise = [[[STPPromise new] onSuccess:^(STPPaymentOptionTuple *tuple) { STRONG(self); - self.paymentMethods = tuple.paymentMethods; - self.selectedPaymentMethod = tuple.selectedPaymentMethod; + self.paymentMethods = tuple.paymentOptions; + self.selectedPaymentMethod = tuple.selectedPaymentOption; }] onFailure:^(NSError * _Nonnull error) { STRONG(self); if (self.hostViewController) { @@ -151,7 +151,7 @@ - (void)retryLoading { self.shippingAddressNeedsVerification = YES; } - STPPaymentMethodTuple *paymentTuple = [customer filteredSourceTupleForUIWithConfiguration:self.configuration]; + STPPaymentOptionTuple *paymentTuple = [customer filteredSourceTupleForUIWithConfiguration:self.configuration]; [self.loadingPromise succeed:paymentTuple]; }); @@ -189,12 +189,12 @@ - (void)setDelegate:(id)delegate { }]; } -- (STPPromise *)currentValuePromise { +- (STPPromise *)currentValuePromise { WEAK(self); - return (STPPromise *)[self.loadingPromise map:^id _Nonnull(__unused STPPaymentMethodTuple *value) { + return (STPPromise *)[self.loadingPromise map:^id _Nonnull(__unused STPPaymentOptionTuple *value) { STRONG(self); - return [STPPaymentMethodTuple tupleWithPaymentMethods:self.paymentMethods - selectedPaymentMethod:self.selectedPaymentMethod]; + return [STPPaymentOptionTuple tupleWithPaymentOptions:self.paymentMethods + selectedPaymentOption:self.selectedPaymentMethod]; }]; } @@ -566,7 +566,7 @@ - (void)requestPayment { [[[self.didAppearPromise voidFlatMap:^STPPromise * _Nonnull{ STRONG(self); return self.loadingPromise; - }] onSuccess:^(__unused STPPaymentMethodTuple *tuple) { + }] onSuccess:^(__unused STPPaymentOptionTuple *tuple) { STRONG(self); if (!self) { return; diff --git a/Stripe/STPPaymentMethodTuple.h b/Stripe/STPPaymentMethodTuple.h deleted file mode 100644 index 3727d09d311..00000000000 --- a/Stripe/STPPaymentMethodTuple.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// STPPaymentMethodTuple.h -// Stripe -// -// Created by Jack Flintermann on 5/17/16. -// Copyright © 2016 Stripe, Inc. All rights reserved. -// - -#import -#import "STPPaymentOption.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface STPPaymentMethodTuple : NSObject - -+ (instancetype)tupleWithPaymentMethods:(NSArray> *)paymentMethods - selectedPaymentMethod:(nullable id)selectedPaymentMethod; - -+ (instancetype)tupleWithPaymentMethods:(NSArray> *)paymentMethods - selectedPaymentMethod:(nullable id)selectedPaymentMethod - addApplePayMethod:(BOOL)applePayEnabled; - -@property (nonatomic, nullable, readonly) id selectedPaymentMethod; -@property (nonatomic, readonly) NSArray> *paymentMethods; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Stripe/STPPaymentMethodTuple.m b/Stripe/STPPaymentMethodTuple.m deleted file mode 100644 index 07f2d65b249..00000000000 --- a/Stripe/STPPaymentMethodTuple.m +++ /dev/null @@ -1,53 +0,0 @@ -// -// STPPaymentMethodTuple.m -// Stripe -// -// Created by Jack Flintermann on 5/17/16. -// Copyright © 2016 Stripe, Inc. All rights reserved. -// - -#import "STPPaymentMethodTuple.h" -#import "STPApplePay.h" -#import "STPCard.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface STPPaymentMethodTuple() - -@property (nonatomic, nullable) id selectedPaymentMethod; -@property (nonatomic) NSArray> *paymentMethods; - -@end - -@implementation STPPaymentMethodTuple - -+ (instancetype)tupleWithPaymentMethods:(NSArray> *)paymentMethods - selectedPaymentMethod:(nullable id)selectedPaymentMethod { - STPPaymentMethodTuple *tuple = [self new]; - tuple.paymentMethods = paymentMethods ?: @[]; - tuple.selectedPaymentMethod = selectedPaymentMethod; - return tuple; -} - -+ (instancetype)tupleWithPaymentMethods:(NSArray> *)paymentMethods - selectedPaymentMethod:(nullable id)selectedPaymentMethod - addApplePayMethod:(BOOL)applePayEnabled { - NSMutableArray *mutablePaymentMethods = paymentMethods.mutableCopy; - id _Nullable selected = selectedPaymentMethod; - - if (applePayEnabled) { - STPApplePay *applePay = [STPApplePay new]; - [mutablePaymentMethods addObject:applePay]; - - if (!selected) { - selected = applePay; - } - } - - return [self tupleWithPaymentMethods:mutablePaymentMethods.copy - selectedPaymentMethod:selected]; -} - -@end - -NS_ASSUME_NONNULL_END diff --git a/Stripe/STPPaymentMethodsInternalViewController.h b/Stripe/STPPaymentMethodsInternalViewController.h index 499bc669093..a9197905a7e 100644 --- a/Stripe/STPPaymentMethodsInternalViewController.h +++ b/Stripe/STPPaymentMethodsInternalViewController.h @@ -9,7 +9,7 @@ #import "STPCoreTableViewController.h" #import "STPBlocks.h" -@class STPAddress, STPCustomerContext, STPPaymentConfiguration, STPPaymentMethodTuple, STPToken, STPUserInformation; +@class STPAddress, STPCustomerContext, STPPaymentConfiguration, STPPaymentOptionTuple, STPToken, STPUserInformation; @protocol STPPaymentOption; @@ -31,10 +31,10 @@ NS_ASSUME_NONNULL_BEGIN theme:(STPTheme *)theme prefilledInformation:(nullable STPUserInformation *)prefilledInformation shippingAddress:(nullable STPAddress *)shippingAddress - paymentMethodTuple:(STPPaymentMethodTuple *)tuple + paymentMethodTuple:(STPPaymentOptionTuple *)tuple delegate:(id)delegate; -- (void)updateWithPaymentMethodTuple:(STPPaymentMethodTuple *)tuple; +- (void)updateWithPaymentMethodTuple:(STPPaymentOptionTuple *)tuple; @property (nonatomic, strong, nullable) UIView *customFooterView; @property (nonatomic, assign) BOOL createsCardSources; diff --git a/Stripe/STPPaymentMethodsInternalViewController.m b/Stripe/STPPaymentMethodsInternalViewController.m index 5ddddcc5f78..24ba72e31bd 100644 --- a/Stripe/STPPaymentMethodsInternalViewController.m +++ b/Stripe/STPPaymentMethodsInternalViewController.m @@ -18,7 +18,7 @@ #import "STPImageLibrary+Private.h" #import "STPLocalizationUtils.h" #import "STPPaymentMethodTableViewCell.h" -#import "STPPaymentMethodTuple.h" +#import "STPPaymentOptionTuple.h" #import "STPPromise.h" #import "STPSource.h" #import "STPSourceProtocol.h" @@ -53,7 +53,7 @@ - (instancetype)initWithConfiguration:(STPPaymentConfiguration *)configuration theme:(STPTheme *)theme prefilledInformation:(nullable STPUserInformation *)prefilledInformation shippingAddress:(nullable STPAddress *)shippingAddress - paymentMethodTuple:(STPPaymentMethodTuple *)tuple + paymentMethodTuple:(STPPaymentOptionTuple *)tuple delegate:(id)delegate { self = [super initWithTheme:theme]; if (self) { @@ -62,8 +62,8 @@ - (instancetype)initWithConfiguration:(STPPaymentConfiguration *)configuration _apiAdapter = customerContext; _prefilledInformation = prefilledInformation; _shippingAddress = shippingAddress; - _paymentMethods = tuple.paymentMethods; - _selectedPaymentMethod = tuple.selectedPaymentMethod; + _paymentMethods = tuple.paymentOptions; + _selectedPaymentMethod = tuple.selectedPaymentOption; _delegate = delegate; _createsCardSources = NO; @@ -174,14 +174,14 @@ - (BOOL)isPaymentMethodDetachable:(id)paymentMethod { return YES; } -- (void)updateWithPaymentMethodTuple:(STPPaymentMethodTuple *)tuple { - if ([self.paymentMethods isEqualToArray:tuple.paymentMethods] && - [self.selectedPaymentMethod isEqual:tuple.selectedPaymentMethod]) { +- (void)updateWithPaymentMethodTuple:(STPPaymentOptionTuple *)tuple { + if ([self.paymentMethods isEqualToArray:tuple.paymentOptions] && + [self.selectedPaymentMethod isEqual:tuple.selectedPaymentOption]) { return; } - self.paymentMethods = tuple.paymentMethods; - self.selectedPaymentMethod = tuple.selectedPaymentMethod; + self.paymentMethods = tuple.paymentOptions; + self.selectedPaymentMethod = tuple.selectedPaymentOption; // Reload card list section NSMutableIndexSet *sections = [NSMutableIndexSet indexSetWithIndex:PaymentMethodSectionCardList]; diff --git a/Stripe/STPPaymentMethodsViewController+Private.h b/Stripe/STPPaymentMethodsViewController+Private.h index 1a8de6a625f..5375abb4fe3 100644 --- a/Stripe/STPPaymentMethodsViewController+Private.h +++ b/Stripe/STPPaymentMethodsViewController+Private.h @@ -11,14 +11,14 @@ #import "STPBackendAPIAdapter.h" #import "STPPaymentConfiguration.h" #import "STPPaymentOption.h" -#import "STPPaymentMethodTuple.h" +#import "STPPaymentOptionTuple.h" #import "STPPromise.h" @interface STPPaymentMethodsViewController (Private) - (instancetype)initWithConfiguration:(STPPaymentConfiguration *)configuration apiAdapter:(id)apiAdapter - loadingPromise:(STPPromise *)loadingPromise + loadingPromise:(STPPromise *)loadingPromise theme:(STPTheme *)theme shippingAddress:(STPAddress *)shippingAddress delegate:(id)delegate; diff --git a/Stripe/STPPaymentMethodsViewController.m b/Stripe/STPPaymentMethodsViewController.m index c83249457d8..9fbd5eda668 100644 --- a/Stripe/STPPaymentMethodsViewController.m +++ b/Stripe/STPPaymentMethodsViewController.m @@ -20,7 +20,7 @@ #import "STPPaymentConfiguration+Private.h" #import "STPPaymentContext+Private.h" #import "STPPaymentContext.h" -#import "STPPaymentMethodTuple.h" +#import "STPPaymentOptionTuple.h" #import "STPPaymentMethodsInternalViewController.h" #import "STPPaymentMethodsViewController+Private.h" #import "STPSource.h" @@ -39,7 +39,7 @@ @interface STPPaymentMethodsViewController() apiAdapter; @property (nonatomic) STPAPIClient *apiClient; -@property (nonatomic) STPPromise *loadingPromise; +@property (nonatomic) STPPromise *loadingPromise; @property (nonatomic, weak) STPPaymentActivityIndicatorView *activityIndicator; @property (nonatomic, weak) UIViewController *internalViewController; @property (nonatomic) BOOL loading; @@ -68,7 +68,7 @@ - (instancetype)initWithConfiguration:(STPPaymentConfiguration *)configuration theme:(STPTheme *)theme apiAdapter:(id)apiAdapter delegate:(id)delegate { - STPPromise *promise = [self retrieveCustomerWithConfiguration:configuration apiAdapter:apiAdapter]; + STPPromise *promise = [self retrieveCustomerWithConfiguration:configuration apiAdapter:apiAdapter]; return [self initWithConfiguration:configuration apiAdapter:apiAdapter loadingPromise:promise @@ -77,15 +77,15 @@ - (instancetype)initWithConfiguration:(STPPaymentConfiguration *)configuration delegate:delegate]; } -- (STPPromise*)retrieveCustomerWithConfiguration:(STPPaymentConfiguration *)configuration +- (STPPromise*)retrieveCustomerWithConfiguration:(STPPaymentConfiguration *)configuration apiAdapter:(id)apiAdapter { - STPPromise *promise = [STPPromise new]; + STPPromise *promise = [STPPromise new]; [apiAdapter retrieveCustomer:^(STPCustomer * _Nullable customer, NSError * _Nullable error) { stpDispatchToMainThreadIfNecessary(^{ if (error) { [promise fail:error]; } else { - STPPaymentMethodTuple *paymentTuple = [customer filteredSourceTupleForUIWithConfiguration:configuration]; + STPPaymentOptionTuple *paymentTuple = [customer filteredSourceTupleForUIWithConfiguration:configuration]; [promise succeed:paymentTuple]; } }); @@ -102,13 +102,13 @@ - (void)createAndSetupViews { self.activityIndicator = activityIndicator; WEAK(self); - [self.loadingPromise onSuccess:^(STPPaymentMethodTuple *tuple) { + [self.loadingPromise onSuccess:^(STPPaymentOptionTuple *tuple) { STRONG(self); if (!self) { return; } UIViewController *internal; - if (tuple.paymentMethods.count > 0) { + if (tuple.paymentOptions.count > 0) { STPCustomerContext *customerContext = ([self.apiAdapter isKindOfClass:[STPCustomerContext class]]) ? (STPCustomerContext *)self.apiAdapter : nil; STPPaymentMethodsInternalViewController *payMethodsInternal = [[STPPaymentMethodsInternalViewController alloc] initWithConfiguration:self.configuration @@ -185,8 +185,8 @@ - (void)finishWithPaymentMethod:(id)paymentMethod { // Make this payment method the default source [self.apiAdapter selectDefaultCustomerSource:source completion:^(__unused NSError *error) { // Reload the internal payment methods view controller with the updated customer - STPPromise *promise = [self retrieveCustomerWithConfiguration:self.configuration apiAdapter:self.apiAdapter]; - [promise onSuccess:^(STPPaymentMethodTuple *tuple) { + STPPromise *promise = [self retrieveCustomerWithConfiguration:self.configuration apiAdapter:self.apiAdapter]; + [promise onSuccess:^(STPPaymentOptionTuple *tuple) { stpDispatchToMainThreadIfNecessary(^{ if ([self.internalViewController isKindOfClass:[STPPaymentMethodsInternalViewController class]]) { STPPaymentMethodsInternalViewController *paymentMethodsVC = (STPPaymentMethodsInternalViewController *)self.internalViewController; @@ -287,7 +287,7 @@ @implementation STPPaymentMethodsViewController (Private) - (instancetype)initWithConfiguration:(STPPaymentConfiguration *)configuration apiAdapter:(id)apiAdapter - loadingPromise:(STPPromise *)loadingPromise + loadingPromise:(STPPromise *)loadingPromise theme:(STPTheme *)theme shippingAddress:(STPAddress *)shippingAddress delegate:(id)delegate { @@ -305,16 +305,16 @@ - (instancetype)initWithConfiguration:(STPPaymentConfiguration *)configuration WEAK(self); [[[self.stp_didAppearPromise voidFlatMap:^STPPromise * _Nonnull{ return loadingPromise; - }] onSuccess:^(STPPaymentMethodTuple *tuple) { + }] onSuccess:^(STPPaymentOptionTuple *tuple) { STRONG(self); if (!self) { return; } - if (tuple.selectedPaymentMethod) { + if (tuple.selectedPaymentOption) { if ([self.delegate respondsToSelector:@selector(paymentMethodsViewController:didSelectPaymentMethod:)]) { [self.delegate paymentMethodsViewController:self - didSelectPaymentMethod:tuple.selectedPaymentMethod]; + didSelectPaymentMethod:tuple.selectedPaymentOption]; } } }] onFailure:^(NSError *error) { diff --git a/Stripe/STPPaymentOptionTuple.h b/Stripe/STPPaymentOptionTuple.h new file mode 100644 index 00000000000..95394b0cf01 --- /dev/null +++ b/Stripe/STPPaymentOptionTuple.h @@ -0,0 +1,28 @@ +// +// STPPaymentOptionTuple.h +// Stripe +// +// Created by Jack Flintermann on 5/17/16. +// Copyright © 2016 Stripe, Inc. All rights reserved. +// + +#import +#import "STPPaymentOption.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface STPPaymentOptionTuple : NSObject + ++ (instancetype)tupleWithPaymentOptions:(NSArray> *)paymentOptions + selectedPaymentOption:(nullable id)selectedPaymentOption; + ++ (instancetype)tupleWithPaymentOptions:(NSArray> *)paymentOptions + selectedPaymentOption:(nullable id)selectedPaymentOption + addApplePayOption:(BOOL)applePayEnabled; + +@property (nonatomic, nullable, readonly) id selectedPaymentOption; +@property (nonatomic, readonly) NSArray> *paymentOptions; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Stripe/STPPaymentOptionTuple.m b/Stripe/STPPaymentOptionTuple.m new file mode 100644 index 00000000000..216ad121de7 --- /dev/null +++ b/Stripe/STPPaymentOptionTuple.m @@ -0,0 +1,53 @@ +// +// STPPaymentOptionTuple.m +// Stripe +// +// Created by Jack Flintermann on 5/17/16. +// Copyright © 2016 Stripe, Inc. All rights reserved. +// + +#import "STPPaymentOptionTuple.h" +#import "STPApplePay.h" +#import "STPCard.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface STPPaymentOptionTuple() + +@property (nonatomic, nullable) id selectedPaymentOption; +@property (nonatomic) NSArray> *paymentOptions; + +@end + +@implementation STPPaymentOptionTuple + ++ (instancetype)tupleWithPaymentOptions:(NSArray> *)paymentOptions + selectedPaymentOption:(nullable id)selectedPaymentOption { + STPPaymentOptionTuple *tuple = [self new]; + tuple.paymentOptions = paymentOptions ?: @[]; + tuple.selectedPaymentOption = selectedPaymentOption; + return tuple; +} + ++ (instancetype)tupleWithPaymentOptions:(NSArray> *)paymentOptions + selectedPaymentOption:(nullable id)selectedPaymentOption + addApplePayOption:(BOOL)applePayEnabled { + NSMutableArray *mutablePaymentOptions = paymentOptions.mutableCopy; + id _Nullable selected = selectedPaymentOption; + + if (applePayEnabled) { + STPApplePay *applePay = [STPApplePay new]; + [mutablePaymentOptions addObject:applePay]; + + if (!selected) { + selected = applePay; + } + } + + return [self tupleWithPaymentOptions:mutablePaymentOptions.copy + selectedPaymentOption:selected]; +} + +@end + +NS_ASSUME_NONNULL_END diff --git a/Tests/Tests/STPCustomerSourceTupleTest.m b/Tests/Tests/STPCustomerSourceTupleTest.m index d473606cf29..b99b3214d23 100644 --- a/Tests/Tests/STPCustomerSourceTupleTest.m +++ b/Tests/Tests/STPCustomerSourceTupleTest.m @@ -40,19 +40,19 @@ - (void)performSourceTupleTestWithCustomer:(STPCustomer *)sut STPPaymentConfiguration *config = [STPMocks paymentConfigurationWithApplePaySupportingDevice]; config.additionalPaymentMethods = applePayEnabled ? STPPaymentOptionTypeAll : STPPaymentOptionTypeNone; - STPPaymentMethodTuple *tuple = [sut filteredSourceTupleForUIWithConfiguration:config]; + STPPaymentOptionTuple *tuple = [sut filteredSourceTupleForUIWithConfiguration:config]; XCTAssertNotNil(tuple); if (expectedSelectedSource) { - XCTAssertEqualObjects(tuple.selectedPaymentMethod, expectedSelectedSource); + XCTAssertEqualObjects(tuple.selectedPaymentOption, expectedSelectedSource); } else { - XCTAssertNil(tuple.selectedPaymentMethod); + XCTAssertNil(tuple.selectedPaymentOption); } - XCTAssertNotNil(tuple.paymentMethods); + XCTAssertNotNil(tuple.paymentOptions); - XCTAssertTrue(tuple.paymentMethods.count == expectedSourceCount); + XCTAssertTrue(tuple.paymentOptions.count == expectedSourceCount); } /** From c3d5dbe5fa11bd6376b37b8ea565a14643c7962d Mon Sep 17 00:00:00 2001 From: Yuki Tokuhiro Date: Mon, 4 Mar 2019 15:52:34 -0800 Subject: [PATCH 03/11] Rename STPPaymentMethods*ViewController --- .../UI Examples/BrowseViewController.swift | 20 +++--- Stripe.xcodeproj/project.pbxproj | 60 +++++++++--------- Stripe/PublicHeaders/STPBackendAPIAdapter.h | 2 +- .../PublicHeaders/STPPaymentConfiguration.h | 4 +- Stripe/PublicHeaders/STPPaymentContext.h | 4 +- Stripe/PublicHeaders/STPPaymentOption.h | 2 +- ...er.h => STPPaymentOptionsViewController.h} | 36 +++++------ Stripe/PublicHeaders/Stripe.h | 2 +- .../UINavigationBar+Stripe_Theme.h | 2 +- Stripe/STPAnalyticsClient.m | 8 +-- Stripe/STPCustomer+SourceTuple.h | 2 +- Stripe/STPPaymentContext+Private.h | 2 +- Stripe/STPPaymentContext.m | 18 +++--- ...STPPaymentOptionsInternalViewController.h} | 8 +-- ...STPPaymentOptionsInternalViewController.m} | 12 ++-- ...STPPaymentOptionsViewController+Private.h} | 6 +- ...er.m => STPPaymentOptionsViewController.m} | 26 ++++---- .../testChinese@2x.png | Bin .../testDutch@2x.png | Bin .../testEnglish@2x.png | Bin .../testFrench@2x.png | Bin .../testGerman@2x.png | Bin .../testItalian@2x.png | Bin .../testJapanese@2x.png | Bin .../testSpanish@2x.png | Bin ...ntMethodsViewControllerLocalizationTests.m | 10 +-- .../STPPaymentMethodsViewControllerTest.m | 54 ++++++++-------- Tests/Tests/UINavigationBar+StripeTest.m | 10 +-- 28 files changed, 144 insertions(+), 144 deletions(-) rename Stripe/PublicHeaders/{STPPaymentMethodsViewController.h => STPPaymentOptionsViewController.h} (86%) rename Stripe/{STPPaymentMethodsInternalViewController.h => STPPaymentOptionsInternalViewController.h} (86%) rename Stripe/{STPPaymentMethodsInternalViewController.m => STPPaymentOptionsInternalViewController.m} (97%) rename Stripe/{STPPaymentMethodsViewController+Private.h => STPPaymentOptionsViewController+Private.h} (81%) rename Stripe/{STPPaymentMethodsViewController.m => STPPaymentOptionsViewController.m} (94%) rename Tests/ReferenceImages_64/{STPPaymentMethodsViewControllerLocalizationTests => STPPaymentOptionsViewControllerLocalizationTests}/testChinese@2x.png (100%) rename Tests/ReferenceImages_64/{STPPaymentMethodsViewControllerLocalizationTests => STPPaymentOptionsViewControllerLocalizationTests}/testDutch@2x.png (100%) rename Tests/ReferenceImages_64/{STPPaymentMethodsViewControllerLocalizationTests => STPPaymentOptionsViewControllerLocalizationTests}/testEnglish@2x.png (100%) rename Tests/ReferenceImages_64/{STPPaymentMethodsViewControllerLocalizationTests => STPPaymentOptionsViewControllerLocalizationTests}/testFrench@2x.png (100%) rename Tests/ReferenceImages_64/{STPPaymentMethodsViewControllerLocalizationTests => STPPaymentOptionsViewControllerLocalizationTests}/testGerman@2x.png (100%) rename Tests/ReferenceImages_64/{STPPaymentMethodsViewControllerLocalizationTests => STPPaymentOptionsViewControllerLocalizationTests}/testItalian@2x.png (100%) rename Tests/ReferenceImages_64/{STPPaymentMethodsViewControllerLocalizationTests => STPPaymentOptionsViewControllerLocalizationTests}/testJapanese@2x.png (100%) rename Tests/ReferenceImages_64/{STPPaymentMethodsViewControllerLocalizationTests => STPPaymentOptionsViewControllerLocalizationTests}/testSpanish@2x.png (100%) diff --git a/Example/UI Examples/BrowseViewController.swift b/Example/UI Examples/BrowseViewController.swift index 7738d6e0c54..7ccb87804ae 100644 --- a/Example/UI Examples/BrowseViewController.swift +++ b/Example/UI Examples/BrowseViewController.swift @@ -9,13 +9,13 @@ import UIKit import Stripe -class BrowseViewController: UITableViewController, STPAddCardViewControllerDelegate, STPPaymentMethodsViewControllerDelegate, STPShippingAddressViewControllerDelegate { +class BrowseViewController: UITableViewController, STPAddCardViewControllerDelegate, STPPaymentOptionsViewControllerDelegate, STPShippingAddressViewControllerDelegate { enum Demo: Int { static let count = 5 case STPPaymentCardTextField case STPAddCardViewController - case STPPaymentMethodsViewController + case STPPaymentOptionsViewController case STPShippingInfoViewController case ChangeTheme @@ -23,7 +23,7 @@ class BrowseViewController: UITableViewController, STPAddCardViewControllerDeleg switch self { case .STPPaymentCardTextField: return "Card Field" case .STPAddCardViewController: return "Card Form with Billing Address" - case .STPPaymentMethodsViewController: return "Payment Method Picker" + case .STPPaymentOptionsViewController: return "Payment Method Picker" case .STPShippingInfoViewController: return "Shipping Info Form" case .ChangeTheme: return "Change Theme" } @@ -33,7 +33,7 @@ class BrowseViewController: UITableViewController, STPAddCardViewControllerDeleg switch self { case .STPPaymentCardTextField: return "STPPaymentCardTextField" case .STPAddCardViewController: return "STPAddCardViewController" - case .STPPaymentMethodsViewController: return "STPPaymentMethodsViewController" + case .STPPaymentOptionsViewController: return "STPPaymentOptionsViewController" case .STPShippingInfoViewController: return "STPShippingInfoViewController" case .ChangeTheme: return "" } @@ -91,12 +91,12 @@ class BrowseViewController: UITableViewController, STPAddCardViewControllerDeleg let navigationController = UINavigationController(rootViewController: viewController) navigationController.navigationBar.stp_theme = theme present(navigationController, animated: true, completion: nil) - case .STPPaymentMethodsViewController: + case .STPPaymentOptionsViewController: let config = STPPaymentConfiguration() config.additionalPaymentMethods = .all config.requiredBillingAddressFields = .none config.appleMerchantIdentifier = "dummy-merchant-id" - let viewController = STPPaymentMethodsViewController(configuration: config, + let viewController = STPPaymentOptionsViewController(configuration: config, theme: theme, customerContext: self.customerContext, delegate: self) @@ -132,17 +132,17 @@ class BrowseViewController: UITableViewController, STPAddCardViewControllerDeleg dismiss(animated: true, completion: nil) } - // MARK: STPPaymentMethodsViewControllerDelegate + // MARK: STPPaymentOptionsViewControllerDelegate - func paymentMethodsViewControllerDidCancel(_ paymentMethodsViewController: STPPaymentMethodsViewController) { + func paymentMethodsViewControllerDidCancel(_ paymentMethodsViewController: STPPaymentOptionsViewController) { dismiss(animated: true, completion: nil) } - func paymentMethodsViewControllerDidFinish(_ paymentMethodsViewController: STPPaymentMethodsViewController) { + func paymentMethodsViewControllerDidFinish(_ paymentMethodsViewController: STPPaymentOptionsViewController) { paymentMethodsViewController.navigationController?.popViewController(animated: true) } - func paymentMethodsViewController(_ paymentMethodsViewController: STPPaymentMethodsViewController, didFailToLoadWithError error: Error) { + func paymentMethodsViewController(_ paymentMethodsViewController: STPPaymentOptionsViewController, didFailToLoadWithError error: Error) { dismiss(animated: true, completion: nil) } diff --git a/Stripe.xcodeproj/project.pbxproj b/Stripe.xcodeproj/project.pbxproj index 0ba1a7a34f7..f24a189aba1 100644 --- a/Stripe.xcodeproj/project.pbxproj +++ b/Stripe.xcodeproj/project.pbxproj @@ -75,10 +75,10 @@ 0438EFD41B741C2800D506CC /* stp_card_visa.png in Resources */ = {isa = PBXBuildFile; fileRef = 0438EFA11B741C2800D506CC /* stp_card_visa.png */; }; 0438EFD61B741C2800D506CC /* stp_card_visa@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 0438EFA21B741C2800D506CC /* stp_card_visa@2x.png */; }; 0438EFD81B741C2800D506CC /* stp_card_visa@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 0438EFA31B741C2800D506CC /* stp_card_visa@3x.png */; }; - 0439B9871C454F97005A1ED5 /* STPPaymentMethodsViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 0439B9851C454F97005A1ED5 /* STPPaymentMethodsViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 0439B9881C454F97005A1ED5 /* STPPaymentMethodsViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 0439B9851C454F97005A1ED5 /* STPPaymentMethodsViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 0439B9891C454F97005A1ED5 /* STPPaymentMethodsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0439B9861C454F97005A1ED5 /* STPPaymentMethodsViewController.m */; }; - 0439B98A1C454F97005A1ED5 /* STPPaymentMethodsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0439B9861C454F97005A1ED5 /* STPPaymentMethodsViewController.m */; }; + 0439B9871C454F97005A1ED5 /* STPPaymentOptionsViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 0439B9851C454F97005A1ED5 /* STPPaymentOptionsViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 0439B9881C454F97005A1ED5 /* STPPaymentOptionsViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 0439B9851C454F97005A1ED5 /* STPPaymentOptionsViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 0439B9891C454F97005A1ED5 /* STPPaymentOptionsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0439B9861C454F97005A1ED5 /* STPPaymentOptionsViewController.m */; }; + 0439B98A1C454F97005A1ED5 /* STPPaymentOptionsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0439B9861C454F97005A1ED5 /* STPPaymentOptionsViewController.m */; }; 04415C671A6605B5001225ED /* STPAPIClientTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 04CDB51E1A5F3A9300B854EE /* STPAPIClientTest.m */; }; 04415C681A6605B5001225ED /* STPFormEncoderTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 04CDB51F1A5F3A9300B854EE /* STPFormEncoderTest.m */; }; 04415C6A1A6605B5001225ED /* STPApplePayFunctionalTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 04CDB5211A5F3A9300B854EE /* STPApplePayFunctionalTest.m */; }; @@ -221,10 +221,10 @@ 04B31DD71D08E6E200EF1631 /* STPCustomer.m in Sources */ = {isa = PBXBuildFile; fileRef = 04B31DD31D08E6E200EF1631 /* STPCustomer.m */; }; 04B31DDA1D09A4DC00EF1631 /* STPPaymentConfiguration+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 04B31DD81D09A4DC00EF1631 /* STPPaymentConfiguration+Private.h */; }; 04B31DDB1D09A4DC00EF1631 /* STPPaymentConfiguration+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 04B31DD81D09A4DC00EF1631 /* STPPaymentConfiguration+Private.h */; }; - 04B31DE61D09D25F00EF1631 /* STPPaymentMethodsInternalViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 04B31DE41D09D25F00EF1631 /* STPPaymentMethodsInternalViewController.h */; }; - 04B31DE71D09D25F00EF1631 /* STPPaymentMethodsInternalViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 04B31DE41D09D25F00EF1631 /* STPPaymentMethodsInternalViewController.h */; }; - 04B31DE81D09D25F00EF1631 /* STPPaymentMethodsInternalViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 04B31DE51D09D25F00EF1631 /* STPPaymentMethodsInternalViewController.m */; }; - 04B31DE91D09D25F00EF1631 /* STPPaymentMethodsInternalViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 04B31DE51D09D25F00EF1631 /* STPPaymentMethodsInternalViewController.m */; }; + 04B31DE61D09D25F00EF1631 /* STPPaymentOptionsInternalViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 04B31DE41D09D25F00EF1631 /* STPPaymentOptionsInternalViewController.h */; }; + 04B31DE71D09D25F00EF1631 /* STPPaymentOptionsInternalViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 04B31DE41D09D25F00EF1631 /* STPPaymentOptionsInternalViewController.h */; }; + 04B31DE81D09D25F00EF1631 /* STPPaymentOptionsInternalViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 04B31DE51D09D25F00EF1631 /* STPPaymentOptionsInternalViewController.m */; }; + 04B31DE91D09D25F00EF1631 /* STPPaymentOptionsInternalViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 04B31DE51D09D25F00EF1631 /* STPPaymentOptionsInternalViewController.m */; }; 04B31DF21D09F0A800EF1631 /* UIViewController+Stripe_NavigationItemProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 04B31DF01D09F0A800EF1631 /* UIViewController+Stripe_NavigationItemProxy.h */; }; 04B31DF31D09F0A800EF1631 /* UIViewController+Stripe_NavigationItemProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 04B31DF01D09F0A800EF1631 /* UIViewController+Stripe_NavigationItemProxy.h */; }; 04B31DF41D09F0A800EF1631 /* UIViewController+Stripe_NavigationItemProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 04B31DF11D09F0A800EF1631 /* UIViewController+Stripe_NavigationItemProxy.m */; }; @@ -278,7 +278,7 @@ 04E32AA01B7A9490009C9E35 /* STPPaymentCardTextField.h in Headers */ = {isa = PBXBuildFile; fileRef = 04E32A9C1B7A9490009C9E35 /* STPPaymentCardTextField.h */; settings = {ATTRIBUTES = (Public, ); }; }; 04E39F541CECF7A100AF3B96 /* STPPaymentOptionTuple.h in Headers */ = {isa = PBXBuildFile; fileRef = 04E39F501CECF7A100AF3B96 /* STPPaymentOptionTuple.h */; }; 04E39F551CECF7A100AF3B96 /* STPPaymentOptionTuple.m in Sources */ = {isa = PBXBuildFile; fileRef = 04E39F511CECF7A100AF3B96 /* STPPaymentOptionTuple.m */; }; - 04E39F581CECF9A800AF3B96 /* STPPaymentMethodsViewController+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 04E39F561CECF9A800AF3B96 /* STPPaymentMethodsViewController+Private.h */; }; + 04E39F581CECF9A800AF3B96 /* STPPaymentOptionsViewController+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 04E39F561CECF9A800AF3B96 /* STPPaymentOptionsViewController+Private.h */; }; 04E39F5C1CECFAFD00AF3B96 /* STPPaymentContext+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 04E39F5A1CECFAFD00AF3B96 /* STPPaymentContext+Private.h */; }; 04E39F6A1CED48D500AF3B96 /* UIBarButtonItem+Stripe.h in Headers */ = {isa = PBXBuildFile; fileRef = 04E39F681CED48D500AF3B96 /* UIBarButtonItem+Stripe.h */; }; 04E39F6B1CED48D500AF3B96 /* UIBarButtonItem+Stripe.m in Sources */ = {isa = PBXBuildFile; fileRef = 04E39F691CED48D500AF3B96 /* UIBarButtonItem+Stripe.m */; }; @@ -310,7 +310,7 @@ 04F94DAC1D229F42004FC826 /* UIBarButtonItem+Stripe.m in Sources */ = {isa = PBXBuildFile; fileRef = 04E39F691CED48D500AF3B96 /* UIBarButtonItem+Stripe.m */; }; 04F94DAD1D229F4E004FC826 /* STPColorUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 0426B96C1CEADC98006AC8DD /* STPColorUtils.h */; }; 04F94DAE1D229F54004FC826 /* STPColorUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 0426B96D1CEADC98006AC8DD /* STPColorUtils.m */; }; - 04F94DAF1D229F59004FC826 /* STPPaymentMethodsViewController+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 04E39F561CECF9A800AF3B96 /* STPPaymentMethodsViewController+Private.h */; }; + 04F94DAF1D229F59004FC826 /* STPPaymentOptionsViewController+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 04E39F561CECF9A800AF3B96 /* STPPaymentOptionsViewController+Private.h */; }; 04F94DB41D229F71004FC826 /* STPPaymentActivityIndicatorView.m in Sources */ = {isa = PBXBuildFile; fileRef = 046FE9A01CE55D1D00DA6A7B /* STPPaymentActivityIndicatorView.m */; }; 04F94DB91D229F86004FC826 /* STPApplePay.m in Sources */ = {isa = PBXBuildFile; fileRef = C11810881CC6B00D0022FB55 /* STPApplePay.m */; }; 04F94DBA1D229F8A004FC826 /* PKPaymentAuthorizationViewController+Stripe_Blocks.h in Headers */ = {isa = PBXBuildFile; fileRef = C11810931CC6C4700022FB55 /* PKPaymentAuthorizationViewController+Stripe_Blocks.h */; }; @@ -924,8 +924,8 @@ 0438EFA11B741C2800D506CC /* stp_card_visa.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = stp_card_visa.png; sourceTree = ""; }; 0438EFA21B741C2800D506CC /* stp_card_visa@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "stp_card_visa@2x.png"; sourceTree = ""; }; 0438EFA31B741C2800D506CC /* stp_card_visa@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "stp_card_visa@3x.png"; sourceTree = ""; }; - 0439B9851C454F97005A1ED5 /* STPPaymentMethodsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = STPPaymentMethodsViewController.h; path = PublicHeaders/STPPaymentMethodsViewController.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 0439B9861C454F97005A1ED5 /* STPPaymentMethodsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = STPPaymentMethodsViewController.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; + 0439B9851C454F97005A1ED5 /* STPPaymentOptionsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = STPPaymentOptionsViewController.h; path = PublicHeaders/STPPaymentOptionsViewController.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; + 0439B9861C454F97005A1ED5 /* STPPaymentOptionsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = STPPaymentOptionsViewController.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 0451CC421C49AE1C003B2CA6 /* STPPaymentResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = STPPaymentResult.h; path = PublicHeaders/STPPaymentResult.h; sourceTree = ""; }; 0451CC431C49AE1C003B2CA6 /* STPPaymentResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPPaymentResult.m; sourceTree = ""; }; 045A62AA1B8E7259000165CE /* STPPaymentCardTextFieldTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPPaymentCardTextFieldTest.m; sourceTree = ""; }; @@ -1001,8 +1001,8 @@ 04B31DD21D08E6E200EF1631 /* STPCustomer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = STPCustomer.h; path = PublicHeaders/STPCustomer.h; sourceTree = ""; }; 04B31DD31D08E6E200EF1631 /* STPCustomer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPCustomer.m; sourceTree = ""; }; 04B31DD81D09A4DC00EF1631 /* STPPaymentConfiguration+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "STPPaymentConfiguration+Private.h"; sourceTree = ""; }; - 04B31DE41D09D25F00EF1631 /* STPPaymentMethodsInternalViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STPPaymentMethodsInternalViewController.h; sourceTree = ""; }; - 04B31DE51D09D25F00EF1631 /* STPPaymentMethodsInternalViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPPaymentMethodsInternalViewController.m; sourceTree = ""; }; + 04B31DE41D09D25F00EF1631 /* STPPaymentOptionsInternalViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STPPaymentOptionsInternalViewController.h; sourceTree = ""; }; + 04B31DE51D09D25F00EF1631 /* STPPaymentOptionsInternalViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPPaymentOptionsInternalViewController.m; sourceTree = ""; }; 04B31DF01D09F0A800EF1631 /* UIViewController+Stripe_NavigationItemProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIViewController+Stripe_NavigationItemProxy.h"; sourceTree = ""; }; 04B31DF11D09F0A800EF1631 /* UIViewController+Stripe_NavigationItemProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+Stripe_NavigationItemProxy.m"; sourceTree = ""; }; 04B31DF71D11AC6400EF1631 /* STPUserInformation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = STPUserInformation.h; path = PublicHeaders/STPUserInformation.h; sourceTree = ""; }; @@ -1053,7 +1053,7 @@ 04E32A9C1B7A9490009C9E35 /* STPPaymentCardTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = STPPaymentCardTextField.h; path = PublicHeaders/STPPaymentCardTextField.h; sourceTree = ""; }; 04E39F501CECF7A100AF3B96 /* STPPaymentOptionTuple.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STPPaymentOptionTuple.h; sourceTree = ""; }; 04E39F511CECF7A100AF3B96 /* STPPaymentOptionTuple.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPPaymentOptionTuple.m; sourceTree = ""; }; - 04E39F561CECF9A800AF3B96 /* STPPaymentMethodsViewController+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "STPPaymentMethodsViewController+Private.h"; sourceTree = ""; }; + 04E39F561CECF9A800AF3B96 /* STPPaymentOptionsViewController+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "STPPaymentOptionsViewController+Private.h"; sourceTree = ""; }; 04E39F5A1CECFAFD00AF3B96 /* STPPaymentContext+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "STPPaymentContext+Private.h"; sourceTree = ""; }; 04E39F681CED48D500AF3B96 /* UIBarButtonItem+Stripe.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIBarButtonItem+Stripe.h"; sourceTree = ""; }; 04E39F691CED48D500AF3B96 /* UIBarButtonItem+Stripe.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIBarButtonItem+Stripe.m"; sourceTree = ""; }; @@ -2131,9 +2131,9 @@ F1FA6F941E25960500EB444D /* STPCoreScrollViewController+Private.h */, F1FA6F971E25970F00EB444D /* STPCoreTableViewController+Private.h */, F1FA6F911E258F6800EB444D /* STPCoreViewController+Private.h */, - 04B31DE41D09D25F00EF1631 /* STPPaymentMethodsInternalViewController.h */, - 04B31DE51D09D25F00EF1631 /* STPPaymentMethodsInternalViewController.m */, - 04E39F561CECF9A800AF3B96 /* STPPaymentMethodsViewController+Private.h */, + 04B31DE41D09D25F00EF1631 /* STPPaymentOptionsInternalViewController.h */, + 04B31DE51D09D25F00EF1631 /* STPPaymentOptionsInternalViewController.m */, + 04E39F561CECF9A800AF3B96 /* STPPaymentOptionsViewController+Private.h */, C159932F1D8808680047950D /* STPShippingMethodsViewController.h */, C15993301D8808680047950D /* STPShippingMethodsViewController.m */, ); @@ -2177,8 +2177,8 @@ F1DEB8891E2047CA0066B8E8 /* STPCoreTableViewController.m */, F1DEB8971E2074480066B8E8 /* STPCoreViewController.h */, F1DEB8981E2074480066B8E8 /* STPCoreViewController.m */, - 0439B9851C454F97005A1ED5 /* STPPaymentMethodsViewController.h */, - 0439B9861C454F97005A1ED5 /* STPPaymentMethodsViewController.m */, + 0439B9851C454F97005A1ED5 /* STPPaymentOptionsViewController.h */, + 0439B9861C454F97005A1ED5 /* STPPaymentOptionsViewController.m */, C15993261D8808490047950D /* STPShippingAddressViewController.h */, C159932C1D8808680047950D /* STPShippingAddressViewController.m */, ); @@ -2253,7 +2253,7 @@ C1363BB81D7633D800EB82B4 /* STPPaymentMethodTableViewCell.h in Headers */, C1271A3F1E3FA4EB00F25DFE /* STPSectionHeaderView.h in Headers */, 049E84D91A605EF0000B66CD /* Stripe.h in Headers */, - 0439B9881C454F97005A1ED5 /* STPPaymentMethodsViewController.h in Headers */, + 0439B9881C454F97005A1ED5 /* STPPaymentOptionsViewController.h in Headers */, F1A2F92D1EEB6A70006B0456 /* NSCharacterSet+Stripe.h in Headers */, 04F94DAB1D229F3F004FC826 /* UIBarButtonItem+Stripe.h in Headers */, 04F94DC91D22A20A004FC826 /* STPSwitchTableViewCell.h in Headers */, @@ -2280,7 +2280,7 @@ 04B31E001D131D9000EF1631 /* STPPaymentCardTextFieldCell.h in Headers */, 04BFFFDA1D240B13005F2340 /* STPAddCardViewController+Private.h in Headers */, C1717DB11CC00ED60009CF4A /* STPAddress.h in Headers */, - 04B31DE71D09D25F00EF1631 /* STPPaymentMethodsInternalViewController.h in Headers */, + 04B31DE71D09D25F00EF1631 /* STPPaymentOptionsInternalViewController.h in Headers */, F152322B1EA9306100D65C67 /* NSURLComponents+Stripe.h in Headers */, C1A06F111E1D8A7F004DCA06 /* STPCard+Private.h in Headers */, 04F94DBA1D229F8A004FC826 /* PKPaymentAuthorizationViewController+Stripe_Blocks.h in Headers */, @@ -2339,7 +2339,7 @@ C184107C1EC2539F00178149 /* STPEphemeralKeyProvider.h in Headers */, 04B31DDB1D09A4DC00EF1631 /* STPPaymentConfiguration+Private.h in Headers */, 045D710F1CEEE30500F6CD65 /* STPAspects.h in Headers */, - 04F94DAF1D229F59004FC826 /* STPPaymentMethodsViewController+Private.h in Headers */, + 04F94DAF1D229F59004FC826 /* STPPaymentOptionsViewController+Private.h in Headers */, B3BDCAC520EEF2150034F7F5 /* STPPaymentIntent+Private.h in Headers */, 04633AFD1CD129AF009D4FB5 /* STPPhoneNumberValidator.h in Headers */, 04633AFE1CD129B4009D4FB5 /* STPDelegateProxy.h in Headers */, @@ -2388,7 +2388,7 @@ B3A241391FFEB57400A2F00D /* STPConnectAccountParams.h in Headers */, B32B176520F80442000D6EF8 /* STPRedirectContext+Private.h in Headers */, F19491DE1E5F6B8C001E1FC2 /* STPSourceCardDetails.h in Headers */, - 0439B9871C454F97005A1ED5 /* STPPaymentMethodsViewController.h in Headers */, + 0439B9871C454F97005A1ED5 /* STPPaymentOptionsViewController.h in Headers */, 04B31DF91D11AC6400EF1631 /* STPUserInformation.h in Headers */, 04EBC7531B7533C300A0E6AE /* STPCardValidationState.h in Headers */, 045D710E1CEEE30500F6CD65 /* STPAspects.h in Headers */, @@ -2457,7 +2457,7 @@ 04695ADB1C77F9EF00E08063 /* STPPhoneNumberValidator.h in Headers */, F1C7B8D51DBECF2400D9F6F0 /* STPDispatchFunctions.h in Headers */, 0426B9761CEBD001006AC8DD /* UINavigationBar+Stripe_Theme.h in Headers */, - 04E39F581CECF9A800AF3B96 /* STPPaymentMethodsViewController+Private.h in Headers */, + 04E39F581CECF9A800AF3B96 /* STPPaymentOptionsViewController+Private.h in Headers */, C11810891CC6B00D0022FB55 /* STPApplePay.h in Headers */, 0426B9721CEAE3EB006AC8DD /* UITableViewCell+Stripe_Borders.h in Headers */, 04CDE5C91BC20B1D00548833 /* STPBankAccountParams.h in Headers */, @@ -2510,7 +2510,7 @@ 049A3F7E1CC1920A00F57DE7 /* UIViewController+Stripe_KeyboardAvoiding.h in Headers */, 04BFFFD91D240B13005F2340 /* STPAddCardViewController+Private.h in Headers */, C1363BB71D7633D800EB82B4 /* STPPaymentMethodTableViewCell.h in Headers */, - 04B31DE61D09D25F00EF1631 /* STPPaymentMethodsInternalViewController.h in Headers */, + 04B31DE61D09D25F00EF1631 /* STPPaymentOptionsInternalViewController.h in Headers */, 04CDB4FE1A5F30A700B854EE /* STPAPIClient.h in Headers */, 045D712C1CF4ED7600F6CD65 /* STPBINRange.h in Headers */, C1D7B51A1E36B8B9002181F5 /* STPSourceParams.h in Headers */, @@ -3058,7 +3058,7 @@ C15993411D8808A10047950D /* STPShippingMethodTableViewCell.m in Sources */, F19491DC1E5F606F001E1FC2 /* STPSourceCardDetails.m in Sources */, 04F94DAA1D229F36004FC826 /* STPTheme.m in Sources */, - 0439B98A1C454F97005A1ED5 /* STPPaymentMethodsViewController.m in Sources */, + 0439B98A1C454F97005A1ED5 /* STPPaymentOptionsViewController.m in Sources */, C113D21C1EBB9A36006FACC2 /* STPEphemeralKey.m in Sources */, 04F94DAE1D229F54004FC826 /* STPColorUtils.m in Sources */, C1D7B51D1E36B8B9002181F5 /* STPSourceParams.m in Sources */, @@ -3083,7 +3083,7 @@ C1BD9B2B1E39406C00CEE925 /* STPSourceOwner.m in Sources */, C1BD9B311E3940A200CEE925 /* STPSourceRedirect.m in Sources */, B32B176120F6D2C4000D6EF8 /* STPGenericStripeObject.m in Sources */, - 04B31DE91D09D25F00EF1631 /* STPPaymentMethodsInternalViewController.m in Sources */, + 04B31DE91D09D25F00EF1631 /* STPPaymentOptionsInternalViewController.m in Sources */, F12C8DC51D63DE9F00ADA0D7 /* STPPaymentContextAmountModel.m in Sources */, 04633B011CD129CB009D4FB5 /* STPPhoneNumberValidator.m in Sources */, F152322D1EA9306100D65C67 /* NSURLComponents+Stripe.m in Sources */, @@ -3142,7 +3142,7 @@ C17A030E1CBEE7A2006C819F /* STPAddressFieldTableViewCell.m in Sources */, 049A3F921CC740FF00F57DE7 /* NSDecimalNumber+Stripe_Currency.m in Sources */, C1080F4A1CBECF7B007B2D89 /* STPAddress.m in Sources */, - 04B31DE81D09D25F00EF1631 /* STPPaymentMethodsInternalViewController.m in Sources */, + 04B31DE81D09D25F00EF1631 /* STPPaymentOptionsInternalViewController.m in Sources */, F1D3A25C1EB014BD0095BFA9 /* UIImage+Stripe.m in Sources */, F1DEB8921E2052150066B8E8 /* STPCoreScrollViewController.m in Sources */, C15608DF1FE08F2E0032AE66 /* UIView+Stripe_SafeAreaBounds.m in Sources */, @@ -3225,7 +3225,7 @@ 0451CC461C49AE1C003B2CA6 /* STPPaymentResult.m in Sources */, 04E39F551CECF7A100AF3B96 /* STPPaymentOptionTuple.m in Sources */, C11810961CC6C4700022FB55 /* PKPaymentAuthorizationViewController+Stripe_Blocks.m in Sources */, - 0439B9891C454F97005A1ED5 /* STPPaymentMethodsViewController.m in Sources */, + 0439B9891C454F97005A1ED5 /* STPPaymentOptionsViewController.m in Sources */, 04A488441CA3580700506E53 /* UINavigationController+Stripe_Completion.m in Sources */, 049A3F961CC75B2E00F57DE7 /* STPPromise.m in Sources */, B3BDCAD320EEF5E10034F7F5 /* STPPaymentIntentParams.m in Sources */, diff --git a/Stripe/PublicHeaders/STPBackendAPIAdapter.h b/Stripe/PublicHeaders/STPBackendAPIAdapter.h index 8d4e344e1a6..923726dd9da 100644 --- a/Stripe/PublicHeaders/STPBackendAPIAdapter.h +++ b/Stripe/PublicHeaders/STPBackendAPIAdapter.h @@ -27,7 +27,7 @@ NS_ASSUME_NONNULL_BEGIN If you would prefer retrieving and updating your Stripe customer object via your own backend instead of using `STPCustomerContext`, you should make your application's API client conform to this interface. It provides a "bridge" from - the prebuilt UI we expose (such as `STPPaymentMethodsViewController`) to your + the prebuilt UI we expose (such as `STPPaymentOptionsViewController`) to your backend to fetch the information it needs to power those views. */ @protocol STPBackendAPIAdapter diff --git a/Stripe/PublicHeaders/STPPaymentConfiguration.h b/Stripe/PublicHeaders/STPPaymentConfiguration.h index 9985998b64f..b5598f363ef 100644 --- a/Stripe/PublicHeaders/STPPaymentConfiguration.h +++ b/Stripe/PublicHeaders/STPPaymentConfiguration.h @@ -97,13 +97,13 @@ NS_ASSUME_NONNULL_BEGIN /** Determines whether or not the user is able to delete payment methods - This is only relevant to the `STPPaymentMethodsViewController` which, if + This is only relevant to the `STPPaymentOptionsViewController` which, if enabled, will allow the user to delete payment methods by tapping the "Edit" button in the navigation bar or by swiping left on a payment method and tapping "Delete". Currently, the user is not allowed to delete the selected payment method but this may change in the future. - Default value is YES but will only work if `STPPaymentMethodsViewController` is + Default value is YES but will only work if `STPPaymentOptionsViewController` is initialized with a `STPCustomerContext` either through the `STPPaymentContext` or directly as an init parameter. */ diff --git a/Stripe/PublicHeaders/STPPaymentContext.h b/Stripe/PublicHeaders/STPPaymentContext.h index 587e00cae88..6014c33bce6 100644 --- a/Stripe/PublicHeaders/STPPaymentContext.h +++ b/Stripe/PublicHeaders/STPPaymentContext.h @@ -278,7 +278,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)retryLoading; /** - This creates, configures, and appropriately presents an `STPPaymentMethodsViewController` + This creates, configures, and appropriately presents an `STPPaymentOptionsViewController` on top of the payment context's `hostViewController`. It'll be dismissed automatically when the user is done selecting their payment method. @@ -288,7 +288,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)presentPaymentMethodsViewController; /** - This creates, configures, and appropriately pushes an `STPPaymentMethodsViewController` + This creates, configures, and appropriately pushes an `STPPaymentOptionsViewController` onto the navigation stack of the context's `hostViewController`. It'll be popped automatically when the user is done selecting their payment method. diff --git a/Stripe/PublicHeaders/STPPaymentOption.h b/Stripe/PublicHeaders/STPPaymentOption.h index 7288f5771c3..8b81eb49e09 100644 --- a/Stripe/PublicHeaders/STPPaymentOption.h +++ b/Stripe/PublicHeaders/STPPaymentOption.h @@ -39,7 +39,7 @@ typedef NS_OPTIONS(NSUInteger, STPPaymentOptionType) { represents that the user wants to pay with a specific card, `STPApplePay`, which represents that the user wants to pay with Apple Pay, and `STPSource`. Only `STPSource.type == STPSourceTypeCard` payment - methods are supported by `STPPaymentContext` and `STPPaymentMethodViewController`, + methods are supported by `STPPaymentContext` and `STPPaymentOptionsViewController`, but the other types do have basic support for this protocol for use in a custom integration. */ diff --git a/Stripe/PublicHeaders/STPPaymentMethodsViewController.h b/Stripe/PublicHeaders/STPPaymentOptionsViewController.h similarity index 86% rename from Stripe/PublicHeaders/STPPaymentMethodsViewController.h rename to Stripe/PublicHeaders/STPPaymentOptionsViewController.h index a740a89f09f..8f648dc7d44 100644 --- a/Stripe/PublicHeaders/STPPaymentMethodsViewController.h +++ b/Stripe/PublicHeaders/STPPaymentOptionsViewController.h @@ -1,5 +1,5 @@ // -// STPPaymentMethodsViewController.h +// STPPaymentOptionsViewController.h // Stripe // // Created by Jack Flintermann on 1/12/16. @@ -16,22 +16,22 @@ NS_ASSUME_NONNULL_BEGIN -@protocol STPPaymentOption, STPPaymentMethodsViewControllerDelegate; -@class STPPaymentContext, STPPaymentMethodsViewController, STPCustomerContext; +@protocol STPPaymentOption, STPPaymentOptionsViewControllerDelegate; +@class STPPaymentContext, STPPaymentOptionsViewController, STPCustomerContext; /** This view controller presents a list of payment method options to the user, which they can select between. They can also add credit cards to the list. It must be displayed inside a `UINavigationController`, so you can either - create a `UINavigationController` with an `STPPaymentMethodsViewController` + create a `UINavigationController` with an `STPPaymentOptionsViewController` as the `rootViewController` and then present the `UINavigationController`, - or push a new `STPPaymentMethodsViewController` onto an existing + or push a new `STPPaymentOptionsViewController` onto an existing `UINavigationController`'s stack. You can also have `STPPaymentContext` do this for you automatically, by calling `presentPaymentMethodsViewController` or `pushPaymentMethodsViewController` on it. */ -@interface STPPaymentMethodsViewController : STPCoreViewController +@interface STPPaymentOptionsViewController : STPCoreViewController /** The delegate for the view controller. @@ -40,7 +40,7 @@ NS_ASSUME_NONNULL_BEGIN and is responsible for dismissing the payments methods view controller when it is finished. */ -@property (nonatomic, nullable, weak, readonly) iddelegate; +@property (nonatomic, nullable, weak, readonly) iddelegate; /** Creates a new payment methods view controller. @@ -71,7 +71,7 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)initWithConfiguration:(STPPaymentConfiguration *)configuration theme:(STPTheme *)theme customerContext:(STPCustomerContext *)customerContext - delegate:(id)delegate; + delegate:(id)delegate; /** Note: Instead of providing your own backend API adapter, we recommend using @@ -92,7 +92,7 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)initWithConfiguration:(STPPaymentConfiguration *)configuration theme:(STPTheme *)theme apiAdapter:(id)apiAdapter - delegate:(id)delegate; + delegate:(id)delegate; /** If you've already collected some information from your user, you can set it @@ -122,7 +122,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, strong) UIView *addCardViewControllerFooterView; /** - If you're pushing `STPPaymentMethodsViewController` onto an existing + If you're pushing `STPPaymentOptionsViewController` onto an existing `UINavigationController`'s stack, you should use this method to dismiss it, since it may have pushed an additional add card view controller onto the navigation controller's stack. @@ -151,12 +151,12 @@ NS_ASSUME_NONNULL_BEGIN @end /** - An `STPPaymentMethodsViewControllerDelegate` responds when a user selects a - payment method from (or cancels) an `STPPaymentMethodsViewController`. In both + An `STPPaymentOptionsViewControllerDelegate` responds when a user selects a + payment option from (or cancels) an `STPPaymentOptionsViewController`. In both of these instances, you should dismiss the view controller (either by popping it off the navigation stack, or dismissing it). */ -@protocol STPPaymentMethodsViewControllerDelegate +@protocol STPPaymentOptionsViewControllerDelegate /** This is called when the view controller encounters an error fetching the user's @@ -166,7 +166,7 @@ NS_ASSUME_NONNULL_BEGIN @param paymentMethodsViewController the view controller in question @param error the error that occurred */ -- (void)paymentMethodsViewController:(STPPaymentMethodsViewController *)paymentMethodsViewController +- (void)paymentMethodsViewController:(STPPaymentOptionsViewController *)paymentMethodsViewController didFailToLoadWithError:(NSError *)error; /** @@ -176,7 +176,7 @@ NS_ASSUME_NONNULL_BEGIN @param paymentMethodsViewController the view controller that has finished */ -- (void)paymentMethodsViewControllerDidFinish:(STPPaymentMethodsViewController *)paymentMethodsViewController; +- (void)paymentMethodsViewControllerDidFinish:(STPPaymentOptionsViewController *)paymentMethodsViewController; /** This is called when the user taps "cancel". @@ -184,7 +184,7 @@ NS_ASSUME_NONNULL_BEGIN @param paymentMethodsViewController the view controller that has finished */ -- (void)paymentMethodsViewControllerDidCancel:(STPPaymentMethodsViewController *)paymentMethodsViewController; +- (void)paymentMethodsViewControllerDidCancel:(STPPaymentOptionsViewController *)paymentMethodsViewController; @optional /** @@ -194,14 +194,14 @@ NS_ASSUME_NONNULL_BEGIN choice. You should use this callback to update any necessary UI in your app that displays the user's currently selected payment method. You should *not* dismiss the view controller at this point, instead do this in - `paymentMethodsViewControllerDidFinish:`. `STPPaymentMethodsViewController` + `paymentMethodsViewControllerDidFinish:`. `STPPaymentOptionsViewController` will also call the necessary methods on your API adapter, so you don't need to call them directly during this method. @param paymentMethodsViewController the view controller in question @param paymentMethod the selected payment method */ -- (void)paymentMethodsViewController:(STPPaymentMethodsViewController *)paymentMethodsViewController +- (void)paymentMethodsViewController:(STPPaymentOptionsViewController *)paymentMethodsViewController didSelectPaymentMethod:(id)paymentMethod; @end diff --git a/Stripe/PublicHeaders/Stripe.h b/Stripe/PublicHeaders/Stripe.h index 69bb3eb3d82..27a82341a92 100644 --- a/Stripe/PublicHeaders/Stripe.h +++ b/Stripe/PublicHeaders/Stripe.h @@ -43,7 +43,7 @@ #import "STPPaymentIntentSourceAction.h" #import "STPPaymentIntentSourceActionAuthorizeWithURL.h" #import "STPPaymentOption.h" -#import "STPPaymentMethodsViewController.h" +#import "STPPaymentOptionsViewController.h" #import "STPPaymentResult.h" #import "STPRedirectContext.h" #import "STPShippingAddressViewController.h" diff --git a/Stripe/PublicHeaders/UINavigationBar+Stripe_Theme.h b/Stripe/PublicHeaders/UINavigationBar+Stripe_Theme.h index 34b489caa9e..1d3b4e2c999 100644 --- a/Stripe/PublicHeaders/UINavigationBar+Stripe_Theme.h +++ b/Stripe/PublicHeaders/UINavigationBar+Stripe_Theme.h @@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN /** This allows quickly setting the appearance of a `UINavigationBar` to match your application. This is useful if you're presenting an `STPAddCardViewController` - or `STPPaymentMethodsViewController` inside a `UINavigationController`. + or `STPPaymentOptionsViewController` inside a `UINavigationController`. */ @interface UINavigationBar (Stripe_Theme) diff --git a/Stripe/STPAnalyticsClient.m b/Stripe/STPAnalyticsClient.m index 65427e6615e..9d7561cd2bb 100644 --- a/Stripe/STPAnalyticsClient.m +++ b/Stripe/STPAnalyticsClient.m @@ -23,8 +23,8 @@ #import "STPPaymentCardTextField+Private.h" #import "STPPaymentConfiguration.h" #import "STPPaymentContext.h" -#import "STPPaymentMethodsViewController+Private.h" -#import "STPPaymentMethodsViewController.h" +#import "STPPaymentOptionsViewController+Private.h" +#import "STPPaymentOptionsViewController.h" #import "STPToken.h" #import #import @@ -84,11 +84,11 @@ + (void)initializeIfNeeded { [client setApiUsage:[client.apiUsage setByAddingObject:NSStringFromClass([STPAddCardViewController class])]]; } error:nil]; - [STPPaymentMethodsViewController stp_aspect_hookSelector:@selector(initWithConfiguration:apiAdapter:loadingPromise:theme:shippingAddress:delegate:) + [STPPaymentOptionsViewController stp_aspect_hookSelector:@selector(initWithConfiguration:apiAdapter:loadingPromise:theme:shippingAddress:delegate:) withOptions:STPAspectPositionAfter usingBlock:^{ STPAnalyticsClient *client = [self sharedClient]; - [client setApiUsage:[client.apiUsage setByAddingObject:NSStringFromClass([STPPaymentMethodsViewController class])]]; + [client setApiUsage:[client.apiUsage setByAddingObject:NSStringFromClass([STPPaymentOptionsViewController class])]]; } error:nil]; [STPShippingAddressViewController stp_aspect_hookSelector:@selector(initWithConfiguration:theme:currency:shippingAddress:selectedShippingMethod:prefilledInformation:) diff --git a/Stripe/STPCustomer+SourceTuple.h b/Stripe/STPCustomer+SourceTuple.h index 5ab47a9dd15..aae04f50c90 100644 --- a/Stripe/STPCustomer+SourceTuple.h +++ b/Stripe/STPCustomer+SourceTuple.h @@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN /** Returns a tuple for this customer's sources array and defaultSource filtered to only include the source types supported - by STPPaymentContext/STPPaymentMethodsViewController and adding Apple Pay as a + by STPPaymentContext/STPPaymentOptionsViewController and adding Apple Pay as a method if appropriate. @return A new tuple ready to be used by the SDK's UI elements diff --git a/Stripe/STPPaymentContext+Private.h b/Stripe/STPPaymentContext+Private.h index 1b94a32958d..707ab57ba85 100644 --- a/Stripe/STPPaymentContext+Private.h +++ b/Stripe/STPPaymentContext+Private.h @@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN -@interface STPPaymentContext (Private) +@interface STPPaymentContext (Private) @property (nonatomic, readonly) STPPromise *currentValuePromise; diff --git a/Stripe/STPPaymentContext.m b/Stripe/STPPaymentContext.m index b1e0ea746b3..b363b36ef40 100644 --- a/Stripe/STPPaymentContext.m +++ b/Stripe/STPPaymentContext.m @@ -38,7 +38,7 @@ typedef NS_ENUM(NSUInteger, STPPaymentContextState) { STPPaymentContextStateRequestingPayment, }; -@interface STPPaymentContext() +@interface STPPaymentContext() @property (nonatomic) STPPaymentConfiguration *configuration; @property (nonatomic) STPTheme *theme; @@ -50,7 +50,7 @@ @interface STPPaymentContext() selectedPaymentMethod; @property (nonatomic) NSArray> *paymentMethods; @property (nonatomic) STPAddress *shippingAddress; @@ -292,7 +292,7 @@ - (void)presentPaymentMethodsViewControllerWithNewState:(STPPaymentContextState) STRONG(self); if (self.state == STPPaymentContextStateNone) { self.state = state; - STPPaymentMethodsViewController *paymentMethodsViewController = [[STPPaymentMethodsViewController alloc] initWithPaymentContext:self]; + STPPaymentOptionsViewController *paymentMethodsViewController = [[STPPaymentOptionsViewController alloc] initWithPaymentContext:self]; self.paymentMethodsViewController = paymentMethodsViewController; paymentMethodsViewController.prefilledInformation = self.prefilledInformation; paymentMethodsViewController.paymentMethodsViewControllerFooterView = self.paymentMethodsViewControllerFooterView; @@ -329,7 +329,7 @@ - (void)pushPaymentMethodsViewController { if (self.state == STPPaymentContextStateNone) { self.state = STPPaymentContextStateShowingRequestedViewController; - STPPaymentMethodsViewController *paymentMethodsViewController = [[STPPaymentMethodsViewController alloc] initWithPaymentContext:self]; + STPPaymentOptionsViewController *paymentMethodsViewController = [[STPPaymentOptionsViewController alloc] initWithPaymentContext:self]; self.paymentMethodsViewController = paymentMethodsViewController; paymentMethodsViewController.prefilledInformation = self.prefilledInformation; paymentMethodsViewController.paymentMethodsViewControllerFooterView = self.paymentMethodsViewControllerFooterView; @@ -344,12 +344,12 @@ - (void)pushPaymentMethodsViewController { }]; } -- (void)paymentMethodsViewController:(__unused STPPaymentMethodsViewController *)paymentMethodsViewController +- (void)paymentMethodsViewController:(__unused STPPaymentOptionsViewController *)paymentMethodsViewController didSelectPaymentMethod:(id)paymentMethod { self.selectedPaymentMethod = paymentMethod; } -- (void)paymentMethodsViewControllerDidFinish:(STPPaymentMethodsViewController *)paymentMethodsViewController { +- (void)paymentMethodsViewControllerDidFinish:(STPPaymentOptionsViewController *)paymentMethodsViewController { [self appropriatelyDismissPaymentMethodsViewController:paymentMethodsViewController completion:^{ if (self.state == STPPaymentContextStateRequestingPayment) { self.state = STPPaymentContextStateNone; @@ -361,7 +361,7 @@ - (void)paymentMethodsViewControllerDidFinish:(STPPaymentMethodsViewController * }]; } -- (void)paymentMethodsViewControllerDidCancel:(STPPaymentMethodsViewController *)paymentMethodsViewController { +- (void)paymentMethodsViewControllerDidCancel:(STPPaymentOptionsViewController *)paymentMethodsViewController { [self appropriatelyDismissPaymentMethodsViewController:paymentMethodsViewController completion:^{ if (self.state == STPPaymentContextStateRequestingPayment) { [self didFinishWithStatus:STPPaymentStatusUserCancellation @@ -373,12 +373,12 @@ - (void)paymentMethodsViewControllerDidCancel:(STPPaymentMethodsViewController * }]; } -- (void)paymentMethodsViewController:(__unused STPPaymentMethodsViewController *)paymentMethodsViewController +- (void)paymentMethodsViewController:(__unused STPPaymentOptionsViewController *)paymentMethodsViewController didFailToLoadWithError:(__unused NSError *)error { // we'll handle this ourselves when the loading promise fails. } -- (void)appropriatelyDismissPaymentMethodsViewController:(STPPaymentMethodsViewController *)viewController +- (void)appropriatelyDismissPaymentMethodsViewController:(STPPaymentOptionsViewController *)viewController completion:(STPVoidBlock)completion { if ([viewController stp_isAtRootOfNavigationController]) { // if we're the root of the navigation controller, we've been presented modally. diff --git a/Stripe/STPPaymentMethodsInternalViewController.h b/Stripe/STPPaymentOptionsInternalViewController.h similarity index 86% rename from Stripe/STPPaymentMethodsInternalViewController.h rename to Stripe/STPPaymentOptionsInternalViewController.h index a9197905a7e..b01c5e9deaa 100644 --- a/Stripe/STPPaymentMethodsInternalViewController.h +++ b/Stripe/STPPaymentOptionsInternalViewController.h @@ -1,5 +1,5 @@ // -// STPPaymentMethodsInternalViewController.h +// STPPaymentOptionsInternalViewController.h // Stripe // // Created by Jack Flintermann on 6/9/16. @@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN -@protocol STPPaymentMethodsInternalViewControllerDelegate +@protocol STPPaymentOptionsInternalViewControllerDelegate - (void)internalViewControllerDidSelectPaymentMethod:(id)paymentMethod; - (void)internalViewControllerDidDeletePaymentMethod:(id)paymentMethod; @@ -24,7 +24,7 @@ NS_ASSUME_NONNULL_BEGIN @end -@interface STPPaymentMethodsInternalViewController : STPCoreTableViewController +@interface STPPaymentOptionsInternalViewController : STPCoreTableViewController - (instancetype)initWithConfiguration:(STPPaymentConfiguration *)configuration customerContext:(nullable STPCustomerContext *)customerContext @@ -32,7 +32,7 @@ NS_ASSUME_NONNULL_BEGIN prefilledInformation:(nullable STPUserInformation *)prefilledInformation shippingAddress:(nullable STPAddress *)shippingAddress paymentMethodTuple:(STPPaymentOptionTuple *)tuple - delegate:(id)delegate; + delegate:(id)delegate; - (void)updateWithPaymentMethodTuple:(STPPaymentOptionTuple *)tuple; diff --git a/Stripe/STPPaymentMethodsInternalViewController.m b/Stripe/STPPaymentOptionsInternalViewController.m similarity index 97% rename from Stripe/STPPaymentMethodsInternalViewController.m rename to Stripe/STPPaymentOptionsInternalViewController.m index 24ba72e31bd..1c87a95219f 100644 --- a/Stripe/STPPaymentMethodsInternalViewController.m +++ b/Stripe/STPPaymentOptionsInternalViewController.m @@ -1,12 +1,12 @@ // -// STPPaymentMethodsInternalViewController.m +// STPPaymentOptionsInternalViewController.m // Stripe // // Created by Jack Flintermann on 6/9/16. // Copyright © 2016 Stripe, Inc. All rights reserved. // -#import "STPPaymentMethodsInternalViewController.h" +#import "STPPaymentOptionsInternalViewController.h" #import "NSArray+Stripe.h" #import "STPAddCardViewController.h" @@ -32,7 +32,7 @@ static NSInteger const PaymentMethodSectionCardList = 0; static NSInteger const PaymentMethodSectionAddCard = 1; -@interface STPPaymentMethodsInternalViewController () +@interface STPPaymentOptionsInternalViewController () @property (nonatomic, strong, readwrite) STPPaymentConfiguration *configuration; @property (nonatomic, strong, nullable, readwrite) id apiAdapter; @@ -40,13 +40,13 @@ @interface STPPaymentMethodsInternalViewController () > *paymentMethods; @property (nonatomic, strong, nullable, readwrite) id selectedPaymentMethod; -@property (nonatomic, weak, nullable, readwrite) id delegate; +@property (nonatomic, weak, nullable, readwrite) id delegate; @property (nonatomic, strong, readwrite) UIImageView *cardImageView; @end -@implementation STPPaymentMethodsInternalViewController +@implementation STPPaymentOptionsInternalViewController - (instancetype)initWithConfiguration:(STPPaymentConfiguration *)configuration customerContext:(nullable STPCustomerContext *)customerContext @@ -54,7 +54,7 @@ - (instancetype)initWithConfiguration:(STPPaymentConfiguration *)configuration prefilledInformation:(nullable STPUserInformation *)prefilledInformation shippingAddress:(nullable STPAddress *)shippingAddress paymentMethodTuple:(STPPaymentOptionTuple *)tuple - delegate:(id)delegate { + delegate:(id)delegate { self = [super initWithTheme:theme]; if (self) { _configuration = configuration; diff --git a/Stripe/STPPaymentMethodsViewController+Private.h b/Stripe/STPPaymentOptionsViewController+Private.h similarity index 81% rename from Stripe/STPPaymentMethodsViewController+Private.h rename to Stripe/STPPaymentOptionsViewController+Private.h index 5375abb4fe3..646b1b86faa 100644 --- a/Stripe/STPPaymentMethodsViewController+Private.h +++ b/Stripe/STPPaymentOptionsViewController+Private.h @@ -1,5 +1,5 @@ // -// STPPaymentMethodsViewController+Private.h +// STPPaymentOptionsViewController+Private.h // Stripe // // Created by Jack Flintermann on 5/18/16. @@ -14,13 +14,13 @@ #import "STPPaymentOptionTuple.h" #import "STPPromise.h" -@interface STPPaymentMethodsViewController (Private) +@interface STPPaymentOptionsViewController (Private) - (instancetype)initWithConfiguration:(STPPaymentConfiguration *)configuration apiAdapter:(id)apiAdapter loadingPromise:(STPPromise *)loadingPromise theme:(STPTheme *)theme shippingAddress:(STPAddress *)shippingAddress - delegate:(id)delegate; + delegate:(id)delegate; @end diff --git a/Stripe/STPPaymentMethodsViewController.m b/Stripe/STPPaymentOptionsViewController.m similarity index 94% rename from Stripe/STPPaymentMethodsViewController.m rename to Stripe/STPPaymentOptionsViewController.m index 9fbd5eda668..a886fc06d7f 100644 --- a/Stripe/STPPaymentMethodsViewController.m +++ b/Stripe/STPPaymentOptionsViewController.m @@ -1,12 +1,12 @@ // -// STPPaymentMethodsViewController.m +// STPPaymentOptionsViewController.m // Stripe // // Created by Jack Flintermann on 1/12/16. // Copyright © 2016 Stripe, Inc. All rights reserved. // -#import "STPPaymentMethodsViewController.h" +#import "STPPaymentOptionsViewController.h" #import "STPAPIClient.h" #import "STPAddCardViewController+Private.h" @@ -21,8 +21,8 @@ #import "STPPaymentContext+Private.h" #import "STPPaymentContext.h" #import "STPPaymentOptionTuple.h" -#import "STPPaymentMethodsInternalViewController.h" -#import "STPPaymentMethodsViewController+Private.h" +#import "STPPaymentOptionsInternalViewController.h" +#import "STPPaymentOptionsViewController+Private.h" #import "STPSource.h" #import "STPTheme.h" #import "STPToken.h" @@ -33,7 +33,7 @@ #import "UIViewController+Stripe_ParentViewController.h" #import "UIViewController+Stripe_Promises.h" -@interface STPPaymentMethodsViewController() +@interface STPPaymentOptionsViewController() @property (nonatomic) STPPaymentConfiguration *configuration; @property (nonatomic) STPAddress *shippingAddress; @@ -46,7 +46,7 @@ @interface STPPaymentMethodsViewController())delegate { + delegate:(id)delegate { return [self initWithConfiguration:configuration theme:theme apiAdapter:customerContext delegate:delegate]; } - (instancetype)initWithConfiguration:(STPPaymentConfiguration *)configuration theme:(STPTheme *)theme apiAdapter:(id)apiAdapter - delegate:(id)delegate { + delegate:(id)delegate { STPPromise *promise = [self retrieveCustomerWithConfiguration:configuration apiAdapter:apiAdapter]; return [self initWithConfiguration:configuration apiAdapter:apiAdapter @@ -111,7 +111,7 @@ - (void)createAndSetupViews { if (tuple.paymentOptions.count > 0) { STPCustomerContext *customerContext = ([self.apiAdapter isKindOfClass:[STPCustomerContext class]]) ? (STPCustomerContext *)self.apiAdapter : nil; - STPPaymentMethodsInternalViewController *payMethodsInternal = [[STPPaymentMethodsInternalViewController alloc] initWithConfiguration:self.configuration + STPPaymentOptionsInternalViewController *payMethodsInternal = [[STPPaymentOptionsInternalViewController alloc] initWithConfiguration:self.configuration customerContext:customerContext theme:self.theme prefilledInformation:self.prefilledInformation @@ -188,8 +188,8 @@ - (void)finishWithPaymentMethod:(id)paymentMethod { STPPromise *promise = [self retrieveCustomerWithConfiguration:self.configuration apiAdapter:self.apiAdapter]; [promise onSuccess:^(STPPaymentOptionTuple *tuple) { stpDispatchToMainThreadIfNecessary(^{ - if ([self.internalViewController isKindOfClass:[STPPaymentMethodsInternalViewController class]]) { - STPPaymentMethodsInternalViewController *paymentMethodsVC = (STPPaymentMethodsInternalViewController *)self.internalViewController; + if ([self.internalViewController isKindOfClass:[STPPaymentOptionsInternalViewController class]]) { + STPPaymentOptionsInternalViewController *paymentMethodsVC = (STPPaymentOptionsInternalViewController *)self.internalViewController; [paymentMethodsVC updateWithPaymentMethodTuple:tuple]; } }); @@ -283,14 +283,14 @@ - (void)dismissWithCompletion:(STPVoidBlock)completion { @end -@implementation STPPaymentMethodsViewController (Private) +@implementation STPPaymentOptionsViewController (Private) - (instancetype)initWithConfiguration:(STPPaymentConfiguration *)configuration apiAdapter:(id)apiAdapter loadingPromise:(STPPromise *)loadingPromise theme:(STPTheme *)theme shippingAddress:(STPAddress *)shippingAddress - delegate:(id)delegate { + delegate:(id)delegate { self = [super initWithTheme:theme]; if (self) { _configuration = configuration; diff --git a/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testChinese@2x.png b/Tests/ReferenceImages_64/STPPaymentOptionsViewControllerLocalizationTests/testChinese@2x.png similarity index 100% rename from Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testChinese@2x.png rename to Tests/ReferenceImages_64/STPPaymentOptionsViewControllerLocalizationTests/testChinese@2x.png diff --git a/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testDutch@2x.png b/Tests/ReferenceImages_64/STPPaymentOptionsViewControllerLocalizationTests/testDutch@2x.png similarity index 100% rename from Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testDutch@2x.png rename to Tests/ReferenceImages_64/STPPaymentOptionsViewControllerLocalizationTests/testDutch@2x.png diff --git a/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testEnglish@2x.png b/Tests/ReferenceImages_64/STPPaymentOptionsViewControllerLocalizationTests/testEnglish@2x.png similarity index 100% rename from Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testEnglish@2x.png rename to Tests/ReferenceImages_64/STPPaymentOptionsViewControllerLocalizationTests/testEnglish@2x.png diff --git a/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testFrench@2x.png b/Tests/ReferenceImages_64/STPPaymentOptionsViewControllerLocalizationTests/testFrench@2x.png similarity index 100% rename from Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testFrench@2x.png rename to Tests/ReferenceImages_64/STPPaymentOptionsViewControllerLocalizationTests/testFrench@2x.png diff --git a/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testGerman@2x.png b/Tests/ReferenceImages_64/STPPaymentOptionsViewControllerLocalizationTests/testGerman@2x.png similarity index 100% rename from Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testGerman@2x.png rename to Tests/ReferenceImages_64/STPPaymentOptionsViewControllerLocalizationTests/testGerman@2x.png diff --git a/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testItalian@2x.png b/Tests/ReferenceImages_64/STPPaymentOptionsViewControllerLocalizationTests/testItalian@2x.png similarity index 100% rename from Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testItalian@2x.png rename to Tests/ReferenceImages_64/STPPaymentOptionsViewControllerLocalizationTests/testItalian@2x.png diff --git a/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testJapanese@2x.png b/Tests/ReferenceImages_64/STPPaymentOptionsViewControllerLocalizationTests/testJapanese@2x.png similarity index 100% rename from Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testJapanese@2x.png rename to Tests/ReferenceImages_64/STPPaymentOptionsViewControllerLocalizationTests/testJapanese@2x.png diff --git a/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testSpanish@2x.png b/Tests/ReferenceImages_64/STPPaymentOptionsViewControllerLocalizationTests/testSpanish@2x.png similarity index 100% rename from Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testSpanish@2x.png rename to Tests/ReferenceImages_64/STPPaymentOptionsViewControllerLocalizationTests/testSpanish@2x.png diff --git a/Tests/Tests/STPPaymentMethodsViewControllerLocalizationTests.m b/Tests/Tests/STPPaymentMethodsViewControllerLocalizationTests.m index e3fade1da81..1d3193f8aff 100644 --- a/Tests/Tests/STPPaymentMethodsViewControllerLocalizationTests.m +++ b/Tests/Tests/STPPaymentMethodsViewControllerLocalizationTests.m @@ -1,5 +1,5 @@ // -// STPPaymentMethodsViewControllerLocalizationTests.m +// STPPaymentOptionsViewControllerLocalizationTests.m // Stripe // // Created by Brian Dorfman on 10/17/16. @@ -14,10 +14,10 @@ #import "STPMocks.h" #import "STPLocalizationUtils+STPTestAdditions.h" -@interface STPPaymentMethodsViewControllerLocalizationTests : FBSnapshotTestCase +@interface STPPaymentOptionsViewControllerLocalizationTests : FBSnapshotTestCase @end -@implementation STPPaymentMethodsViewControllerLocalizationTests +@implementation STPPaymentOptionsViewControllerLocalizationTests //- (void)setUp { // [super setUp]; @@ -32,9 +32,9 @@ - (void)performSnapshotTestForLanguage:(NSString *)language { config.additionalPaymentMethods = STPPaymentOptionTypeAll; STPTheme *theme = [STPTheme defaultTheme]; id customerContext = [STPMocks staticCustomerContextWithCustomer:[STPFixtures customerWithCardTokenAndSourceSources]]; - id delegate = OCMProtocolMock(@protocol(STPPaymentMethodsViewControllerDelegate)); + id delegate = OCMProtocolMock(@protocol(STPPaymentOptionsViewControllerDelegate)); [STPLocalizationUtils overrideLanguageTo:language]; - STPPaymentMethodsViewController *paymentMethodsVC = [[STPPaymentMethodsViewController alloc] initWithConfiguration:config + STPPaymentOptionsViewController *paymentMethodsVC = [[STPPaymentOptionsViewController alloc] initWithConfiguration:config theme:theme customerContext:customerContext delegate:delegate]; diff --git a/Tests/Tests/STPPaymentMethodsViewControllerTest.m b/Tests/Tests/STPPaymentMethodsViewControllerTest.m index 2004862d0bd..4d2891e35a6 100644 --- a/Tests/Tests/STPPaymentMethodsViewControllerTest.m +++ b/Tests/Tests/STPPaymentMethodsViewControllerTest.m @@ -1,5 +1,5 @@ // -// STPPaymentMethodsViewControllerTest.m +// STPPaymentOptionsViewControllerTest.m // Stripe // // Created by Brian Dorfman on 10/10/17. @@ -10,23 +10,23 @@ #import #import "STPFixtures.h" #import "STPMocks.h" -#import "STPPaymentMethodsInternalViewController.h" +#import "STPPaymentOptionsInternalViewController.h" -@interface STPPaymentMethodsViewController (Testing) +@interface STPPaymentOptionsViewController (Testing) @property(nonatomic, weak)UIViewController *internalViewController; @end -@interface STPPaymentMethodsViewControllerTest : XCTestCase +@interface STPPaymentOptionsViewControllerTest : XCTestCase @end -@implementation STPPaymentMethodsViewControllerTest +@implementation STPPaymentOptionsViewControllerTest -- (STPPaymentMethodsViewController *)buildViewControllerWithCustomer:(STPCustomer *)customer +- (STPPaymentOptionsViewController *)buildViewControllerWithCustomer:(STPCustomer *)customer configuration:(STPPaymentConfiguration *)config - delegate:(id)delegate { + delegate:(id)delegate { STPTheme *theme = [STPTheme defaultTheme]; STPCustomerContext *mockCustomerContext = [STPMocks staticCustomerContextWithCustomer:customer]; - STPPaymentMethodsViewController *vc = [[STPPaymentMethodsViewController alloc] initWithConfiguration:config + STPPaymentOptionsViewController *vc = [[STPPaymentOptionsViewController alloc] initWithConfiguration:config theme:theme customerContext:mockCustomerContext delegate:delegate]; @@ -44,8 +44,8 @@ - (void)testInitWithNoSourcesAndConfigWithUseSourcesOffAndCardAvailable { STPCustomer *customer = [STPFixtures customerWithNoSources]; STPPaymentConfiguration *config = [STPFixtures paymentConfiguration]; config.additionalPaymentMethods = STPPaymentOptionTypeNone; - iddelegate = OCMProtocolMock(@protocol(STPPaymentMethodsViewControllerDelegate)); - STPPaymentMethodsViewController *sut = [self buildViewControllerWithCustomer:customer + iddelegate = OCMProtocolMock(@protocol(STPPaymentOptionsViewControllerDelegate)); + STPPaymentOptionsViewController *sut = [self buildViewControllerWithCustomer:customer configuration:config delegate:delegate]; XCTAssertTrue([sut.internalViewController isKindOfClass:[STPAddCardViewController class]]); @@ -53,32 +53,32 @@ - (void)testInitWithNoSourcesAndConfigWithUseSourcesOffAndCardAvailable { /** When the customer has a single card token source and the available payment methods - are card and apple pay, STPPaymentMethodsInternalVC should be shown. + are card and apple pay, STPPaymentOptionsInternalVC should be shown. */ - (void)testInitWithSingleCardTokenSourceAndCardAvailable { STPCustomer *customer = [STPFixtures customerWithSingleCardTokenSource]; STPPaymentConfiguration *config = [STPFixtures paymentConfiguration]; config.additionalPaymentMethods = STPPaymentOptionTypeAll; - iddelegate = OCMProtocolMock(@protocol(STPPaymentMethodsViewControllerDelegate)); - STPPaymentMethodsViewController *sut = [self buildViewControllerWithCustomer:customer + iddelegate = OCMProtocolMock(@protocol(STPPaymentOptionsViewControllerDelegate)); + STPPaymentOptionsViewController *sut = [self buildViewControllerWithCustomer:customer configuration:config delegate:delegate]; - XCTAssertTrue([sut.internalViewController isKindOfClass:[STPPaymentMethodsInternalViewController class]]); + XCTAssertTrue([sut.internalViewController isKindOfClass:[STPPaymentOptionsInternalViewController class]]); } /** When the customer has a single card source source and the available payment methods - are card only, STPPaymentMethodsInternalVC should be shown. + are card only, STPPaymentOptionsInternalVC should be shown. */ - (void)testInitWithSingleCardSourceSourceAndCardAvailable { STPCustomer *customer = [STPFixtures customerWithSingleCardSourceSource]; STPPaymentConfiguration *config = [STPFixtures paymentConfiguration]; config.additionalPaymentMethods = STPPaymentOptionTypeNone; - iddelegate = OCMProtocolMock(@protocol(STPPaymentMethodsViewControllerDelegate)); - STPPaymentMethodsViewController *sut = [self buildViewControllerWithCustomer:customer + iddelegate = OCMProtocolMock(@protocol(STPPaymentOptionsViewControllerDelegate)); + STPPaymentOptionsViewController *sut = [self buildViewControllerWithCustomer:customer configuration:config delegate:delegate]; - XCTAssertTrue([sut.internalViewController isKindOfClass:[STPPaymentMethodsInternalViewController class]]); + XCTAssertTrue([sut.internalViewController isKindOfClass:[STPPaymentOptionsInternalViewController class]]); } #pragma clang diagnostic push @@ -91,8 +91,8 @@ - (void)testInitWithSingleCardSourceSourceAndCardAvailable { - (void)testAddCardCancelForwardsToDelegate { STPCustomer *customer = [STPFixtures customerWithNoSources]; STPPaymentConfiguration *config = [STPFixtures paymentConfiguration]; - iddelegate = OCMProtocolMock(@protocol(STPPaymentMethodsViewControllerDelegate)); - STPPaymentMethodsViewController *sut = [self buildViewControllerWithCustomer:customer + iddelegate = OCMProtocolMock(@protocol(STPPaymentOptionsViewControllerDelegate)); + STPPaymentOptionsViewController *sut = [self buildViewControllerWithCustomer:customer configuration:config delegate:delegate]; XCTAssertTrue([sut.internalViewController isKindOfClass:[STPAddCardViewController class]]); @@ -109,11 +109,11 @@ - (void)testAddCardCancelForwardsToDelegate { - (void)testInternalCancelForwardsToDelegate { STPCustomer *customer = [STPFixtures customerWithSingleCardTokenSource]; STPPaymentConfiguration *config = [STPFixtures paymentConfiguration]; - iddelegate = OCMProtocolMock(@protocol(STPPaymentMethodsViewControllerDelegate)); - STPPaymentMethodsViewController *sut = [self buildViewControllerWithCustomer:customer + iddelegate = OCMProtocolMock(@protocol(STPPaymentOptionsViewControllerDelegate)); + STPPaymentOptionsViewController *sut = [self buildViewControllerWithCustomer:customer configuration:config delegate:delegate]; - XCTAssertTrue([sut.internalViewController isKindOfClass:[STPPaymentMethodsInternalViewController class]]); + XCTAssertTrue([sut.internalViewController isKindOfClass:[STPPaymentOptionsInternalViewController class]]); UIBarButtonItem *cancelButton = sut.internalViewController.navigationItem.leftBarButtonItem; [cancelButton.target performSelector:cancelButton.action withObject:cancelButton]; @@ -129,8 +129,8 @@ - (void)testAddCardAttachesToCustomerAndFinishes { STPPaymentConfiguration *config = [STPFixtures paymentConfiguration]; STPCustomer *customer = [STPFixtures customerWithNoSources]; STPCustomerContext *mockCustomerContext = [STPMocks staticCustomerContextWithCustomer:customer]; - iddelegate = OCMProtocolMock(@protocol(STPPaymentMethodsViewControllerDelegate)); - STPPaymentMethodsViewController *sut = [[STPPaymentMethodsViewController alloc] initWithConfiguration:config + iddelegate = OCMProtocolMock(@protocol(STPPaymentOptionsViewControllerDelegate)); + STPPaymentOptionsViewController *sut = [[STPPaymentOptionsViewController alloc] initWithConfiguration:config theme:theme customerContext:mockCustomerContext delegate:delegate]; @@ -177,8 +177,8 @@ - (void)testCreatesCardSources { config.createCardSources = YES; STPCustomer *customer = [STPFixtures customerWithNoSources]; STPCustomerContext *mockCustomerContext = [STPMocks staticCustomerContextWithCustomer:customer]; - iddelegate = OCMProtocolMock(@protocol(STPPaymentMethodsViewControllerDelegate)); - STPPaymentMethodsViewController *sut = [[STPPaymentMethodsViewController alloc] initWithConfiguration:config + iddelegate = OCMProtocolMock(@protocol(STPPaymentOptionsViewControllerDelegate)); + STPPaymentOptionsViewController *sut = [[STPPaymentOptionsViewController alloc] initWithConfiguration:config theme:theme customerContext:mockCustomerContext delegate:delegate]; diff --git a/Tests/Tests/UINavigationBar+StripeTest.m b/Tests/Tests/UINavigationBar+StripeTest.m index b102ecaaa56..acb80532b09 100644 --- a/Tests/Tests/UINavigationBar+StripeTest.m +++ b/Tests/Tests/UINavigationBar+StripeTest.m @@ -18,13 +18,13 @@ @interface UINavigationBar_StripeTest : XCTestCase @implementation UINavigationBar_StripeTest -- (STPPaymentMethodsViewController *)buildPaymentMethodsViewController { +- (STPPaymentOptionsViewController *)buildPaymentMethodsViewController { id customerContext = [STPMocks staticCustomerContext]; STPPaymentConfiguration *config = [STPFixtures paymentConfiguration]; config.publishableKey = @"pk_test"; STPTheme *theme = [STPTheme defaultTheme]; - id delegate = OCMProtocolMock(@protocol(STPPaymentMethodsViewControllerDelegate)); - STPPaymentMethodsViewController *paymentMethodsVC = [[STPPaymentMethodsViewController alloc] initWithConfiguration:config + id delegate = OCMProtocolMock(@protocol(STPPaymentOptionsViewControllerDelegate)); + STPPaymentOptionsViewController *paymentMethodsVC = [[STPPaymentOptionsViewController alloc] initWithConfiguration:config theme:theme customerContext:customerContext delegate:delegate]; @@ -32,7 +32,7 @@ - (STPPaymentMethodsViewController *)buildPaymentMethodsViewController { } - (void)testVCUsesNavigationBarColor { - STPPaymentMethodsViewController *paymentMethodsVC = [self buildPaymentMethodsViewController]; + STPPaymentOptionsViewController *paymentMethodsVC = [self buildPaymentMethodsViewController]; STPTheme *navTheme = [STPTheme new]; navTheme.accentColor = [UIColor purpleColor]; @@ -43,7 +43,7 @@ - (void)testVCUsesNavigationBarColor { } - (void)testVCDoesNotUseNavigationBarColor { - STPPaymentMethodsViewController *paymentMethodsVC = [self buildPaymentMethodsViewController]; + STPPaymentOptionsViewController *paymentMethodsVC = [self buildPaymentMethodsViewController]; __unused UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:paymentMethodsVC]; __unused UIView *view = paymentMethodsVC.view; XCTAssertEqualObjects(paymentMethodsVC.navigationItem.leftBarButtonItem.tintColor, [STPTheme defaultTheme].accentColor); From 64447afad7955e9a9ca086f540f0b54066178550 Mon Sep 17 00:00:00 2001 From: Yuki Tokuhiro Date: Mon, 4 Mar 2019 15:58:04 -0800 Subject: [PATCH 04/11] Rename STPPaymentMethodTableViewCell -> STPPaymentOptionTableViewCell --- Stripe.xcodeproj/project.pbxproj | 24 ++++++------ ...Cell.h => STPPaymentOptionTableViewCell.h} | 4 +- ...Cell.m => STPPaymentOptionTableViewCell.m} | 38 +++++++++---------- .../STPPaymentOptionsInternalViewController.m | 8 ++-- 4 files changed, 37 insertions(+), 37 deletions(-) rename Stripe/{STPPaymentMethodTableViewCell.h => STPPaymentOptionTableViewCell.h} (65%) rename Stripe/{STPPaymentMethodTableViewCell.m => STPPaymentOptionTableViewCell.m} (84%) diff --git a/Stripe.xcodeproj/project.pbxproj b/Stripe.xcodeproj/project.pbxproj index f24a189aba1..6fc9b2e863c 100644 --- a/Stripe.xcodeproj/project.pbxproj +++ b/Stripe.xcodeproj/project.pbxproj @@ -512,10 +512,10 @@ C1363BB21D76337900EB82B4 /* stp_icon_checkmark.png in Resources */ = {isa = PBXBuildFile; fileRef = C1363BAC1D76337400EB82B4 /* stp_icon_checkmark.png */; }; C1363BB31D76337900EB82B4 /* stp_icon_checkmark@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C1363BAD1D76337400EB82B4 /* stp_icon_checkmark@2x.png */; }; C1363BB41D76337900EB82B4 /* stp_icon_checkmark@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = C1363BAE1D76337400EB82B4 /* stp_icon_checkmark@3x.png */; }; - C1363BB71D7633D800EB82B4 /* STPPaymentMethodTableViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = C1363BB51D7633D800EB82B4 /* STPPaymentMethodTableViewCell.h */; }; - C1363BB81D7633D800EB82B4 /* STPPaymentMethodTableViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = C1363BB51D7633D800EB82B4 /* STPPaymentMethodTableViewCell.h */; }; - C1363BB91D7633D800EB82B4 /* STPPaymentMethodTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C1363BB61D7633D800EB82B4 /* STPPaymentMethodTableViewCell.m */; }; - C1363BBA1D7633D800EB82B4 /* STPPaymentMethodTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C1363BB61D7633D800EB82B4 /* STPPaymentMethodTableViewCell.m */; }; + C1363BB71D7633D800EB82B4 /* STPPaymentOptionTableViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = C1363BB51D7633D800EB82B4 /* STPPaymentOptionTableViewCell.h */; }; + C1363BB81D7633D800EB82B4 /* STPPaymentOptionTableViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = C1363BB51D7633D800EB82B4 /* STPPaymentOptionTableViewCell.h */; }; + C1363BB91D7633D800EB82B4 /* STPPaymentOptionTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C1363BB61D7633D800EB82B4 /* STPPaymentOptionTableViewCell.m */; }; + C1363BBA1D7633D800EB82B4 /* STPPaymentOptionTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C1363BB61D7633D800EB82B4 /* STPPaymentOptionTableViewCell.m */; }; C14C4DB11EC3B34500C2FDF6 /* STPAPIRequestTest.m in Sources */ = {isa = PBXBuildFile; fileRef = C14C4DB01EC3B34500C2FDF6 /* STPAPIRequestTest.m */; }; C15608DD1FE08F2E0032AE66 /* UIView+Stripe_SafeAreaBounds.h in Headers */ = {isa = PBXBuildFile; fileRef = C15608DB1FE08F2E0032AE66 /* UIView+Stripe_SafeAreaBounds.h */; }; C15608DE1FE08F2E0032AE66 /* UIView+Stripe_SafeAreaBounds.h in Headers */ = {isa = PBXBuildFile; fileRef = C15608DB1FE08F2E0032AE66 /* UIView+Stripe_SafeAreaBounds.h */; }; @@ -1200,8 +1200,8 @@ C1363BAC1D76337400EB82B4 /* stp_icon_checkmark.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = stp_icon_checkmark.png; sourceTree = ""; }; C1363BAD1D76337400EB82B4 /* stp_icon_checkmark@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "stp_icon_checkmark@2x.png"; sourceTree = ""; }; C1363BAE1D76337400EB82B4 /* stp_icon_checkmark@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "stp_icon_checkmark@3x.png"; sourceTree = ""; }; - C1363BB51D7633D800EB82B4 /* STPPaymentMethodTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STPPaymentMethodTableViewCell.h; sourceTree = ""; }; - C1363BB61D7633D800EB82B4 /* STPPaymentMethodTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPPaymentMethodTableViewCell.m; sourceTree = ""; }; + C1363BB51D7633D800EB82B4 /* STPPaymentOptionTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STPPaymentOptionTableViewCell.h; sourceTree = ""; }; + C1363BB61D7633D800EB82B4 /* STPPaymentOptionTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPPaymentOptionTableViewCell.m; sourceTree = ""; }; C14C4DB01EC3B34500C2FDF6 /* STPAPIRequestTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPAPIRequestTest.m; sourceTree = ""; }; C15608DB1FE08F2E0032AE66 /* UIView+Stripe_SafeAreaBounds.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIView+Stripe_SafeAreaBounds.h"; sourceTree = ""; }; C15608DC1FE08F2E0032AE66 /* UIView+Stripe_SafeAreaBounds.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIView+Stripe_SafeAreaBounds.m"; sourceTree = ""; }; @@ -2199,8 +2199,8 @@ children = ( C17A030B1CBEE7A2006C819F /* STPAddressFieldTableViewCell.h */, C17A030C1CBEE7A2006C819F /* STPAddressFieldTableViewCell.m */, - C1363BB51D7633D800EB82B4 /* STPPaymentMethodTableViewCell.h */, - C1363BB61D7633D800EB82B4 /* STPPaymentMethodTableViewCell.m */, + C1363BB51D7633D800EB82B4 /* STPPaymentOptionTableViewCell.h */, + C1363BB61D7633D800EB82B4 /* STPPaymentOptionTableViewCell.m */, 04B31DFD1D131D9000EF1631 /* STPPaymentCardTextFieldCell.h */, 04B31DFE1D131D9000EF1631 /* STPPaymentCardTextFieldCell.m */, C15993311D8808680047950D /* STPShippingMethodTableViewCell.h */, @@ -2250,7 +2250,7 @@ F1D3A2661EBA5BAE0095BFA9 /* STPPaymentCardTextField+Private.h in Headers */, F1DEB8911E2052150066B8E8 /* STPCoreScrollViewController.h in Headers */, C1785F5D1EC60B5E00E9CFAC /* STPCardIOProxy.h in Headers */, - C1363BB81D7633D800EB82B4 /* STPPaymentMethodTableViewCell.h in Headers */, + C1363BB81D7633D800EB82B4 /* STPPaymentOptionTableViewCell.h in Headers */, C1271A3F1E3FA4EB00F25DFE /* STPSectionHeaderView.h in Headers */, 049E84D91A605EF0000B66CD /* Stripe.h in Headers */, 0439B9881C454F97005A1ED5 /* STPPaymentOptionsViewController.h in Headers */, @@ -2509,7 +2509,7 @@ F1BEB2FD1F3508BB0043F48C /* NSError+Stripe.h in Headers */, 049A3F7E1CC1920A00F57DE7 /* UIViewController+Stripe_KeyboardAvoiding.h in Headers */, 04BFFFD91D240B13005F2340 /* STPAddCardViewController+Private.h in Headers */, - C1363BB71D7633D800EB82B4 /* STPPaymentMethodTableViewCell.h in Headers */, + C1363BB71D7633D800EB82B4 /* STPPaymentOptionTableViewCell.h in Headers */, 04B31DE61D09D25F00EF1631 /* STPPaymentOptionsInternalViewController.h in Headers */, 04CDB4FE1A5F30A700B854EE /* STPAPIClient.h in Headers */, 045D712C1CF4ED7600F6CD65 /* STPBINRange.h in Headers */, @@ -3127,7 +3127,7 @@ 045D71231CEFA57000F6CD65 /* UIViewController+Stripe_Promises.m in Sources */, 04BC29A11CD8412000318357 /* STPPaymentContext.m in Sources */, 04CDE5C71BC20AF800548833 /* STPBankAccountParams.m in Sources */, - C1363BBA1D7633D800EB82B4 /* STPPaymentMethodTableViewCell.m in Sources */, + C1363BBA1D7633D800EB82B4 /* STPPaymentOptionTableViewCell.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3169,7 +3169,7 @@ 04E39F6B1CED48D500AF3B96 /* UIBarButtonItem+Stripe.m in Sources */, 04CDB5181A5F30A700B854EE /* StripeError.m in Sources */, C15993371D8808680047950D /* STPShippingMethodsViewController.m in Sources */, - C1363BB91D7633D800EB82B4 /* STPPaymentMethodTableViewCell.m in Sources */, + C1363BB91D7633D800EB82B4 /* STPPaymentOptionTableViewCell.m in Sources */, C15993331D8808680047950D /* STPShippingAddressViewController.m in Sources */, 04633B051CD44F1C009D4FB5 /* STPAPIClient+ApplePay.m in Sources */, F1C7B8D31DBECF2400D9F6F0 /* STPDispatchFunctions.m in Sources */, diff --git a/Stripe/STPPaymentMethodTableViewCell.h b/Stripe/STPPaymentOptionTableViewCell.h similarity index 65% rename from Stripe/STPPaymentMethodTableViewCell.h rename to Stripe/STPPaymentOptionTableViewCell.h index 62a5a3b45cf..cd640f55fc2 100644 --- a/Stripe/STPPaymentMethodTableViewCell.h +++ b/Stripe/STPPaymentOptionTableViewCell.h @@ -14,10 +14,10 @@ NS_ASSUME_NONNULL_BEGIN -@interface STPPaymentMethodTableViewCell : UITableViewCell +@interface STPPaymentOptionTableViewCell : UITableViewCell - (void)configureForNewCardRowWithTheme:(STPTheme *)theme; -- (void)configureWithPaymentMethod:(id)paymentMethod theme:(STPTheme *)theme selected:(BOOL)selected; +- (void)configureWithPaymentOption:(id)paymentOption theme:(STPTheme *)theme selected:(BOOL)selected; @end diff --git a/Stripe/STPPaymentMethodTableViewCell.m b/Stripe/STPPaymentOptionTableViewCell.m similarity index 84% rename from Stripe/STPPaymentMethodTableViewCell.m rename to Stripe/STPPaymentOptionTableViewCell.m index 43abe14cca1..957beea26bf 100644 --- a/Stripe/STPPaymentMethodTableViewCell.m +++ b/Stripe/STPPaymentOptionTableViewCell.m @@ -1,12 +1,12 @@ // -// STPPaymentMethodTableViewCell.m +// STPPaymentOptionTableViewCell.m // Stripe // // Created by Ben Guo on 8/30/16. // Copyright © 2016 Stripe, Inc. All rights reserved. // -#import "STPPaymentMethodTableViewCell.h" +#import "STPPaymentOptionTableViewCell.h" #import "STPApplePay.h" #import "STPCard.h" @@ -16,9 +16,9 @@ #import "STPSource.h" #import "STPTheme.h" -@interface STPPaymentMethodTableViewCell () +@interface STPPaymentOptionTableViewCell () -@property (nonatomic, strong, nullable, readwrite) id paymentMethod; +@property (nonatomic, strong, nullable, readwrite) id paymentOption; @property (nonatomic, strong, readwrite) STPTheme *theme; @property (nonatomic, strong, readwrite) UIImageView *leftIcon; @@ -27,7 +27,7 @@ @interface STPPaymentMethodTableViewCell () @end -@implementation STPPaymentMethodTableViewCell +@implementation STPPaymentOptionTableViewCell - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(nullable NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; @@ -74,7 +74,7 @@ - (void)layoutSubviews { } - (void)configureForNewCardRowWithTheme:(STPTheme *)theme { - self.paymentMethod = nil; + self.paymentOption = nil; self.theme = theme; self.backgroundColor = theme.secondaryBackgroundColor; @@ -94,19 +94,19 @@ - (void)configureForNewCardRowWithTheme:(STPTheme *)theme { [self setNeedsLayout]; } -- (void)configureWithPaymentMethod:(id)paymentMethod theme:(STPTheme *)theme selected:(BOOL)selected { - self.paymentMethod = paymentMethod; +- (void)configureWithPaymentOption:(id)paymentOption theme:(STPTheme *)theme selected:(BOOL)selected { + self.paymentOption = paymentOption; self.theme = theme; self.backgroundColor = theme.secondaryBackgroundColor; // Left icon - self.leftIcon.image = paymentMethod.templateImage; - self.leftIcon.tintColor = [self primaryColorForPaymentMethodWithSelected:selected]; + self.leftIcon.image = paymentOption.templateImage; + self.leftIcon.tintColor = [self primaryColorForPaymentOptionWithSelected:selected]; // Title label self.titleLabel.font = theme.font; - self.titleLabel.attributedText = [self buildAttributedStringWithPaymentMethod:paymentMethod selected:selected]; + self.titleLabel.attributedText = [self buildAttributedStringWithPaymentOption:paymentOption selected:selected]; // Checkmark icon self.checkmarkIcon.tintColor = theme.accentColor; @@ -115,25 +115,25 @@ - (void)configureWithPaymentMethod:(id)paymentMethod theme:(ST [self setNeedsLayout]; } -- (UIColor *)primaryColorForPaymentMethodWithSelected:(BOOL)selected { +- (UIColor *)primaryColorForPaymentOptionWithSelected:(BOOL)selected { return selected ? self.theme.accentColor : [self.theme.primaryForegroundColor colorWithAlphaComponent:0.6f]; } -- (NSAttributedString *)buildAttributedStringWithPaymentMethod:(id)paymentMethod selected:(BOOL)selected { - if ([paymentMethod isKindOfClass:[STPCard class]]) { - return [self buildAttributedStringWithCard:(STPCard *)paymentMethod selected:selected]; +- (NSAttributedString *)buildAttributedStringWithPaymentOption:(id)paymentOption selected:(BOOL)selected { + if ([paymentOption isKindOfClass:[STPCard class]]) { + return [self buildAttributedStringWithCard:(STPCard *)paymentOption selected:selected]; } - else if ([paymentMethod isKindOfClass:[STPSource class]]) { - STPSource *source = (STPSource *)paymentMethod; + else if ([paymentOption isKindOfClass:[STPSource class]]) { + STPSource *source = (STPSource *)paymentOption; if (source.type == STPSourceTypeCard && source.cardDetails != nil) { return [self buildAttributedStringWithCardSource:source selected:selected]; } } - if ([paymentMethod isKindOfClass:[STPApplePay class]]) { + if ([paymentOption isKindOfClass:[STPApplePay class]]) { NSString *label = STPLocalizedString(@"Apple Pay", @"Text for Apple Pay payment method"); - UIColor *primaryColor = [self primaryColorForPaymentMethodWithSelected:selected]; + UIColor *primaryColor = [self primaryColorForPaymentOptionWithSelected:selected]; return [[NSAttributedString alloc] initWithString:label attributes:@{NSForegroundColorAttributeName: primaryColor}]; } diff --git a/Stripe/STPPaymentOptionsInternalViewController.m b/Stripe/STPPaymentOptionsInternalViewController.m index 1c87a95219f..13554940b6a 100644 --- a/Stripe/STPPaymentOptionsInternalViewController.m +++ b/Stripe/STPPaymentOptionsInternalViewController.m @@ -17,7 +17,7 @@ #import "STPImageLibrary.h" #import "STPImageLibrary+Private.h" #import "STPLocalizationUtils.h" -#import "STPPaymentMethodTableViewCell.h" +#import "STPPaymentOptionTableViewCell.h" #import "STPPaymentOptionTuple.h" #import "STPPromise.h" #import "STPSource.h" @@ -76,7 +76,7 @@ - (void)createAndSetupViews { [super createAndSetupViews]; // Table view - [self.tableView registerClass:[STPPaymentMethodTableViewCell class] forCellReuseIdentifier:PaymentMethodCellReuseIdentifier]; + [self.tableView registerClass:[STPPaymentOptionTableViewCell class] forCellReuseIdentifier:PaymentMethodCellReuseIdentifier]; self.tableView.dataSource = self; self.tableView.delegate = self; @@ -233,13 +233,13 @@ - (NSInteger)tableView:(__unused UITableView *)tableView numberOfRowsInSection:( } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - STPPaymentMethodTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:PaymentMethodCellReuseIdentifier forIndexPath:indexPath]; + STPPaymentOptionTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:PaymentMethodCellReuseIdentifier forIndexPath:indexPath]; if (indexPath.section == PaymentMethodSectionCardList) { id paymentMethod = [self.paymentMethods stp_boundSafeObjectAtIndex:indexPath.row]; BOOL selected = [paymentMethod isEqual:self.selectedPaymentMethod]; - [cell configureWithPaymentMethod:paymentMethod theme:self.theme selected:selected]; + [cell configureWithPaymentOption:paymentMethod theme:self.theme selected:selected]; } else { [cell configureForNewCardRowWithTheme:self.theme]; From 5c1d76797a5d7ce7363cf82dba8542fa3f40bd23 Mon Sep 17 00:00:00 2001 From: Yuki Tokuhiro Date: Mon, 4 Mar 2019 16:28:20 -0800 Subject: [PATCH 05/11] the rest. --- .../CheckoutViewController.swift | 10 +- .../SettingsViewController.swift | 4 +- .../UI Examples/BrowseViewController.swift | 10 +- Stripe.xcodeproj/project.pbxproj | 16 +-- Stripe/PublicHeaders/STPApplePay.h | 2 +- .../PublicHeaders/STPPaymentConfiguration.h | 14 +- Stripe/PublicHeaders/STPPaymentContext.h | 18 +-- .../STPPaymentOptionsViewController.h | 32 ++--- Stripe/STPAnalyticsClient.m | 2 +- Stripe/STPPaymentConfiguration.m | 32 ++--- Stripe/STPPaymentContext+Private.h | 2 +- Stripe/STPPaymentContext.m | 120 +++++++++--------- Stripe/STPPaymentOptionTableViewCell.h | 2 +- .../STPPaymentOptionsInternalViewController.h | 8 +- .../STPPaymentOptionsInternalViewController.m | 104 +++++++-------- Stripe/STPPaymentOptionsViewController.m | 52 ++++---- Stripe/STPShippingAddressViewController.m | 6 +- ...TPAddCardViewControllerLocalizationTests.m | 2 +- Tests/Tests/STPCustomerSourceTupleTest.m | 4 +- Tests/Tests/STPMocks.h | 2 +- Tests/Tests/STPMocks.m | 2 +- Tests/Tests/STPPaymentConfigurationTest.m | 22 ++-- Tests/Tests/STPPaymentContextSnapshotTests.m | 6 +- ...tOptionsViewControllerLocalizationTests.m} | 6 +- ... => STPPaymentOptionsViewControllerTest.m} | 22 ++-- Tests/Tests/STPSourceTest.m | 6 +- Tests/Tests/UINavigationBar+StripeTest.m | 22 ++-- 27 files changed, 264 insertions(+), 264 deletions(-) rename Tests/Tests/{STPPaymentMethodsViewControllerLocalizationTests.m => STPPaymentOptionsViewControllerLocalizationTests.m} (93%) rename Tests/Tests/{STPPaymentMethodsViewControllerTest.m => STPPaymentOptionsViewControllerTest.m} (93%) diff --git a/Example/Standard Integration (Swift)/CheckoutViewController.swift b/Example/Standard Integration (Swift)/CheckoutViewController.swift index a4fe1afc5db..75b9b795f56 100644 --- a/Example/Standard Integration (Swift)/CheckoutViewController.swift +++ b/Example/Standard Integration (Swift)/CheckoutViewController.swift @@ -80,7 +80,7 @@ class CheckoutViewController: UIViewController, STPPaymentContextDelegate { config.requiredBillingAddressFields = settings.requiredBillingAddressFields config.requiredShippingAddressFields = settings.requiredShippingAddressFields config.shippingType = settings.shippingType - config.additionalPaymentMethods = settings.additionalPaymentMethods + config.additionalPaymentOptions = settings.additionalPaymentOptions // Create card sources instead of card tokens config.createCardSources = true; @@ -96,7 +96,7 @@ class CheckoutViewController: UIViewController, STPPaymentContextDelegate { let paymentSelectionFooter = PaymentContextFooterView(text: "You can add custom footer views to the payment selection screen.") paymentSelectionFooter.theme = settings.theme - paymentContext.paymentMethodsViewControllerFooterView = paymentSelectionFooter + paymentContext.paymentOptionsViewControllerFooterView = paymentSelectionFooter let addCardFooter = PaymentContextFooterView(text: "You can add custom footer views to the add card screen.") addCardFooter.theme = settings.theme @@ -155,7 +155,7 @@ class CheckoutViewController: UIViewController, STPPaymentContextDelegate { self.buyButton.addTarget(self, action: #selector(didTapBuy), for: .touchUpInside) self.totalRow.detail = self.numberFormatter.string(from: NSNumber(value: Float(self.paymentContext.paymentAmount)/100))! self.paymentRow.onTap = { [weak self] in - self?.paymentContext.pushPaymentMethodsViewController() + self?.paymentContext.pushPaymentOptionsViewController() } self.shippingRow.onTap = { [weak self] in self?.paymentContext.pushShippingViewController() @@ -220,8 +220,8 @@ class CheckoutViewController: UIViewController, STPPaymentContextDelegate { func paymentContextDidChange(_ paymentContext: STPPaymentContext) { self.paymentRow.loading = paymentContext.loading - if let paymentMethod = paymentContext.selectedPaymentMethod { - self.paymentRow.detail = paymentMethod.label + if let paymentOption = paymentContext.selectedPaymentOption { + self.paymentRow.detail = paymentOption.label } else { self.paymentRow.detail = "Select Payment" diff --git a/Example/Standard Integration (Swift)/SettingsViewController.swift b/Example/Standard Integration (Swift)/SettingsViewController.swift index c35407d2f6e..e4c95a107f2 100644 --- a/Example/Standard Integration (Swift)/SettingsViewController.swift +++ b/Example/Standard Integration (Swift)/SettingsViewController.swift @@ -11,7 +11,7 @@ import Stripe struct Settings { let theme: STPTheme - let additionalPaymentMethods: STPPaymentOptionType + let additionalPaymentOptions: STPPaymentOptionType let requiredBillingAddressFields: STPBillingAddressFields let requiredShippingAddressFields: Set let shippingType: STPShippingType @@ -20,7 +20,7 @@ struct Settings { class SettingsViewController: UITableViewController { var settings: Settings { return Settings(theme: self.theme.stpTheme, - additionalPaymentMethods: self.applePay.enabled ? .all : STPPaymentOptionType(), + additionalPaymentOptions: self.applePay.enabled ? .all : STPPaymentOptionType(), requiredBillingAddressFields: self.requiredBillingAddressFields.stpBillingAddressFields, requiredShippingAddressFields: self.requiredShippingAddressFields.stpContactFields, shippingType: self.shippingType.stpShippingType) diff --git a/Example/UI Examples/BrowseViewController.swift b/Example/UI Examples/BrowseViewController.swift index 7ccb87804ae..9d031205dcb 100644 --- a/Example/UI Examples/BrowseViewController.swift +++ b/Example/UI Examples/BrowseViewController.swift @@ -93,7 +93,7 @@ class BrowseViewController: UITableViewController, STPAddCardViewControllerDeleg present(navigationController, animated: true, completion: nil) case .STPPaymentOptionsViewController: let config = STPPaymentConfiguration() - config.additionalPaymentMethods = .all + config.additionalPaymentOptions = .all config.requiredBillingAddressFields = .none config.appleMerchantIdentifier = "dummy-merchant-id" let viewController = STPPaymentOptionsViewController(configuration: config, @@ -134,15 +134,15 @@ class BrowseViewController: UITableViewController, STPAddCardViewControllerDeleg // MARK: STPPaymentOptionsViewControllerDelegate - func paymentMethodsViewControllerDidCancel(_ paymentMethodsViewController: STPPaymentOptionsViewController) { + func paymentOptionsViewControllerDidCancel(_ paymentOptionsViewController: STPPaymentOptionsViewController) { dismiss(animated: true, completion: nil) } - func paymentMethodsViewControllerDidFinish(_ paymentMethodsViewController: STPPaymentOptionsViewController) { - paymentMethodsViewController.navigationController?.popViewController(animated: true) + func paymentOptionsViewControllerDidFinish(_ paymentOptionsViewController: STPPaymentOptionsViewController) { + paymentOptionsViewController.navigationController?.popViewController(animated: true) } - func paymentMethodsViewController(_ paymentMethodsViewController: STPPaymentOptionsViewController, didFailToLoadWithError error: Error) { + func paymentOptionsViewController(_ paymentOptionsViewController: STPPaymentOptionsViewController, didFailToLoadWithError error: Error) { dismiss(animated: true, completion: nil) } diff --git a/Stripe.xcodeproj/project.pbxproj b/Stripe.xcodeproj/project.pbxproj index 6fc9b2e863c..2270ea0b3b0 100644 --- a/Stripe.xcodeproj/project.pbxproj +++ b/Stripe.xcodeproj/project.pbxproj @@ -759,7 +759,7 @@ F1A7A0541FE053D900B47D4A /* FauxPasAnnotations.h in Headers */ = {isa = PBXBuildFile; fileRef = F10239381FDF4144006273B5 /* FauxPasAnnotations.h */; settings = {ATTRIBUTES = (Public, ); }; }; F1B8534F1FDF544B0065A49E /* FBSnapshotTestCase+STPViewControllerLoading.h in Headers */ = {isa = PBXBuildFile; fileRef = F1B8534D1FDF544B0065A49E /* FBSnapshotTestCase+STPViewControllerLoading.h */; }; F1B853501FDF544B0065A49E /* FBSnapshotTestCase+STPViewControllerLoading.m in Sources */ = {isa = PBXBuildFile; fileRef = F1B8534E1FDF544B0065A49E /* FBSnapshotTestCase+STPViewControllerLoading.m */; }; - F1B980941DB550E60075332E /* STPPaymentMethodsViewControllerLocalizationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F1B980931DB550E60075332E /* STPPaymentMethodsViewControllerLocalizationTests.m */; }; + F1B980941DB550E60075332E /* STPPaymentOptionsViewControllerLocalizationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F1B980931DB550E60075332E /* STPPaymentOptionsViewControllerLocalizationTests.m */; }; F1BA241E1E57BE5E00E4A1CF /* CardSource.json in Resources */ = {isa = PBXBuildFile; fileRef = F1BA241C1E57BE5700E4A1CF /* CardSource.json */; }; F1BA24211E57BECA00E4A1CF /* 3DSSource.json in Resources */ = {isa = PBXBuildFile; fileRef = F1BA241F1E57BEC600E4A1CF /* 3DSSource.json */; }; F1BEB2F91F34F2250043F48C /* STPSourceEnums.h in Headers */ = {isa = PBXBuildFile; fileRef = F1BEB2F81F34F2250043F48C /* STPSourceEnums.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -799,7 +799,7 @@ F1D96F971DC7D82400477E64 /* STPLocalizationUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = F1D96F951DC7D82400477E64 /* STPLocalizationUtils.h */; }; F1D96F9A1DC7DCDE00477E64 /* STPLocalizationUtils+STPTestAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = F1D96F981DC7DCDE00477E64 /* STPLocalizationUtils+STPTestAdditions.h */; }; F1D96F9B1DC7DCDE00477E64 /* STPLocalizationUtils+STPTestAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = F1D96F991DC7DCDE00477E64 /* STPLocalizationUtils+STPTestAdditions.m */; }; - F1DE88011F8D410D00602F4C /* STPPaymentMethodsViewControllerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = F1DE87FF1F8D410D00602F4C /* STPPaymentMethodsViewControllerTest.m */; }; + F1DE88011F8D410D00602F4C /* STPPaymentOptionsViewControllerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = F1DE87FF1F8D410D00602F4C /* STPPaymentOptionsViewControllerTest.m */; }; F1DEB88A1E2047CA0066B8E8 /* STPCoreTableViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = F1DEB8881E2047CA0066B8E8 /* STPCoreTableViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; F1DEB88B1E2047CA0066B8E8 /* STPCoreTableViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = F1DEB8881E2047CA0066B8E8 /* STPCoreTableViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; F1DEB88C1E2047CA0066B8E8 /* STPCoreTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F1DEB8891E2047CA0066B8E8 /* STPCoreTableViewController.m */; }; @@ -1341,7 +1341,7 @@ F1A2F92B1EEB6A70006B0456 /* NSCharacterSet+Stripe.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSCharacterSet+Stripe.m"; sourceTree = ""; }; F1B8534D1FDF544B0065A49E /* FBSnapshotTestCase+STPViewControllerLoading.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "FBSnapshotTestCase+STPViewControllerLoading.h"; sourceTree = ""; }; F1B8534E1FDF544B0065A49E /* FBSnapshotTestCase+STPViewControllerLoading.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "FBSnapshotTestCase+STPViewControllerLoading.m"; sourceTree = ""; }; - F1B980931DB550E60075332E /* STPPaymentMethodsViewControllerLocalizationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPPaymentMethodsViewControllerLocalizationTests.m; sourceTree = ""; }; + F1B980931DB550E60075332E /* STPPaymentOptionsViewControllerLocalizationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPPaymentOptionsViewControllerLocalizationTests.m; sourceTree = ""; }; F1BA241C1E57BE5700E4A1CF /* CardSource.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = CardSource.json; sourceTree = ""; }; F1BA241F1E57BEC600E4A1CF /* 3DSSource.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = 3DSSource.json; sourceTree = ""; }; F1BEB2F81F34F2250043F48C /* STPSourceEnums.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = STPSourceEnums.h; path = PublicHeaders/STPSourceEnums.h; sourceTree = ""; }; @@ -1366,7 +1366,7 @@ F1D96F951DC7D82400477E64 /* STPLocalizationUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STPLocalizationUtils.h; sourceTree = ""; }; F1D96F981DC7DCDE00477E64 /* STPLocalizationUtils+STPTestAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "STPLocalizationUtils+STPTestAdditions.h"; sourceTree = ""; }; F1D96F991DC7DCDE00477E64 /* STPLocalizationUtils+STPTestAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "STPLocalizationUtils+STPTestAdditions.m"; sourceTree = ""; }; - F1DE87FF1F8D410D00602F4C /* STPPaymentMethodsViewControllerTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPPaymentMethodsViewControllerTest.m; sourceTree = ""; }; + F1DE87FF1F8D410D00602F4C /* STPPaymentOptionsViewControllerTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPPaymentOptionsViewControllerTest.m; sourceTree = ""; }; F1DEB8881E2047CA0066B8E8 /* STPCoreTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = STPCoreTableViewController.h; path = PublicHeaders/STPCoreTableViewController.h; sourceTree = ""; }; F1DEB8891E2047CA0066B8E8 /* STPCoreTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPCoreTableViewController.m; sourceTree = ""; }; F1DEB88E1E2052150066B8E8 /* STPCoreScrollViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = STPCoreScrollViewController.h; path = PublicHeaders/STPCoreScrollViewController.h; sourceTree = ""; }; @@ -1683,7 +1683,7 @@ children = ( F156753F1DB544D3004468E3 /* STPAddCardViewControllerLocalizationTests.m */, C1054F901FE197AE0033C87E /* STPPaymentContextSnapshotTests.m */, - F1B980931DB550E60075332E /* STPPaymentMethodsViewControllerLocalizationTests.m */, + F1B980931DB550E60075332E /* STPPaymentOptionsViewControllerLocalizationTests.m */, C1EF04491DD2396200FBF452 /* STPShippingAddressViewControllerLocalizationTests.m */, C1EF044A1DD2396200FBF452 /* STPShippingMethodsViewControllerLocalizationTests.m */, ); @@ -1751,7 +1751,7 @@ B3BDCAD020EEF5B90034F7F5 /* STPPaymentIntentParamsTest.m */, B36C6D772193A16F00D17575 /* STPPaymentIntentSourceActionTest.m */, B3BDCACC20EEF4540034F7F5 /* STPPaymentIntentTest.m */, - F1DE87FF1F8D410D00602F4C /* STPPaymentMethodsViewControllerTest.m */, + F1DE87FF1F8D410D00602F4C /* STPPaymentOptionsViewControllerTest.m */, C1EEDCC91CA2186300A54582 /* STPPhoneNumberValidatorTest.m */, C1FEE5981CBFF24000A7632B /* STPPostalCodeValidatorTest.m */, F152321A1EA92F9D00D65C67 /* STPRedirectContextTest.m */, @@ -2939,7 +2939,7 @@ 04A488361CA34DC600506E53 /* STPEmailAddressValidatorTest.m in Sources */, C1EEDCCA1CA2186300A54582 /* STPPhoneNumberValidatorTest.m in Sources */, 04CB86BA1BA89CE100E4F61E /* PKPayment+StripeTest.m in Sources */, - F1B980941DB550E60075332E /* STPPaymentMethodsViewControllerLocalizationTests.m in Sources */, + F1B980941DB550E60075332E /* STPPaymentOptionsViewControllerLocalizationTests.m in Sources */, 04E01F8621AA36320061402F /* STPNetworkStubbingTestCase.m in Sources */, C124A1851CCAB750007D42EE /* STPAnalyticsClientTest.m in Sources */, C18867DC1E8B0C4100A77634 /* STPFixtures.m in Sources */, @@ -2996,7 +2996,7 @@ F1D3A25F1EB015B30095BFA9 /* UIImage+StripeTests.m in Sources */, 04415C6B1A6605B5001225ED /* STPBankAccountFunctionalTest.m in Sources */, 8B6DC9751F0171D20025E811 /* STPSourceReceiverTest.m in Sources */, - F1DE88011F8D410D00602F4C /* STPPaymentMethodsViewControllerTest.m in Sources */, + F1DE88011F8D410D00602F4C /* STPPaymentOptionsViewControllerTest.m in Sources */, 8B6DC9771F0172640025E811 /* STPSourceSEPADebitDetailsTest.m in Sources */, 04415C6C1A6605B5001225ED /* STPBankAccountTest.m in Sources */, C19D09931EAEAE5E00A4AB3E /* STPTelemetryClientTest.m in Sources */, diff --git a/Stripe/PublicHeaders/STPApplePay.h b/Stripe/PublicHeaders/STPApplePay.h index 56bc5facf85..a892882151d 100644 --- a/Stripe/PublicHeaders/STPApplePay.h +++ b/Stripe/PublicHeaders/STPApplePay.h @@ -14,7 +14,7 @@ be checked on an `STPPaymentContext`, e.g: ``` - if ([paymentContext.selectedPaymentMethod isKindOfClass:[STPApplePay class]]) { + if ([paymentContext.selectedPaymentOption isKindOfClass:[STPApplePay class]]) { // Don't ask the user for their card number; they want to pay with apple pay. } ``` diff --git a/Stripe/PublicHeaders/STPPaymentConfiguration.h b/Stripe/PublicHeaders/STPPaymentConfiguration.h index b5598f363ef..5f8800c9d4a 100644 --- a/Stripe/PublicHeaders/STPPaymentConfiguration.h +++ b/Stripe/PublicHeaders/STPPaymentConfiguration.h @@ -38,11 +38,11 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, copy, readwrite) NSString *publishableKey; /** - An enum value representing which payment methods you will accept from your user + An enum value representing which payment options you will accept from your user in addition to credit cards. Unless you have a very specific reason not to, you should leave this at the default, `STPPaymentOptionTypeAll`. */ -@property (nonatomic, assign, readwrite) STPPaymentOptionType additionalPaymentMethods; +@property (nonatomic, assign, readwrite) STPPaymentOptionType additionalPaymentOptions; /** The billing address fields the user must fill out when prompted for their @@ -95,19 +95,19 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, copy, nullable, readwrite) NSString *appleMerchantIdentifier; /** - Determines whether or not the user is able to delete payment methods + Determines whether or not the user is able to delete payment options This is only relevant to the `STPPaymentOptionsViewController` which, if - enabled, will allow the user to delete payment methods by tapping the "Edit" - button in the navigation bar or by swiping left on a payment method and tapping + enabled, will allow the user to delete payment options by tapping the "Edit" + button in the navigation bar or by swiping left on a payment option and tapping "Delete". Currently, the user is not allowed to delete the selected payment - method but this may change in the future. + option but this may change in the future. Default value is YES but will only work if `STPPaymentOptionsViewController` is initialized with a `STPCustomerContext` either through the `STPPaymentContext` or directly as an init parameter. */ -@property (nonatomic, assign, readwrite) BOOL canDeletePaymentMethods; +@property (nonatomic, assign, readwrite) BOOL canDeletePaymentOptions; /** If the value of this property is true, when your user adds a card in our UI, diff --git a/Stripe/PublicHeaders/STPPaymentContext.h b/Stripe/PublicHeaders/STPPaymentContext.h index 6014c33bce6..3eae4bbfc55 100644 --- a/Stripe/PublicHeaders/STPPaymentContext.h +++ b/Stripe/PublicHeaders/STPPaymentContext.h @@ -137,14 +137,14 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, readonly) BOOL loading; /** - The user's currently selected payment method. May be nil. + The user's currently selected payment option. May be nil. */ -@property (nonatomic, readonly, nullable) id selectedPaymentMethod; +@property (nonatomic, readonly, nullable) id selectedPaymentOption; /** - The available payment methods the user can choose between. May be nil. + The available payment options the user can choose between. May be nil. */ -@property (nonatomic, readonly, nullable) NSArray> *paymentMethods; +@property (nonatomic, readonly, nullable) NSArray> *paymentOptions; /** The user's currently selected shipping method. May be nil. @@ -249,14 +249,14 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, assign) UINavigationItemLargeTitleDisplayMode largeTitleDisplayMode NS_AVAILABLE_IOS(11_0); /** - A view that will be placed as the footer of the payment methods selection + A view that will be placed as the footer of the payment options selection view controller. When the footer view needs to be resized, it will be sent a `sizeThatFits:` call. The view should respond correctly to this method in order to be sized and positioned properly. */ -@property (nonatomic, strong) UIView *paymentMethodsViewControllerFooterView; +@property (nonatomic, strong) UIView *paymentOptionsViewControllerFooterView; /** A view that will be placed as the footer of the add card view controller. @@ -285,7 +285,7 @@ NS_ASSUME_NONNULL_BEGIN @note This method will do nothing if it is called while STPPaymentContext is already showing a view controller or in the middle of requesting a payment. */ -- (void)presentPaymentMethodsViewController; +- (void)presentPaymentOptionsViewController; /** This creates, configures, and appropriately pushes an `STPPaymentOptionsViewController` @@ -295,7 +295,7 @@ NS_ASSUME_NONNULL_BEGIN @note This method will do nothing if it is called while STPPaymentContext is already showing a view controller or in the middle of requesting a payment. */ -- (void)pushPaymentMethodsViewController; +- (void)pushPaymentOptionsViewController; /** This creates, configures, and appropriately presents a view controller for @@ -354,7 +354,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)paymentContext:(STPPaymentContext *)paymentContext didFailToLoadWithError:(NSError *)error; /** - This is called every time the contents of the payment context change. When this is called, you should update your app's UI to reflect the current state of the payment context. For example, if you have a checkout page with a "selected payment method" row, you should update its payment method with `paymentContext.selectedPaymentMethod.label`. If that checkout page has a "buy" button, you should enable/disable it depending on the result of `[paymentContext isReadyForPayment]`. + This is called every time the contents of the payment context change. When this is called, you should update your app's UI to reflect the current state of the payment context. For example, if you have a checkout page with a "selected payment method" row, you should update its payment method with `paymentContext.selectedPaymentOption.label`. If that checkout page has a "buy" button, you should enable/disable it depending on the result of `[paymentContext isReadyForPayment]`. @param paymentContext the payment context that changed */ diff --git a/Stripe/PublicHeaders/STPPaymentOptionsViewController.h b/Stripe/PublicHeaders/STPPaymentOptionsViewController.h index 8f648dc7d44..6ab39f94e15 100644 --- a/Stripe/PublicHeaders/STPPaymentOptionsViewController.h +++ b/Stripe/PublicHeaders/STPPaymentOptionsViewController.h @@ -28,8 +28,8 @@ NS_ASSUME_NONNULL_BEGIN as the `rootViewController` and then present the `UINavigationController`, or push a new `STPPaymentOptionsViewController` onto an existing `UINavigationController`'s stack. You can also have `STPPaymentContext` do this - for you automatically, by calling `presentPaymentMethodsViewController` - or `pushPaymentMethodsViewController` on it. + for you automatically, by calling `presentPaymentOptionsViewController` + or `pushPaymentOptionsViewController` on it. */ @interface STPPaymentOptionsViewController : STPCoreViewController @@ -109,7 +109,7 @@ NS_ASSUME_NONNULL_BEGIN `sizeThatFits:` call. The view should respond correctly to this method in order to be sized and positioned properly. */ -@property (nonatomic, strong) UIView *paymentMethodsViewControllerFooterView; +@property (nonatomic, strong) UIView *paymentOptionsViewControllerFooterView; /** A view that will be placed as the footer of the view controller when it is @@ -160,31 +160,31 @@ NS_ASSUME_NONNULL_BEGIN /** This is called when the view controller encounters an error fetching the user's - payment methods from its API adapter. You should dismiss the view controller + payment options from its API adapter. You should dismiss the view controller when this is called. - @param paymentMethodsViewController the view controller in question + @param paymentOptionsViewController the view controller in question @param error the error that occurred */ -- (void)paymentMethodsViewController:(STPPaymentOptionsViewController *)paymentMethodsViewController +- (void)paymentOptionsViewController:(STPPaymentOptionsViewController *)paymentOptionsViewController didFailToLoadWithError:(NSError *)error; /** This is called when the user selects or adds a payment method, so it will often - be called immediately after calling `paymentMethodsViewController:didSelectPaymentMethod:`. + be called immediately after calling `paymentOptionsViewController:didSelectPaymentOption:`. You should dismiss the view controller when this is called. - @param paymentMethodsViewController the view controller that has finished + @param paymentOptionsViewController the view controller that has finished */ -- (void)paymentMethodsViewControllerDidFinish:(STPPaymentOptionsViewController *)paymentMethodsViewController; +- (void)paymentOptionsViewControllerDidFinish:(STPPaymentOptionsViewController *)paymentOptionsViewController; /** This is called when the user taps "cancel". You should dismiss the view controller when this is called. - @param paymentMethodsViewController the view controller that has finished + @param paymentOptionsViewController the view controller that has finished */ -- (void)paymentMethodsViewControllerDidCancel:(STPPaymentOptionsViewController *)paymentMethodsViewController; +- (void)paymentOptionsViewControllerDidCancel:(STPPaymentOptionsViewController *)paymentOptionsViewController; @optional /** @@ -194,15 +194,15 @@ NS_ASSUME_NONNULL_BEGIN choice. You should use this callback to update any necessary UI in your app that displays the user's currently selected payment method. You should *not* dismiss the view controller at this point, instead do this in - `paymentMethodsViewControllerDidFinish:`. `STPPaymentOptionsViewController` + `paymentOptionsViewControllerDidFinish:`. `STPPaymentOptionsViewController` will also call the necessary methods on your API adapter, so you don't need to call them directly during this method. - @param paymentMethodsViewController the view controller in question - @param paymentMethod the selected payment method + @param paymentOptionsViewController the view controller in question + @param paymentOption the selected payment method */ -- (void)paymentMethodsViewController:(STPPaymentOptionsViewController *)paymentMethodsViewController - didSelectPaymentMethod:(id)paymentMethod; +- (void)paymentOptionsViewController:(STPPaymentOptionsViewController *)paymentOptionsViewController + didSelectPaymentOption:(id)paymentOption; @end diff --git a/Stripe/STPAnalyticsClient.m b/Stripe/STPAnalyticsClient.m index 9d7561cd2bb..76d23ad9d94 100644 --- a/Stripe/STPAnalyticsClient.m +++ b/Stripe/STPAnalyticsClient.m @@ -253,7 +253,7 @@ + (NSMutableDictionary *)commonPayload { + (NSDictionary *)serializeConfiguration:(STPPaymentConfiguration *)configuration { NSMutableDictionary *dictionary = [NSMutableDictionary dictionary]; dictionary[@"publishable_key"] = configuration.publishableKey ?: @"unknown"; - switch (configuration.additionalPaymentMethods) { + switch (configuration.additionalPaymentOptions) { case STPPaymentOptionTypeAll: dictionary[@"additional_payment_methods"] = @"all"; case STPPaymentOptionTypeNone: diff --git a/Stripe/STPPaymentConfiguration.m b/Stripe/STPPaymentConfiguration.m index aaca917cde8..5d811808176 100644 --- a/Stripe/STPPaymentConfiguration.m +++ b/Stripe/STPPaymentConfiguration.m @@ -39,13 +39,13 @@ + (instancetype)sharedConfiguration { - (instancetype)init { self = [super init]; if (self) { - _additionalPaymentMethods = STPPaymentOptionTypeAll; + _additionalPaymentOptions = STPPaymentOptionTypeAll; _requiredBillingAddressFields = STPBillingAddressFieldsNone; _requiredShippingAddressFields = nil; _verifyPrefilledShippingAddress = YES; _shippingType = STPShippingTypeShipping; _companyName = [NSBundle stp_applicationName]; - _canDeletePaymentMethods = YES; + _canDeletePaymentOptions = YES; _createCardSources = NO; } return self; @@ -53,29 +53,29 @@ - (instancetype)init { - (BOOL)applePayEnabled { return self.appleMerchantIdentifier && - (self.additionalPaymentMethods & STPPaymentOptionTypeApplePay) && + (self.additionalPaymentOptions & STPPaymentOptionTypeApplePay) && [Stripe deviceSupportsApplePay]; } #pragma mark - Description - (NSString *)description { - NSString *additionalPaymentMethodsDescription; + NSString *additionalPaymentOptionsDescription; - if (self.additionalPaymentMethods == STPPaymentOptionTypeAll) { - additionalPaymentMethodsDescription = @"STPPaymentOptionTypeAll"; + if (self.additionalPaymentOptions == STPPaymentOptionTypeAll) { + additionalPaymentOptionsDescription = @"STPPaymentOptionTypeAll"; } - else if (self.additionalPaymentMethods == STPPaymentOptionTypeNone) { - additionalPaymentMethodsDescription = @"STPPaymentOptionTypeNone"; + else if (self.additionalPaymentOptions == STPPaymentOptionTypeNone) { + additionalPaymentOptionsDescription = @"STPPaymentOptionTypeNone"; } else { - NSMutableArray *paymentMethodOptions = [[NSMutableArray alloc] init]; + NSMutableArray *paymentOptions = [[NSMutableArray alloc] init]; - if (self.additionalPaymentMethods & STPPaymentOptionTypeApplePay) { - [paymentMethodOptions addObject:@"STPPaymentOptionTypeApplePay"]; + if (self.additionalPaymentOptions & STPPaymentOptionTypeApplePay) { + [paymentOptions addObject:@"STPPaymentOptionTypeApplePay"]; } - additionalPaymentMethodsDescription = [paymentMethodOptions componentsJoinedByString:@"|"]; + additionalPaymentOptionsDescription = [paymentOptions componentsJoinedByString:@"|"]; } NSString *requiredBillingAddressFieldsDescription; @@ -114,7 +114,7 @@ - (NSString *)description { // Basic configuration [NSString stringWithFormat:@"publishableKey = %@", (self.publishableKey) ? @"" : nil], - [NSString stringWithFormat:@"additionalPaymentMethods = %@", additionalPaymentMethodsDescription], + [NSString stringWithFormat:@"additionalPaymentOptions = %@", additionalPaymentOptionsDescription], // Billing and shipping [NSString stringWithFormat:@"requiredBillingAddressFields = %@", requiredBillingAddressFieldsDescription], @@ -125,7 +125,7 @@ - (NSString *)description { // Additional configuration [NSString stringWithFormat:@"companyName = %@", self.companyName], [NSString stringWithFormat:@"appleMerchantIdentifier = %@", self.appleMerchantIdentifier], - [NSString stringWithFormat:@"canDeletePaymentMethods = %@", (self.canDeletePaymentMethods) ? @"YES" : @"NO"], + [NSString stringWithFormat:@"canDeletePaymentOptions = %@", (self.canDeletePaymentOptions) ? @"YES" : @"NO"], ]; return [NSString stringWithFormat:@"<%@>", [props componentsJoinedByString:@"; "]]; @@ -136,14 +136,14 @@ - (NSString *)description { - (id)copyWithZone:(__unused NSZone *)zone { STPPaymentConfiguration *copy = [self.class new]; copy.publishableKey = self.publishableKey; - copy.additionalPaymentMethods = self.additionalPaymentMethods; + copy.additionalPaymentOptions = self.additionalPaymentOptions; copy.requiredBillingAddressFields = self.requiredBillingAddressFields; copy.requiredShippingAddressFields = self.requiredShippingAddressFields; copy.verifyPrefilledShippingAddress = self.verifyPrefilledShippingAddress; copy.shippingType = self.shippingType; copy.companyName = self.companyName; copy.appleMerchantIdentifier = self.appleMerchantIdentifier; - copy.canDeletePaymentMethods = self.canDeletePaymentMethods; + copy.canDeletePaymentOptions = self.canDeletePaymentOptions; return copy; } diff --git a/Stripe/STPPaymentContext+Private.h b/Stripe/STPPaymentContext+Private.h index 707ab57ba85..be48b606826 100644 --- a/Stripe/STPPaymentContext+Private.h +++ b/Stripe/STPPaymentContext+Private.h @@ -18,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, readonly) STPPromise *currentValuePromise; -- (void)removePaymentMethod:(id)paymentMethodToRemove; +- (void)removePaymentOption:(id)paymentOptionToRemove; @end diff --git a/Stripe/STPPaymentContext.m b/Stripe/STPPaymentContext.m index b363b36ef40..e712c4e13e3 100644 --- a/Stripe/STPPaymentContext.m +++ b/Stripe/STPPaymentContext.m @@ -50,9 +50,9 @@ @interface STPPaymentContext() selectedPaymentMethod; -@property (nonatomic) NSArray> *paymentMethods; +@property (nonatomic, weak) STPPaymentOptionsViewController *paymentOptionsViewController; +@property (nonatomic) id selectedPaymentOption; +@property (nonatomic) NSArray> *paymentOptions; @property (nonatomic) STPAddress *shippingAddress; @property (nonatomic) PKShippingMethod *selectedShippingMethod; @property (nonatomic) NSArray *shippingMethods; @@ -120,14 +120,14 @@ - (void)retryLoading { WEAK(self); self.loadingPromise = [[[STPPromise new] onSuccess:^(STPPaymentOptionTuple *tuple) { STRONG(self); - self.paymentMethods = tuple.paymentOptions; - self.selectedPaymentMethod = tuple.selectedPaymentOption; + self.paymentOptions = tuple.paymentOptions; + self.selectedPaymentOption = tuple.selectedPaymentOption; }] onFailure:^(NSError * _Nonnull error) { STRONG(self); if (self.hostViewController) { [self.didAppearPromise onSuccess:^(__unused id value) { - if (self.paymentMethodsViewController) { - [self appropriatelyDismissPaymentMethodsViewController:self.paymentMethodsViewController completion:^{ + if (self.paymentOptionsViewController) { + [self appropriatelyDismissPaymentOptionsViewController:self.paymentOptionsViewController completion:^{ [self.delegate paymentContext:self didFailToLoadWithError:error]; }]; } else { @@ -193,8 +193,8 @@ - (void)setDelegate:(id)delegate { WEAK(self); return (STPPromise *)[self.loadingPromise map:^id _Nonnull(__unused STPPaymentOptionTuple *value) { STRONG(self); - return [STPPaymentOptionTuple tupleWithPaymentOptions:self.paymentMethods - selectedPaymentOption:self.selectedPaymentMethod]; + return [STPPaymentOptionTuple tupleWithPaymentOptions:self.paymentOptions + selectedPaymentOption:self.selectedPaymentOption]; }]; } @@ -206,8 +206,8 @@ - (void)setPrefilledInformation:(STPUserInformation *)prefilledInformation { } } -- (void)setPaymentMethods:(NSArray> *)paymentMethods { - _paymentMethods = [paymentMethods sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) { +- (void)setPaymentOptions:(NSArray> *)paymentOptions { + _paymentOptions = [paymentOptions sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) { Class applePayKlass = [STPApplePay class]; Class cardKlass = [STPCard class]; if ([obj1 isKindOfClass:applePayKlass]) { @@ -223,12 +223,12 @@ - (void)setPaymentMethods:(NSArray> *)paymentMethods { }]; } -- (void)setSelectedPaymentMethod:(id)selectedPaymentMethod { - if (selectedPaymentMethod && ![self.paymentMethods containsObject:selectedPaymentMethod]) { - self.paymentMethods = [self.paymentMethods arrayByAddingObject:selectedPaymentMethod]; +- (void)setSelectedPaymentOption:(id)selectedPaymentOption { + if (selectedPaymentOption && ![self.paymentOptions containsObject:selectedPaymentOption]) { + self.paymentOptions = [self.paymentOptions arrayByAddingObject:selectedPaymentOption]; } - if (![_selectedPaymentMethod isEqual:selectedPaymentMethod]) { - _selectedPaymentMethod = selectedPaymentMethod; + if (![_selectedPaymentOption isEqual:selectedPaymentOption]) { + _selectedPaymentOption = selectedPaymentOption; stpDispatchToMainThreadIfNecessary(^{ [self.delegate paymentContextDidChange:self]; }); @@ -267,41 +267,41 @@ - (void)setShippingMethods:(NSArray *)shippingMethods { } } -- (void)removePaymentMethod:(id)paymentMethodToRemove { +- (void)removePaymentOption:(id)paymentOptionToRemove { // Remove payment method from cached representation - NSMutableArray *paymentMethods = [self.paymentMethods mutableCopy]; - [paymentMethods removeObject:paymentMethodToRemove]; - self.paymentMethods = paymentMethods; + NSMutableArray *paymentOptions = [self.paymentOptions mutableCopy]; + [paymentOptions removeObject:paymentOptionToRemove]; + self.paymentOptions = paymentOptions; // Elect new selected payment method if needed - if ([self.selectedPaymentMethod isEqual:paymentMethodToRemove]) { - self.selectedPaymentMethod = self.paymentMethods.firstObject; + if ([self.selectedPaymentOption isEqual:paymentOptionToRemove]) { + self.selectedPaymentOption = self.paymentOptions.firstObject; } } #pragma mark - Payment Methods -- (void)presentPaymentMethodsViewController { - [self presentPaymentMethodsViewControllerWithNewState:STPPaymentContextStateShowingRequestedViewController]; +- (void)presentPaymentOptionsViewController { + [self presentPaymentOptionsViewControllerWithNewState:STPPaymentContextStateShowingRequestedViewController]; } -- (void)presentPaymentMethodsViewControllerWithNewState:(STPPaymentContextState)state { - NSCAssert(self.hostViewController != nil, @"hostViewController must not be nil on STPPaymentContext when calling pushPaymentMethodsViewController on it. Next time, set the hostViewController property first!"); +- (void)presentPaymentOptionsViewControllerWithNewState:(STPPaymentContextState)state { + NSCAssert(self.hostViewController != nil, @"hostViewController must not be nil on STPPaymentContext when calling pushPaymentOptionsViewController on it. Next time, set the hostViewController property first!"); WEAK(self); [self.didAppearPromise voidOnSuccess:^{ STRONG(self); if (self.state == STPPaymentContextStateNone) { self.state = state; - STPPaymentOptionsViewController *paymentMethodsViewController = [[STPPaymentOptionsViewController alloc] initWithPaymentContext:self]; - self.paymentMethodsViewController = paymentMethodsViewController; - paymentMethodsViewController.prefilledInformation = self.prefilledInformation; - paymentMethodsViewController.paymentMethodsViewControllerFooterView = self.paymentMethodsViewControllerFooterView; - paymentMethodsViewController.addCardViewControllerFooterView = self.addCardViewControllerFooterView; + STPPaymentOptionsViewController *paymentOptionsViewController = [[STPPaymentOptionsViewController alloc] initWithPaymentContext:self]; + self.paymentOptionsViewController = paymentOptionsViewController; + paymentOptionsViewController.prefilledInformation = self.prefilledInformation; + paymentOptionsViewController.paymentOptionsViewControllerFooterView = self.paymentOptionsViewControllerFooterView; + paymentOptionsViewController.addCardViewControllerFooterView = self.addCardViewControllerFooterView; if (@available(iOS 11, *)) { - paymentMethodsViewController.navigationItem.largeTitleDisplayMode = self.largeTitleDisplayMode; + paymentOptionsViewController.navigationItem.largeTitleDisplayMode = self.largeTitleDisplayMode; } - UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:paymentMethodsViewController]; + UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:paymentOptionsViewController]; navigationController.navigationBar.stp_theme = self.theme; if (@available(iOS 11, *)) { navigationController.navigationBar.prefersLargeTitles = YES; @@ -314,43 +314,43 @@ - (void)presentPaymentMethodsViewControllerWithNewState:(STPPaymentContextState) }]; } -- (void)pushPaymentMethodsViewController { - NSCAssert(self.hostViewController != nil, @"hostViewController must not be nil on STPPaymentContext when calling pushPaymentMethodsViewController on it. Next time, set the hostViewController property first!"); +- (void)pushPaymentOptionsViewController { + NSCAssert(self.hostViewController != nil, @"hostViewController must not be nil on STPPaymentContext when calling pushPaymentOptionsViewController on it. Next time, set the hostViewController property first!"); UINavigationController *navigationController; if ([self.hostViewController isKindOfClass:[UINavigationController class]]) { navigationController = (UINavigationController *)self.hostViewController; } else { navigationController = self.hostViewController.navigationController; } - NSCAssert(self.hostViewController != nil, @"The payment context's hostViewController is not a navigation controller, or is not contained in one. Either make sure it is inside a navigation controller before calling pushPaymentMethodsViewController, or call presentPaymentMethodsViewController instead."); + NSCAssert(self.hostViewController != nil, @"The payment context's hostViewController is not a navigation controller, or is not contained in one. Either make sure it is inside a navigation controller before calling pushPaymentOptionsViewController, or call presentPaymentOptionsViewController instead."); WEAK(self); [self.didAppearPromise voidOnSuccess:^{ STRONG(self); if (self.state == STPPaymentContextStateNone) { self.state = STPPaymentContextStateShowingRequestedViewController; - STPPaymentOptionsViewController *paymentMethodsViewController = [[STPPaymentOptionsViewController alloc] initWithPaymentContext:self]; - self.paymentMethodsViewController = paymentMethodsViewController; - paymentMethodsViewController.prefilledInformation = self.prefilledInformation; - paymentMethodsViewController.paymentMethodsViewControllerFooterView = self.paymentMethodsViewControllerFooterView; - paymentMethodsViewController.addCardViewControllerFooterView = self.addCardViewControllerFooterView; + STPPaymentOptionsViewController *paymentOptionsViewController = [[STPPaymentOptionsViewController alloc] initWithPaymentContext:self]; + self.paymentOptionsViewController = paymentOptionsViewController; + paymentOptionsViewController.prefilledInformation = self.prefilledInformation; + paymentOptionsViewController.paymentOptionsViewControllerFooterView = self.paymentOptionsViewControllerFooterView; + paymentOptionsViewController.addCardViewControllerFooterView = self.addCardViewControllerFooterView; if (@available(iOS 11, *)) { - paymentMethodsViewController.navigationItem.largeTitleDisplayMode = self.largeTitleDisplayMode; + paymentOptionsViewController.navigationItem.largeTitleDisplayMode = self.largeTitleDisplayMode; } - [navigationController pushViewController:paymentMethodsViewController + [navigationController pushViewController:paymentOptionsViewController animated:[self transitionAnimationsEnabled]]; } }]; } -- (void)paymentMethodsViewController:(__unused STPPaymentOptionsViewController *)paymentMethodsViewController - didSelectPaymentMethod:(id)paymentMethod { - self.selectedPaymentMethod = paymentMethod; +- (void)paymentOptionsViewController:(__unused STPPaymentOptionsViewController *)paymentOptionsViewController + didSelectPaymentOption:(id)paymentOption { + self.selectedPaymentOption = paymentOption; } -- (void)paymentMethodsViewControllerDidFinish:(STPPaymentOptionsViewController *)paymentMethodsViewController { - [self appropriatelyDismissPaymentMethodsViewController:paymentMethodsViewController completion:^{ +- (void)paymentOptionsViewControllerDidFinish:(STPPaymentOptionsViewController *)paymentOptionsViewController { + [self appropriatelyDismissPaymentOptionsViewController:paymentOptionsViewController completion:^{ if (self.state == STPPaymentContextStateRequestingPayment) { self.state = STPPaymentContextStateNone; [self requestPayment]; @@ -361,8 +361,8 @@ - (void)paymentMethodsViewControllerDidFinish:(STPPaymentOptionsViewController * }]; } -- (void)paymentMethodsViewControllerDidCancel:(STPPaymentOptionsViewController *)paymentMethodsViewController { - [self appropriatelyDismissPaymentMethodsViewController:paymentMethodsViewController completion:^{ +- (void)paymentOptionsViewControllerDidCancel:(STPPaymentOptionsViewController *)paymentOptionsViewController { + [self appropriatelyDismissPaymentOptionsViewController:paymentOptionsViewController completion:^{ if (self.state == STPPaymentContextStateRequestingPayment) { [self didFinishWithStatus:STPPaymentStatusUserCancellation error:nil]; @@ -373,18 +373,18 @@ - (void)paymentMethodsViewControllerDidCancel:(STPPaymentOptionsViewController * }]; } -- (void)paymentMethodsViewController:(__unused STPPaymentOptionsViewController *)paymentMethodsViewController +- (void)paymentOptionsViewController:(__unused STPPaymentOptionsViewController *)paymentOptionsViewController didFailToLoadWithError:(__unused NSError *)error { // we'll handle this ourselves when the loading promise fails. } -- (void)appropriatelyDismissPaymentMethodsViewController:(STPPaymentOptionsViewController *)viewController +- (void)appropriatelyDismissPaymentOptionsViewController:(STPPaymentOptionsViewController *)viewController completion:(STPVoidBlock)completion { if ([viewController stp_isAtRootOfNavigationController]) { // if we're the root of the navigation controller, we've been presented modally. [viewController.presentingViewController dismissViewControllerAnimated:[self transitionAnimationsEnabled] completion:^{ - self.paymentMethodsViewController = nil; + self.paymentOptionsViewController = nil; if (completion) { completion(); } @@ -399,7 +399,7 @@ - (void)appropriatelyDismissPaymentMethodsViewController:(STPPaymentOptionsViewC [viewController.navigationController stp_popToViewController:destinationViewController animated:[self transitionAnimationsEnabled] completion:^{ - self.paymentMethodsViewController = nil; + self.paymentOptionsViewController = nil; if (completion) { completion(); } @@ -576,16 +576,16 @@ - (void)requestPayment { return; } - if (!self.selectedPaymentMethod) { - [self presentPaymentMethodsViewControllerWithNewState:STPPaymentContextStateRequestingPayment]; + if (!self.selectedPaymentOption) { + [self presentPaymentOptionsViewControllerWithNewState:STPPaymentContextStateRequestingPayment]; } else if ([self requestPaymentShouldPresentShippingViewController]) { [self presentShippingViewControllerWithNewState:STPPaymentContextStateRequestingPayment]; } - else if ([self.selectedPaymentMethod isKindOfClass:[STPCard class]] || - [self.selectedPaymentMethod isKindOfClass:[STPSource class]]) { + else if ([self.selectedPaymentOption isKindOfClass:[STPCard class]] || + [self.selectedPaymentOption isKindOfClass:[STPSource class]]) { self.state = STPPaymentContextStateRequestingPayment; - STPPaymentResult *result = [[STPPaymentResult alloc] initWithSource:(id)self.selectedPaymentMethod]; + STPPaymentResult *result = [[STPPaymentResult alloc] initWithSource:(id)self.selectedPaymentOption]; [self.delegate paymentContext:self didCreatePaymentResult:result completion:^(NSError * _Nullable error) { stpDispatchToMainThreadIfNecessary(^{ if (error) { @@ -596,7 +596,7 @@ - (void)requestPayment { }); }]; } - else if ([self.selectedPaymentMethod isKindOfClass:[STPApplePay class]]) { + else if ([self.selectedPaymentOption isKindOfClass:[STPApplePay class]]) { self.state = STPPaymentContextStateRequestingPayment; PKPaymentRequest *paymentRequest = [self buildPaymentRequest]; STPShippingAddressSelectionBlock shippingAddressHandler = ^(STPAddress *shippingAddress, STPShippingAddressValidationBlock completion) { diff --git a/Stripe/STPPaymentOptionTableViewCell.h b/Stripe/STPPaymentOptionTableViewCell.h index cd640f55fc2..50dce83aeca 100644 --- a/Stripe/STPPaymentOptionTableViewCell.h +++ b/Stripe/STPPaymentOptionTableViewCell.h @@ -1,5 +1,5 @@ // -// STPPaymentMethodTableViewCell.h +// STPPaymentOptionTableViewCell.h // Stripe // // Created by Ben Guo on 8/30/16. diff --git a/Stripe/STPPaymentOptionsInternalViewController.h b/Stripe/STPPaymentOptionsInternalViewController.h index b01c5e9deaa..ec81eaebc72 100644 --- a/Stripe/STPPaymentOptionsInternalViewController.h +++ b/Stripe/STPPaymentOptionsInternalViewController.h @@ -17,8 +17,8 @@ NS_ASSUME_NONNULL_BEGIN @protocol STPPaymentOptionsInternalViewControllerDelegate -- (void)internalViewControllerDidSelectPaymentMethod:(id)paymentMethod; -- (void)internalViewControllerDidDeletePaymentMethod:(id)paymentMethod; +- (void)internalViewControllerDidSelectPaymentOption:(id)paymentOption; +- (void)internalViewControllerDidDeletePaymentOption:(id)paymentOption; - (void)internalViewControllerDidCreateSource:(id)source completion:(STPErrorBlock)completion; - (void)internalViewControllerDidCancel; @@ -31,10 +31,10 @@ NS_ASSUME_NONNULL_BEGIN theme:(STPTheme *)theme prefilledInformation:(nullable STPUserInformation *)prefilledInformation shippingAddress:(nullable STPAddress *)shippingAddress - paymentMethodTuple:(STPPaymentOptionTuple *)tuple + paymentOptionTuple:(STPPaymentOptionTuple *)tuple delegate:(id)delegate; -- (void)updateWithPaymentMethodTuple:(STPPaymentOptionTuple *)tuple; +- (void)updateWithPaymentOptionTuple:(STPPaymentOptionTuple *)tuple; @property (nonatomic, strong, nullable) UIView *customFooterView; @property (nonatomic, assign) BOOL createsCardSources; diff --git a/Stripe/STPPaymentOptionsInternalViewController.m b/Stripe/STPPaymentOptionsInternalViewController.m index 13554940b6a..7a1c0556dcb 100644 --- a/Stripe/STPPaymentOptionsInternalViewController.m +++ b/Stripe/STPPaymentOptionsInternalViewController.m @@ -27,10 +27,10 @@ #import "UIViewController+Stripe_NavigationItemProxy.h" #import "UIViewController+Stripe_Promises.h" -static NSString * const PaymentMethodCellReuseIdentifier = @"PaymentMethodCellReuseIdentifier"; +static NSString * const PaymentOptionCellReuseIdentifier = @"PaymentOptionCellReuseIdentifier"; -static NSInteger const PaymentMethodSectionCardList = 0; -static NSInteger const PaymentMethodSectionAddCard = 1; +static NSInteger const PaymentOptionSectionCardList = 0; +static NSInteger const PaymentOptionSectionAddCard = 1; @interface STPPaymentOptionsInternalViewController () @@ -38,8 +38,8 @@ @interface STPPaymentOptionsInternalViewController () apiAdapter; @property (nonatomic, strong, nullable, readwrite) STPUserInformation *prefilledInformation; @property (nonatomic, strong, nullable, readwrite) STPAddress *shippingAddress; -@property (nonatomic, strong, readwrite) NSArray> *paymentMethods; -@property (nonatomic, strong, nullable, readwrite) id selectedPaymentMethod; +@property (nonatomic, strong, readwrite) NSArray> *paymentOptions; +@property (nonatomic, strong, nullable, readwrite) id selectedPaymentOption; @property (nonatomic, weak, nullable, readwrite) id delegate; @property (nonatomic, strong, readwrite) UIImageView *cardImageView; @@ -53,7 +53,7 @@ - (instancetype)initWithConfiguration:(STPPaymentConfiguration *)configuration theme:(STPTheme *)theme prefilledInformation:(nullable STPUserInformation *)prefilledInformation shippingAddress:(nullable STPAddress *)shippingAddress - paymentMethodTuple:(STPPaymentOptionTuple *)tuple + paymentOptionTuple:(STPPaymentOptionTuple *)tuple delegate:(id)delegate { self = [super initWithTheme:theme]; if (self) { @@ -62,8 +62,8 @@ - (instancetype)initWithConfiguration:(STPPaymentConfiguration *)configuration _apiAdapter = customerContext; _prefilledInformation = prefilledInformation; _shippingAddress = shippingAddress; - _paymentMethods = tuple.paymentOptions; - _selectedPaymentMethod = tuple.selectedPaymentOption; + _paymentOptions = tuple.paymentOptions; + _selectedPaymentOption = tuple.selectedPaymentOption; _delegate = delegate; _createsCardSources = NO; @@ -76,7 +76,7 @@ - (void)createAndSetupViews { [super createAndSetupViews]; // Table view - [self.tableView registerClass:[STPPaymentOptionTableViewCell class] forCellReuseIdentifier:PaymentMethodCellReuseIdentifier]; + [self.tableView registerClass:[STPPaymentOptionTableViewCell class] forCellReuseIdentifier:PaymentOptionCellReuseIdentifier]; self.tableView.dataSource = self; self.tableView.delegate = self; @@ -111,7 +111,7 @@ - (void)reloadRightBarButtonItemWithTableViewIsEditing:(BOOL)tableViewIsEditing UIBarButtonItem *barButtonItem; if (!tableViewIsEditing) { - if ([self isAnyPaymentMethodDetachable]) { + if ([self isAnyPaymentOptionDetachable]) { // Show edit button barButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:@selector(handleEditButtonTapped:)]; } @@ -128,9 +128,9 @@ - (void)reloadRightBarButtonItemWithTableViewIsEditing:(BOOL)tableViewIsEditing [self.stp_navigationItemProxy setRightBarButtonItem:barButtonItem animated:animated]; } -- (BOOL)isAnyPaymentMethodDetachable { - for (id paymentMethod in self.paymentMethods) { - if ([self isPaymentMethodDetachable:paymentMethod]) { +- (BOOL)isAnyPaymentOptionDetachable { + for (id paymentOption in self.paymentOptions) { + if ([self isPaymentOptionDetachable:paymentOption]) { return YES; } } @@ -138,8 +138,8 @@ - (BOOL)isAnyPaymentMethodDetachable { return NO; } -- (BOOL)isPaymentMethodDetachable:(id)paymentMethod { - if (!self.configuration.canDeletePaymentMethods) { +- (BOOL)isPaymentOptionDetachable:(id)paymentOption { + if (!self.configuration.canDeletePaymentOptions) { // Feature is disabled return NO; } @@ -155,17 +155,17 @@ - (BOOL)isPaymentMethodDetachable:(id)paymentMethod { return NO; } - if (!paymentMethod) { + if (!paymentOption) { // Cannot detach non-existent payment method return NO; } - if (paymentMethod == self.selectedPaymentMethod) { + if (paymentOption == self.selectedPaymentOption) { // Cannot detach selected payment method return NO; } - if (![paymentMethod conformsToProtocol:@protocol(STPSourceProtocol)]) { + if (![paymentOption conformsToProtocol:@protocol(STPSourceProtocol)]) { // Cannot detach non-source payment method return NO; } @@ -174,17 +174,17 @@ - (BOOL)isPaymentMethodDetachable:(id)paymentMethod { return YES; } -- (void)updateWithPaymentMethodTuple:(STPPaymentOptionTuple *)tuple { - if ([self.paymentMethods isEqualToArray:tuple.paymentOptions] && - [self.selectedPaymentMethod isEqual:tuple.selectedPaymentOption]) { +- (void)updateWithPaymentOptionTuple:(STPPaymentOptionTuple *)tuple { + if ([self.paymentOptions isEqualToArray:tuple.paymentOptions] && + [self.selectedPaymentOption isEqual:tuple.selectedPaymentOption]) { return; } - self.paymentMethods = tuple.paymentOptions; - self.selectedPaymentMethod = tuple.selectedPaymentOption; + self.paymentOptions = tuple.paymentOptions; + self.selectedPaymentOption = tuple.selectedPaymentOption; // Reload card list section - NSMutableIndexSet *sections = [NSMutableIndexSet indexSetWithIndex:PaymentMethodSectionCardList]; + NSMutableIndexSet *sections = [NSMutableIndexSet indexSetWithIndex:PaymentOptionSectionCardList]; [self.tableView reloadSections:sections withRowAnimation:UITableViewRowAnimationAutomatic]; } @@ -221,11 +221,11 @@ - (NSInteger)numberOfSectionsInTableView:(__unused UITableView *)tableView { } - (NSInteger)tableView:(__unused UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - if (section == PaymentMethodSectionCardList) { - return self.paymentMethods.count; + if (section == PaymentOptionSectionCardList) { + return self.paymentOptions.count; } - if (section == PaymentMethodSectionAddCard) { + if (section == PaymentOptionSectionAddCard) { return 1; } @@ -233,13 +233,13 @@ - (NSInteger)tableView:(__unused UITableView *)tableView numberOfRowsInSection:( } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - STPPaymentOptionTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:PaymentMethodCellReuseIdentifier forIndexPath:indexPath]; + STPPaymentOptionTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:PaymentOptionCellReuseIdentifier forIndexPath:indexPath]; - if (indexPath.section == PaymentMethodSectionCardList) { - id paymentMethod = [self.paymentMethods stp_boundSafeObjectAtIndex:indexPath.row]; - BOOL selected = [paymentMethod isEqual:self.selectedPaymentMethod]; + if (indexPath.section == PaymentOptionSectionCardList) { + id paymentOption = [self.paymentOptions stp_boundSafeObjectAtIndex:indexPath.row]; + BOOL selected = [paymentOption isEqual:self.selectedPaymentOption]; - [cell configureWithPaymentOption:paymentMethod theme:self.theme selected:selected]; + [cell configureWithPaymentOption:paymentOption theme:self.theme selected:selected]; } else { [cell configureForNewCardRowWithTheme:self.theme]; @@ -249,10 +249,10 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N } - (BOOL)tableView:(__unused UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { - if (indexPath.section == PaymentMethodSectionCardList) { - id paymentMethod = [self.paymentMethods stp_boundSafeObjectAtIndex:indexPath.row]; + if (indexPath.section == PaymentOptionSectionCardList) { + id paymentOption = [self.paymentOptions stp_boundSafeObjectAtIndex:indexPath.row]; - if ([self isPaymentMethodDetachable:paymentMethod]) { + if ([self isPaymentOptionDetachable:paymentOption]) { return YES; } } @@ -261,42 +261,42 @@ - (BOOL)tableView:(__unused UITableView *)tableView canEditRowAtIndexPath:(NSInd } - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { - if (indexPath.section == PaymentMethodSectionCardList) { + if (indexPath.section == PaymentOptionSectionCardList) { if (editingStyle != UITableViewCellEditingStyleDelete) { // Showed the user a non-delete option when we shouldn't have [tableView reloadData]; return; } - if (!(indexPath.row < (NSInteger)self.paymentMethods.count)) { + if (!(indexPath.row < (NSInteger)self.paymentOptions.count)) { // Data source and table view out of sync for some reason [tableView reloadData]; return; } - id paymentMethodToDelete = [self.paymentMethods stp_boundSafeObjectAtIndex:indexPath.row]; + id paymentOptionToDelete = [self.paymentOptions stp_boundSafeObjectAtIndex:indexPath.row]; - if (![self isPaymentMethodDetachable:paymentMethodToDelete]) { + if (![self isPaymentOptionDetachable:paymentOptionToDelete]) { // Showed the user a delete option for a payment method when we shouldn't have [tableView reloadData]; return; } - if (![paymentMethodToDelete conformsToProtocol:@protocol(STPSourceProtocol)]) { + if (![paymentOptionToDelete conformsToProtocol:@protocol(STPSourceProtocol)]) { // Showed the user a delete option for a payment method when we shouldn't have [tableView reloadData]; return; } - id source = (id)paymentMethodToDelete; + id source = (id)paymentOptionToDelete; // Kickoff request to delete source from customer [self.apiAdapter detachSourceFromCustomer:source completion:nil]; // Optimistically remove payment method from data source - NSMutableArray *paymentMethods = [self.paymentMethods mutableCopy]; - [paymentMethods removeObjectAtIndex:indexPath.row]; - self.paymentMethods = paymentMethods; + NSMutableArray *paymentOptions = [self.paymentOptions mutableCopy]; + [paymentOptions removeObjectAtIndex:indexPath.row]; + self.paymentOptions = paymentOptions; // Perform deletion animation for single row [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic]; @@ -305,25 +305,25 @@ - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEd [self reloadRightBarButtonItemWithTableViewIsEditing:tableView.isEditing animated:YES]; // Notify delegate - [self.delegate internalViewControllerDidDeletePaymentMethod:paymentMethodToDelete]; + [self.delegate internalViewControllerDidDeletePaymentOption:paymentOptionToDelete]; } } #pragma mark - UITableViewDelegate - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - if (indexPath.section == PaymentMethodSectionCardList) { + if (indexPath.section == PaymentOptionSectionCardList) { // Update data source - id paymentMethod = [self.paymentMethods stp_boundSafeObjectAtIndex:indexPath.row]; - self.selectedPaymentMethod = paymentMethod; + id paymentOption = [self.paymentOptions stp_boundSafeObjectAtIndex:indexPath.row]; + self.selectedPaymentOption = paymentOption; // Perform selection animation - [tableView reloadSections:[NSIndexSet indexSetWithIndex:PaymentMethodSectionCardList] withRowAnimation:UITableViewRowAnimationFade]; + [tableView reloadSections:[NSIndexSet indexSetWithIndex:PaymentOptionSectionCardList] withRowAnimation:UITableViewRowAnimationFade]; // Notify delegate - [self.delegate internalViewControllerDidSelectPaymentMethod:paymentMethod]; + [self.delegate internalViewControllerDidSelectPaymentOption:paymentOption]; } - else if (indexPath.section == PaymentMethodSectionAddCard) { + else if (indexPath.section == PaymentOptionSectionAddCard) { STPAddCardViewController *paymentCardViewController = [[STPAddCardViewController alloc] initWithConfiguration:self.configuration theme:self.theme]; paymentCardViewController.delegate = self; paymentCardViewController.prefilledInformation = self.prefilledInformation; @@ -359,7 +359,7 @@ - (CGFloat)tableView:(__unused UITableView *)tableView heightForHeaderInSection: } - (UITableViewCellEditingStyle)tableView:(__unused UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath { - if (indexPath.section == PaymentMethodSectionCardList) { + if (indexPath.section == PaymentOptionSectionCardList) { return UITableViewCellEditingStyleDelete; } diff --git a/Stripe/STPPaymentOptionsViewController.m b/Stripe/STPPaymentOptionsViewController.m index a886fc06d7f..e5b0c113502 100644 --- a/Stripe/STPPaymentOptionsViewController.m +++ b/Stripe/STPPaymentOptionsViewController.m @@ -116,11 +116,11 @@ - (void)createAndSetupViews { theme:self.theme prefilledInformation:self.prefilledInformation shippingAddress:self.shippingAddress - paymentMethodTuple:tuple + paymentOptionTuple:tuple delegate:self]; payMethodsInternal.createsCardSources = self.configuration.createCardSources; - if (self.paymentMethodsViewControllerFooterView) { - payMethodsInternal.customFooterView = self.paymentMethodsViewControllerFooterView; + if (self.paymentOptionsViewControllerFooterView) { + payMethodsInternal.customFooterView = self.paymentOptionsViewControllerFooterView; } internal = payMethodsInternal; } @@ -170,16 +170,16 @@ - (void)updateAppearance { self.activityIndicator.tintColor = self.theme.accentColor; } -- (void)finishWithPaymentMethod:(id)paymentMethod { - BOOL methodIsCardToken = [paymentMethod isKindOfClass:[STPCard class]]; - BOOL methodIsCardSource = ([paymentMethod isKindOfClass:[STPSource class]] && - ((STPSource *)paymentMethod).type == STPSourceTypeCard); +- (void)finishWithPaymentOption:(id)paymentOption { + BOOL methodIsCardToken = [paymentOption isKindOfClass:[STPCard class]]; + BOOL methodIsCardSource = ([paymentOption isKindOfClass:[STPSource class]] && + ((STPSource *)paymentOption).type == STPSourceTypeCard); id source; if (methodIsCardToken) { - source = (STPCard *)paymentMethod; + source = (STPCard *)paymentOption; } else if (methodIsCardSource) { - source = (STPSource *)paymentMethod; + source = (STPSource *)paymentOption; } if (source) { // Make this payment method the default source @@ -189,28 +189,28 @@ - (void)finishWithPaymentMethod:(id)paymentMethod { [promise onSuccess:^(STPPaymentOptionTuple *tuple) { stpDispatchToMainThreadIfNecessary(^{ if ([self.internalViewController isKindOfClass:[STPPaymentOptionsInternalViewController class]]) { - STPPaymentOptionsInternalViewController *paymentMethodsVC = (STPPaymentOptionsInternalViewController *)self.internalViewController; - [paymentMethodsVC updateWithPaymentMethodTuple:tuple]; + STPPaymentOptionsInternalViewController *paymentOptionsVC = (STPPaymentOptionsInternalViewController *)self.internalViewController; + [paymentOptionsVC updateWithPaymentOptionTuple:tuple]; } }); }]; }]; } - if ([self.delegate respondsToSelector:@selector(paymentMethodsViewController:didSelectPaymentMethod:)]) { - [self.delegate paymentMethodsViewController:self didSelectPaymentMethod:paymentMethod]; + if ([self.delegate respondsToSelector:@selector(paymentOptionsViewController:didSelectPaymentOption:)]) { + [self.delegate paymentOptionsViewController:self didSelectPaymentOption:paymentOption]; } - [self.delegate paymentMethodsViewControllerDidFinish:self]; + [self.delegate paymentOptionsViewControllerDidFinish:self]; } -- (void)internalViewControllerDidSelectPaymentMethod:(id)paymentMethod { - [self finishWithPaymentMethod:paymentMethod]; +- (void)internalViewControllerDidSelectPaymentOption:(id)paymentOption { + [self finishWithPaymentOption:paymentOption]; } -- (void)internalViewControllerDidDeletePaymentMethod:(id)paymentMethod { +- (void)internalViewControllerDidDeletePaymentOption:(id)paymentOption { if ([self.delegate isKindOfClass:[STPPaymentContext class]]) { // Notify payment context to update its copy of payment methods STPPaymentContext *paymentContext = (STPPaymentContext *)self.delegate; - [paymentContext removePaymentMethod:paymentMethod]; + [paymentContext removePaymentOption:paymentOption]; } } @@ -231,12 +231,12 @@ - (void)internalViewControllerDidCreateSource:(id)source comp customer (the card is). */ if ([source isKindOfClass:[STPToken class]]) { - [self finishWithPaymentMethod:((STPToken *)source).card]; + [self finishWithPaymentOption:((STPToken *)source).card]; } // created a card source else if ([source isKindOfClass:[STPSource class]] && ((STPSource *)source).type == STPSourceTypeCard) { - [self finishWithPaymentMethod:(id)source]; + [self finishWithPaymentOption:(id)source]; } } }); @@ -244,13 +244,13 @@ - (void)internalViewControllerDidCreateSource:(id)source comp } - (void)internalViewControllerDidCancel { - [self.delegate paymentMethodsViewControllerDidCancel:self]; + [self.delegate paymentOptionsViewControllerDidCancel:self]; } - (void)addCardViewControllerDidCancel:(__unused STPAddCardViewController *)addCardViewController { // Add card is only our direct delegate if there are no other payment methods possible // and we skipped directly to this screen. In this case, a cancel from it is the same as a cancel to us. - [self.delegate paymentMethodsViewControllerDidCancel:self]; + [self.delegate paymentOptionsViewControllerDidCancel:self]; } - (void)addCardViewController:(__unused STPAddCardViewController *)addCardViewController @@ -312,9 +312,9 @@ - (instancetype)initWithConfiguration:(STPPaymentConfiguration *)configuration } if (tuple.selectedPaymentOption) { - if ([self.delegate respondsToSelector:@selector(paymentMethodsViewController:didSelectPaymentMethod:)]) { - [self.delegate paymentMethodsViewController:self - didSelectPaymentMethod:tuple.selectedPaymentOption]; + if ([self.delegate respondsToSelector:@selector(paymentOptionsViewController:didSelectPaymentOption:)]) { + [self.delegate paymentOptionsViewController:self + didSelectPaymentOption:tuple.selectedPaymentOption]; } } }] onFailure:^(NSError *error) { @@ -323,7 +323,7 @@ - (instancetype)initWithConfiguration:(STPPaymentConfiguration *)configuration return; } - [self.delegate paymentMethodsViewController:self didFailToLoadWithError:error]; + [self.delegate paymentOptionsViewController:self didFailToLoadWithError:error]; }]; } return self; diff --git a/Stripe/STPShippingAddressViewController.m b/Stripe/STPShippingAddressViewController.m index 83dda433c24..617aef10599 100644 --- a/Stripe/STPShippingAddressViewController.m +++ b/Stripe/STPShippingAddressViewController.m @@ -49,9 +49,9 @@ - (instancetype)init { - (instancetype)initWithPaymentContext:(STPPaymentContext *)paymentContext { STPAddress *billingAddress = nil; - id paymentMethod = paymentContext.selectedPaymentMethod; - if ([paymentMethod isKindOfClass:[STPCard class]]) { - STPCard *card = (STPCard *)paymentMethod; + id paymentOption = paymentContext.selectedPaymentOption; + if ([paymentOption isKindOfClass:[STPCard class]]) { + STPCard *card = (STPCard *)paymentOption; billingAddress = [card address]; } STPUserInformation *prefilledInformation; diff --git a/Tests/Tests/STPAddCardViewControllerLocalizationTests.m b/Tests/Tests/STPAddCardViewControllerLocalizationTests.m index e5aef79aad3..111c2c14643 100644 --- a/Tests/Tests/STPAddCardViewControllerLocalizationTests.m +++ b/Tests/Tests/STPAddCardViewControllerLocalizationTests.m @@ -44,7 +44,7 @@ - (void)performSnapshotTestForLanguage:(NSString *)language delivery:(BOOL)deliv STPPaymentConfiguration *config = [STPFixtures paymentConfiguration]; config.companyName = @"Test Company"; config.requiredBillingAddressFields = STPBillingAddressFieldsFull; - config.additionalPaymentMethods = STPPaymentOptionTypeAll; + config.additionalPaymentOptions = STPPaymentOptionTypeAll; config.shippingType = (delivery) ? STPShippingTypeDelivery : STPShippingTypeShipping; [STPLocalizationUtils overrideLanguageTo:language]; diff --git a/Tests/Tests/STPCustomerSourceTupleTest.m b/Tests/Tests/STPCustomerSourceTupleTest.m index b99b3214d23..10af4dcd19c 100644 --- a/Tests/Tests/STPCustomerSourceTupleTest.m +++ b/Tests/Tests/STPCustomerSourceTupleTest.m @@ -24,7 +24,7 @@ @implementation STPCustomerSourceTupleTest behavior with variable input data. If a customer has valid sources for UI, they should all be in the tuple's - payment methods. If apple pay is enabled, it should also be included in the + payment options. If apple pay is enabled, it should also be included in the method count. @param sut The customer to test @@ -38,7 +38,7 @@ - (void)performSourceTupleTestWithCustomer:(STPCustomer *)sut expectedValidSources:(NSUInteger)expectedSourceCount expectedSelectedSource:(id)expectedSelectedSource { STPPaymentConfiguration *config = [STPMocks paymentConfigurationWithApplePaySupportingDevice]; - config.additionalPaymentMethods = applePayEnabled ? STPPaymentOptionTypeAll : STPPaymentOptionTypeNone; + config.additionalPaymentOptions = applePayEnabled ? STPPaymentOptionTypeAll : STPPaymentOptionTypeNone; STPPaymentOptionTuple *tuple = [sut filteredSourceTupleForUIWithConfiguration:config]; XCTAssertNotNil(tuple); diff --git a/Tests/Tests/STPMocks.h b/Tests/Tests/STPMocks.h index 0119936359e..31e038a4a86 100644 --- a/Tests/Tests/STPMocks.h +++ b/Tests/Tests/STPMocks.h @@ -32,7 +32,7 @@ A PaymentConfiguration object with a fake publishable key and a fake apple merchant identifier that ignores the true value of [Stripe deviceSupportsApplePay] and bases its `applePayEnabled` value solely on what is set - in `additionalPaymentMethods` + in `additionalPaymentOptions` */ + (STPPaymentConfiguration *)paymentConfigurationWithApplePaySupportingDevice; diff --git a/Tests/Tests/STPMocks.m b/Tests/Tests/STPMocks.m index 8af4cbc3c9d..f98881407eb 100644 --- a/Tests/Tests/STPMocks.m +++ b/Tests/Tests/STPMocks.m @@ -68,7 +68,7 @@ + (STPPaymentConfiguration *)paymentConfigurationWithApplePaySupportingDevice { @implementation STPPaymentConfiguration (STPMocks) - (BOOL)stpmock_applePayEnabled { - return (self.additionalPaymentMethods & STPPaymentOptionTypeApplePay); + return (self.additionalPaymentOptions & STPPaymentOptionTypeApplePay); } @end diff --git a/Tests/Tests/STPPaymentConfigurationTest.m b/Tests/Tests/STPPaymentConfigurationTest.m index 0bf3fbae634..d1dddab4e5e 100644 --- a/Tests/Tests/STPPaymentConfigurationTest.m +++ b/Tests/Tests/STPPaymentConfigurationTest.m @@ -32,14 +32,14 @@ - (void)testInit { STPPaymentConfiguration *paymentConfiguration = [[STPPaymentConfiguration alloc] init]; XCTAssertNil(paymentConfiguration.publishableKey); - XCTAssertEqual(paymentConfiguration.additionalPaymentMethods, STPPaymentOptionTypeAll); + XCTAssertEqual(paymentConfiguration.additionalPaymentOptions, STPPaymentOptionTypeAll); XCTAssertEqual(paymentConfiguration.requiredBillingAddressFields, STPBillingAddressFieldsNone); XCTAssertNil(paymentConfiguration.requiredShippingAddressFields); XCTAssert(paymentConfiguration.verifyPrefilledShippingAddress); XCTAssertEqual(paymentConfiguration.shippingType, STPShippingTypeShipping); XCTAssertEqualObjects(paymentConfiguration.companyName, @"applicationName"); XCTAssertNil(paymentConfiguration.appleMerchantIdentifier); - XCTAssert(paymentConfiguration.canDeletePaymentMethods); + XCTAssert(paymentConfiguration.canDeletePaymentOptions); } - (void)testApplePayEnabledSatisfied { @@ -48,7 +48,7 @@ - (void)testApplePayEnabledSatisfied { STPPaymentConfiguration *paymentConfiguration = [[STPPaymentConfiguration alloc] init]; paymentConfiguration.appleMerchantIdentifier = @"appleMerchantIdentifier"; - paymentConfiguration.additionalPaymentMethods = STPPaymentOptionTypeAll; + paymentConfiguration.additionalPaymentOptions = STPPaymentOptionTypeAll; XCTAssert([paymentConfiguration applePayEnabled]); } @@ -59,18 +59,18 @@ - (void)testApplePayEnabledMissingAppleMerchantIdentifier { STPPaymentConfiguration *paymentConfiguration = [[STPPaymentConfiguration alloc] init]; paymentConfiguration.appleMerchantIdentifier = nil; - paymentConfiguration.additionalPaymentMethods = STPPaymentOptionTypeAll; + paymentConfiguration.additionalPaymentOptions = STPPaymentOptionTypeAll; XCTAssertFalse([paymentConfiguration applePayEnabled]); } -- (void)testApplePayEnabledDisallowAdditionalPaymentMethods { +- (void)testApplePayEnabledDisallowAdditionalPaymentOptions { id stripeMock = OCMClassMock([Stripe class]); OCMStub([stripeMock deviceSupportsApplePay]).andReturn(YES); STPPaymentConfiguration *paymentConfiguration = [[STPPaymentConfiguration alloc] init]; paymentConfiguration.appleMerchantIdentifier = @"appleMerchantIdentifier"; - paymentConfiguration.additionalPaymentMethods = STPPaymentOptionTypeNone; + paymentConfiguration.additionalPaymentOptions = STPPaymentOptionTypeNone; XCTAssertFalse([paymentConfiguration applePayEnabled]); } @@ -81,7 +81,7 @@ - (void)testApplePayEnabledMisisngDeviceSupport { STPPaymentConfiguration *paymentConfiguration = [[STPPaymentConfiguration alloc] init]; paymentConfiguration.appleMerchantIdentifier = @"appleMerchantIdentifier"; - paymentConfiguration.additionalPaymentMethods = STPPaymentOptionTypeAll; + paymentConfiguration.additionalPaymentOptions = STPPaymentOptionTypeAll; XCTAssertFalse([paymentConfiguration applePayEnabled]); } @@ -103,27 +103,27 @@ - (void)testCopyWithZone { STPPaymentConfiguration *paymentConfigurationA = [[STPPaymentConfiguration alloc] init]; paymentConfigurationA.publishableKey = @"publishableKey"; - paymentConfigurationA.additionalPaymentMethods = STPPaymentOptionTypeApplePay; + paymentConfigurationA.additionalPaymentOptions = STPPaymentOptionTypeApplePay; paymentConfigurationA.requiredBillingAddressFields = STPBillingAddressFieldsFull; paymentConfigurationA.requiredShippingAddressFields = allFields; paymentConfigurationA.verifyPrefilledShippingAddress = NO; paymentConfigurationA.shippingType = STPShippingTypeDelivery; paymentConfigurationA.companyName = @"companyName"; paymentConfigurationA.appleMerchantIdentifier = @"appleMerchantIdentifier"; - paymentConfigurationA.canDeletePaymentMethods = NO; + paymentConfigurationA.canDeletePaymentOptions = NO; STPPaymentConfiguration *paymentConfigurationB = [paymentConfigurationA copy]; XCTAssertNotEqual(paymentConfigurationA, paymentConfigurationB); XCTAssertEqualObjects(paymentConfigurationB.publishableKey, @"publishableKey"); - XCTAssertEqual(paymentConfigurationB.additionalPaymentMethods, STPPaymentOptionTypeApplePay); + XCTAssertEqual(paymentConfigurationB.additionalPaymentOptions, STPPaymentOptionTypeApplePay); XCTAssertEqual(paymentConfigurationB.requiredBillingAddressFields, STPBillingAddressFieldsFull); XCTAssertEqualObjects(paymentConfigurationB.requiredShippingAddressFields, allFields); XCTAssertFalse(paymentConfigurationB.verifyPrefilledShippingAddress); XCTAssertEqual(paymentConfigurationB.shippingType, STPShippingTypeDelivery); XCTAssertEqualObjects(paymentConfigurationB.companyName, @"companyName"); XCTAssertEqualObjects(paymentConfigurationB.appleMerchantIdentifier, @"appleMerchantIdentifier"); - XCTAssertEqual(paymentConfigurationA.canDeletePaymentMethods, paymentConfigurationB.canDeletePaymentMethods); + XCTAssertEqual(paymentConfigurationA.canDeletePaymentOptions, paymentConfigurationB.canDeletePaymentOptions); } @end diff --git a/Tests/Tests/STPPaymentContextSnapshotTests.m b/Tests/Tests/STPPaymentContextSnapshotTests.m index dad400d96ab..e85f48abf6a 100644 --- a/Tests/Tests/STPPaymentContextSnapshotTests.m +++ b/Tests/Tests/STPPaymentContextSnapshotTests.m @@ -30,7 +30,7 @@ - (void)setUp { STPPaymentConfiguration *config = [STPFixtures paymentConfiguration]; config.companyName = @"Test Company"; config.requiredBillingAddressFields = STPBillingAddressFieldsFull; - config.additionalPaymentMethods = STPPaymentOptionTypeAll; + config.additionalPaymentOptions = STPPaymentOptionTypeAll; config.shippingType = STPShippingTypeShipping; self.config = config; STPCustomerContext *customerContext = [STPMocks staticCustomerContextWithCustomer:[STPFixtures customerWithCardTokenAndSourceSources]]; @@ -54,7 +54,7 @@ - (void)testPushPaymentMethodsSmallTitle { self.hostViewController.navigationBar.prefersLargeTitles = NO; self.paymentContext.largeTitleDisplayMode = UINavigationItemLargeTitleDisplayModeAutomatic; - [self.paymentContext pushPaymentMethodsViewController]; + [self.paymentContext pushPaymentOptionsViewController]; UIView *view = [self stp_preparedAndSizedViewForSnapshotTestFromNavigationController:self.hostViewController]; FBSnapshotVerifyView(view, nil); } @@ -66,7 +66,7 @@ - (void)testPushPaymentMethodsLargeTitle { self.hostViewController.navigationBar.prefersLargeTitles = YES; self.paymentContext.largeTitleDisplayMode = UINavigationItemLargeTitleDisplayModeAutomatic; - [self.paymentContext pushPaymentMethodsViewController]; + [self.paymentContext pushPaymentOptionsViewController]; UIView *view = [self stp_preparedAndSizedViewForSnapshotTestFromNavigationController:self.hostViewController]; FBSnapshotVerifyView(view, nil); } diff --git a/Tests/Tests/STPPaymentMethodsViewControllerLocalizationTests.m b/Tests/Tests/STPPaymentOptionsViewControllerLocalizationTests.m similarity index 93% rename from Tests/Tests/STPPaymentMethodsViewControllerLocalizationTests.m rename to Tests/Tests/STPPaymentOptionsViewControllerLocalizationTests.m index 1d3193f8aff..03413a30984 100644 --- a/Tests/Tests/STPPaymentMethodsViewControllerLocalizationTests.m +++ b/Tests/Tests/STPPaymentOptionsViewControllerLocalizationTests.m @@ -29,18 +29,18 @@ - (void)performSnapshotTestForLanguage:(NSString *)language { STPPaymentConfiguration *config = [STPFixtures paymentConfiguration]; config.companyName = @"Test Company"; config.requiredBillingAddressFields = STPBillingAddressFieldsFull; - config.additionalPaymentMethods = STPPaymentOptionTypeAll; + config.additionalPaymentOptions = STPPaymentOptionTypeAll; STPTheme *theme = [STPTheme defaultTheme]; id customerContext = [STPMocks staticCustomerContextWithCustomer:[STPFixtures customerWithCardTokenAndSourceSources]]; id delegate = OCMProtocolMock(@protocol(STPPaymentOptionsViewControllerDelegate)); [STPLocalizationUtils overrideLanguageTo:language]; - STPPaymentOptionsViewController *paymentMethodsVC = [[STPPaymentOptionsViewController alloc] initWithConfiguration:config + STPPaymentOptionsViewController *paymentOptionsVC = [[STPPaymentOptionsViewController alloc] initWithConfiguration:config theme:theme customerContext:customerContext delegate:delegate]; - UIView *viewToTest = [self stp_preparedAndSizedViewForSnapshotTestFromViewController:paymentMethodsVC]; + UIView *viewToTest = [self stp_preparedAndSizedViewForSnapshotTestFromViewController:paymentOptionsVC]; FBSnapshotVerifyView(viewToTest, nil); [STPLocalizationUtils overrideLanguageTo:nil]; diff --git a/Tests/Tests/STPPaymentMethodsViewControllerTest.m b/Tests/Tests/STPPaymentOptionsViewControllerTest.m similarity index 93% rename from Tests/Tests/STPPaymentMethodsViewControllerTest.m rename to Tests/Tests/STPPaymentOptionsViewControllerTest.m index 4d2891e35a6..2b47b786542 100644 --- a/Tests/Tests/STPPaymentMethodsViewControllerTest.m +++ b/Tests/Tests/STPPaymentOptionsViewControllerTest.m @@ -43,7 +43,7 @@ - (STPPaymentOptionsViewController *)buildViewControllerWithCustomer:(STPCustome - (void)testInitWithNoSourcesAndConfigWithUseSourcesOffAndCardAvailable { STPCustomer *customer = [STPFixtures customerWithNoSources]; STPPaymentConfiguration *config = [STPFixtures paymentConfiguration]; - config.additionalPaymentMethods = STPPaymentOptionTypeNone; + config.additionalPaymentOptions = STPPaymentOptionTypeNone; iddelegate = OCMProtocolMock(@protocol(STPPaymentOptionsViewControllerDelegate)); STPPaymentOptionsViewController *sut = [self buildViewControllerWithCustomer:customer configuration:config @@ -58,7 +58,7 @@ - (void)testInitWithNoSourcesAndConfigWithUseSourcesOffAndCardAvailable { - (void)testInitWithSingleCardTokenSourceAndCardAvailable { STPCustomer *customer = [STPFixtures customerWithSingleCardTokenSource]; STPPaymentConfiguration *config = [STPFixtures paymentConfiguration]; - config.additionalPaymentMethods = STPPaymentOptionTypeAll; + config.additionalPaymentOptions = STPPaymentOptionTypeAll; iddelegate = OCMProtocolMock(@protocol(STPPaymentOptionsViewControllerDelegate)); STPPaymentOptionsViewController *sut = [self buildViewControllerWithCustomer:customer configuration:config @@ -73,7 +73,7 @@ - (void)testInitWithSingleCardTokenSourceAndCardAvailable { - (void)testInitWithSingleCardSourceSourceAndCardAvailable { STPCustomer *customer = [STPFixtures customerWithSingleCardSourceSource]; STPPaymentConfiguration *config = [STPFixtures paymentConfiguration]; - config.additionalPaymentMethods = STPPaymentOptionTypeNone; + config.additionalPaymentOptions = STPPaymentOptionTypeNone; iddelegate = OCMProtocolMock(@protocol(STPPaymentOptionsViewControllerDelegate)); STPPaymentOptionsViewController *sut = [self buildViewControllerWithCustomer:customer configuration:config @@ -99,11 +99,11 @@ - (void)testAddCardCancelForwardsToDelegate { UIBarButtonItem *cancelButton = sut.internalViewController.navigationItem.leftBarButtonItem; [cancelButton.target performSelector:cancelButton.action withObject:cancelButton]; - OCMVerify([delegate paymentMethodsViewControllerDidCancel:[OCMArg any]]); + OCMVerify([delegate paymentOptionsViewControllerDidCancel:[OCMArg any]]); } /** - Tapping cancel in an internal PaymentMethodsInternal view controller should + Tapping cancel in an internal PaymentOptionsInternal view controller should result in a call to didCancel: */ - (void)testInternalCancelForwardsToDelegate { @@ -117,7 +117,7 @@ - (void)testInternalCancelForwardsToDelegate { UIBarButtonItem *cancelButton = sut.internalViewController.navigationItem.leftBarButtonItem; [cancelButton.target performSelector:cancelButton.action withObject:cancelButton]; - OCMVerify([delegate paymentMethodsViewControllerDidCancel:[OCMArg any]]); + OCMVerify([delegate paymentOptionsViewControllerDidCancel:[OCMArg any]]); } /** @@ -162,8 +162,8 @@ - (void)testAddCardAttachesToCustomerAndFinishes { }; OCMVerify([mockCustomerContext attachSourceToCustomer:[OCMArg checkWithBlock:tokenChecker] completion:[OCMArg any]]); OCMVerify([mockCustomerContext selectDefaultCustomerSource:[OCMArg checkWithBlock:cardChecker] completion:[OCMArg any]]); - OCMVerify([delegate paymentMethodsViewController:[OCMArg any] didSelectPaymentMethod:[OCMArg checkWithBlock:cardChecker]]); - OCMVerify([delegate paymentMethodsViewControllerDidFinish:[OCMArg any]]); + OCMVerify([delegate paymentOptionsViewController:[OCMArg any] didSelectPaymentOption:[OCMArg checkWithBlock:cardChecker]]); + OCMVerify([delegate paymentOptionsViewControllerDidFinish:[OCMArg any]]); [self waitForExpectationsWithTimeout:2 handler:nil]; } @@ -204,15 +204,15 @@ - (void)testCreatesCardSources { STPSource *source = (STPSource *)obj; return source.stripeID == expectedSource.stripeID; }; - BOOL (^paymentMethodChecker)(id) = ^BOOL(id obj) { + BOOL (^paymentOptionChecker)(id) = ^BOOL(id obj) { STPSource *source = (STPSource *)obj; return source.cardDetails.last4 == expectedSource.cardDetails.last4; }; OCMVerify([mockCustomerContext attachSourceToCustomer:[OCMArg checkWithBlock:sourceChecker] completion:[OCMArg any]]); OCMVerify([mockCustomerContext selectDefaultCustomerSource:[OCMArg checkWithBlock:sourceChecker] completion:[OCMArg any]]); - OCMVerify([delegate paymentMethodsViewController:[OCMArg any] didSelectPaymentMethod:[OCMArg checkWithBlock:paymentMethodChecker]]); - OCMVerify([delegate paymentMethodsViewControllerDidFinish:[OCMArg any]]); + OCMVerify([delegate paymentOptionsViewController:[OCMArg any] didSelectPaymentOption:[OCMArg checkWithBlock:paymentOptionChecker]]); + OCMVerify([delegate paymentOptionsViewControllerDidFinish:[OCMArg any]]); [self waitForExpectationsWithTimeout:2 handler:nil]; } diff --git a/Tests/Tests/STPSourceTest.m b/Tests/Tests/STPSourceTest.m index d5f455251dd..b9fc25e0929 100644 --- a/Tests/Tests/STPSourceTest.m +++ b/Tests/Tests/STPSourceTest.m @@ -471,7 +471,7 @@ - (NSArray *)possibleAPIResponses { [STPTestUtils jsonNamed:STPTestJSONSourceSOFORT]]; } -- (void)testPaymentMethodImage { +- (void)testPaymentOptionImage { for (NSDictionary *response in [self possibleAPIResponses]) { STPSource *source = [STPSource decodedObjectFromAPIResponse:response]; @@ -486,7 +486,7 @@ - (void)testPaymentMethodImage { } } -- (void)testPaymentMethodTemplateImage { +- (void)testPaymentOptionTemplateImage { for (NSDictionary *response in [self possibleAPIResponses]) { STPSource *source = [STPSource decodedObjectFromAPIResponse:response]; @@ -501,7 +501,7 @@ - (void)testPaymentMethodTemplateImage { } } -- (void)testPaymentMethodLabel { +- (void)testPaymentOptionLabel { for (NSDictionary *response in [self possibleAPIResponses]) { STPSource *source = [STPSource decodedObjectFromAPIResponse:response]; diff --git a/Tests/Tests/UINavigationBar+StripeTest.m b/Tests/Tests/UINavigationBar+StripeTest.m index acb80532b09..8fba5b94f3b 100644 --- a/Tests/Tests/UINavigationBar+StripeTest.m +++ b/Tests/Tests/UINavigationBar+StripeTest.m @@ -18,35 +18,35 @@ @interface UINavigationBar_StripeTest : XCTestCase @implementation UINavigationBar_StripeTest -- (STPPaymentOptionsViewController *)buildPaymentMethodsViewController { +- (STPPaymentOptionsViewController *)buildPaymentOptionsViewController { id customerContext = [STPMocks staticCustomerContext]; STPPaymentConfiguration *config = [STPFixtures paymentConfiguration]; config.publishableKey = @"pk_test"; STPTheme *theme = [STPTheme defaultTheme]; id delegate = OCMProtocolMock(@protocol(STPPaymentOptionsViewControllerDelegate)); - STPPaymentOptionsViewController *paymentMethodsVC = [[STPPaymentOptionsViewController alloc] initWithConfiguration:config + STPPaymentOptionsViewController *paymentOptionsVC = [[STPPaymentOptionsViewController alloc] initWithConfiguration:config theme:theme customerContext:customerContext delegate:delegate]; - return paymentMethodsVC; + return paymentOptionsVC; } - (void)testVCUsesNavigationBarColor { - STPPaymentOptionsViewController *paymentMethodsVC = [self buildPaymentMethodsViewController]; + STPPaymentOptionsViewController *paymentOptionsVC = [self buildPaymentOptionsViewController]; STPTheme *navTheme = [STPTheme new]; navTheme.accentColor = [UIColor purpleColor]; - UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:paymentMethodsVC]; + UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:paymentOptionsVC]; navController.navigationBar.stp_theme = navTheme; - __unused UIView *view = paymentMethodsVC.view; - XCTAssertEqualObjects(paymentMethodsVC.navigationItem.leftBarButtonItem.tintColor, [UIColor purpleColor]); + __unused UIView *view = paymentOptionsVC.view; + XCTAssertEqualObjects(paymentOptionsVC.navigationItem.leftBarButtonItem.tintColor, [UIColor purpleColor]); } - (void)testVCDoesNotUseNavigationBarColor { - STPPaymentOptionsViewController *paymentMethodsVC = [self buildPaymentMethodsViewController]; - __unused UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:paymentMethodsVC]; - __unused UIView *view = paymentMethodsVC.view; - XCTAssertEqualObjects(paymentMethodsVC.navigationItem.leftBarButtonItem.tintColor, [STPTheme defaultTheme].accentColor); + STPPaymentOptionsViewController *paymentOptionsVC = [self buildPaymentOptionsViewController]; + __unused UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:paymentOptionsVC]; + __unused UIView *view = paymentOptionsVC.view; + XCTAssertEqualObjects(paymentOptionsVC.navigationItem.leftBarButtonItem.tintColor, [STPTheme defaultTheme].accentColor); } From 6625a33496db7b8cc40f8d8d758b0c06118acb19 Mon Sep 17 00:00:00 2001 From: Yuki Tokuhiro Date: Tue, 5 Mar 2019 12:12:04 -0800 Subject: [PATCH 06/11] Rename references to PaymentMethod -> PaymentOption in STPPaymentContextSnapshotTests --- ....png => testPushPaymentOptionsLargeTitle@2x.png} | Bin ....png => testPushPaymentOptionsSmallTitle@2x.png} | Bin Tests/Tests/STPPaymentContextSnapshotTests.m | 4 ++-- 3 files changed, 2 insertions(+), 2 deletions(-) rename Tests/ReferenceImages_64/STPPaymentContextSnapshotTests/{testPushPaymentMethodsLargeTitle@2x.png => testPushPaymentOptionsLargeTitle@2x.png} (100%) rename Tests/ReferenceImages_64/STPPaymentContextSnapshotTests/{testPushPaymentMethodsSmallTitle@2x.png => testPushPaymentOptionsSmallTitle@2x.png} (100%) diff --git a/Tests/ReferenceImages_64/STPPaymentContextSnapshotTests/testPushPaymentMethodsLargeTitle@2x.png b/Tests/ReferenceImages_64/STPPaymentContextSnapshotTests/testPushPaymentOptionsLargeTitle@2x.png similarity index 100% rename from Tests/ReferenceImages_64/STPPaymentContextSnapshotTests/testPushPaymentMethodsLargeTitle@2x.png rename to Tests/ReferenceImages_64/STPPaymentContextSnapshotTests/testPushPaymentOptionsLargeTitle@2x.png diff --git a/Tests/ReferenceImages_64/STPPaymentContextSnapshotTests/testPushPaymentMethodsSmallTitle@2x.png b/Tests/ReferenceImages_64/STPPaymentContextSnapshotTests/testPushPaymentOptionsSmallTitle@2x.png similarity index 100% rename from Tests/ReferenceImages_64/STPPaymentContextSnapshotTests/testPushPaymentMethodsSmallTitle@2x.png rename to Tests/ReferenceImages_64/STPPaymentContextSnapshotTests/testPushPaymentOptionsSmallTitle@2x.png diff --git a/Tests/Tests/STPPaymentContextSnapshotTests.m b/Tests/Tests/STPPaymentContextSnapshotTests.m index e85f48abf6a..48bb656ee4a 100644 --- a/Tests/Tests/STPPaymentContextSnapshotTests.m +++ b/Tests/Tests/STPPaymentContextSnapshotTests.m @@ -48,7 +48,7 @@ - (void)buildPaymentContext { self.paymentContext = context; } -- (void)testPushPaymentMethodsSmallTitle { +- (void)testPushPaymentOptionsSmallTitle { if (@available(iOS 11.0, *)) { [self buildPaymentContext]; @@ -60,7 +60,7 @@ - (void)testPushPaymentMethodsSmallTitle { } } -- (void)testPushPaymentMethodsLargeTitle { +- (void)testPushPaymentOptionsLargeTitle { if (@available(iOS 11.0, *)) { [self buildPaymentContext]; From 8a6386f535eebe9c51220977cb9a94d77319caab Mon Sep 17 00:00:00 2001 From: Yuki Tokuhiro Date: Tue, 5 Mar 2019 12:13:03 -0800 Subject: [PATCH 07/11] Rename BrowseViewController title from 'Payment Option Picker' to 'Payment Method Picker' --- Example/UI Examples/BrowseViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Example/UI Examples/BrowseViewController.swift b/Example/UI Examples/BrowseViewController.swift index 9d031205dcb..9a05418bbca 100644 --- a/Example/UI Examples/BrowseViewController.swift +++ b/Example/UI Examples/BrowseViewController.swift @@ -23,7 +23,7 @@ class BrowseViewController: UITableViewController, STPAddCardViewControllerDeleg switch self { case .STPPaymentCardTextField: return "Card Field" case .STPAddCardViewController: return "Card Form with Billing Address" - case .STPPaymentOptionsViewController: return "Payment Method Picker" + case .STPPaymentOptionsViewController: return "Payment Option Picker" case .STPShippingInfoViewController: return "Shipping Info Form" case .ChangeTheme: return "Change Theme" } From 129f8d714568c97bcec0d74f0a6ddc753c24c7b4 Mon Sep 17 00:00:00 2001 From: Yuki Tokuhiro Date: Tue, 5 Mar 2019 12:23:31 -0800 Subject: [PATCH 08/11] Update version to v15.0.0, update CHANGELOG, README --- CHANGELOG.md | 9 +++++++++ README.md | 2 +- Stripe/Info.plist | 4 ++-- Stripe/PublicHeaders/STPAPIClient.h | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9daafb85f45..732ec1de87f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## 15.0.0 2019-??-?? +* Renames all references to 'PaymentMethod' to 'PaymentOption', in anticipation of a new 'PaymentMethod' type. [#1139](https://github.com/stripe/stripe-ios/pull/1139) + * Renames `STPPaymentMethod` to `STPPaymentOption` + * Renames `STPPaymentMethodType` to `STPPaymentOptionType` + * Renames `STPApplePaymentMethod` to `STPApplePay` + * Renames `STPPaymentMethodTuple` to `STPPaymentOptionTuple` + * Renames `STPPaymentMethodsViewController` to `STPPaymentOptionsViewController` + * Renames all properties, methods, comments referencing 'PaymentMethod' to 'PaymentOption' + ## 14.0.0 2018-11-14 * Changes `STPPaymentCardTextField`, which now copies the `cardParams` property. See [MIGRATING.md](/MIGRATING.md) for more details. [#1031](https://github.com/stripe/stripe-ios/pull/1031) * Renames `STPPaymentIntentParams.returnUrl` to `STPPaymentIntentParams.returnURL`. [#1037](https://github.com/stripe/stripe-ios/pull/1037) diff --git a/README.md b/README.md index 1b0ce12cd3a..35c509ac17f 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ The Stripe iOS SDK makes it quick and easy to build an excellent payment experie We recommend that you install the Stripe iOS SDK using a package manager such as [Cocoapods or Carthage](https://stripe.com/docs/mobile/ios#getting-started). If you prefer to link the library manually, please use a version from our [releases](https://github.com/stripe/stripe-ios/releases) page because we consider the master branch to be unstable. If you're reading this on GitHub.com, please make sure you are looking at the [tagged version](https://github.com/stripe/stripe-ios/tags) that corresponds to the release you have installed. Otherwise, the instructions and example code may be mismatched with your copy. You can read the latest tagged version of this README and browse the associated code on GitHub using -[this link](https://github.com/stripe/stripe-ios/tree/v14.0.0). +[this link](https://github.com/stripe/stripe-ios/tree/v15.0.0). ## Requirements diff --git a/Stripe/Info.plist b/Stripe/Info.plist index a0e8cf9c350..307c54eb2d8 100644 --- a/Stripe/Info.plist +++ b/Stripe/Info.plist @@ -13,11 +13,11 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 14.0.0 + 15.0.0 CFBundleSignature ???? CFBundleVersion - 14.0.0 + 15.0.0 NSPrincipalClass diff --git a/Stripe/PublicHeaders/STPAPIClient.h b/Stripe/PublicHeaders/STPAPIClient.h index dc5195d6e2e..d4eccfb0f5a 100644 --- a/Stripe/PublicHeaders/STPAPIClient.h +++ b/Stripe/PublicHeaders/STPAPIClient.h @@ -18,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN /** The current version of this library. */ -static NSString *const STPSDKVersion = @"14.0.0"; +static NSString *const STPSDKVersion = @"15.0.0"; @class STPBankAccount, STPBankAccountParams, STPCard, STPCardParams, STPConnectAccountParams; @class STPPaymentConfiguration, STPPaymentIntentParams, STPSourceParams, STPToken; From 61c5db93281a8b2ad9d5e4368e2196308fba0a20 Mon Sep 17 00:00:00 2001 From: Yuki Tokuhiro Date: Tue, 5 Mar 2019 15:44:57 -0800 Subject: [PATCH 09/11] Update version to v15.0.0 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 4b964e96540..94188a74831 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -14.0.0 +15.0.0 From 22bae03d1054722b96d2325932b9325a34d36125 Mon Sep 17 00:00:00 2001 From: Yuki Tokuhiro Date: Tue, 5 Mar 2019 15:48:00 -0800 Subject: [PATCH 10/11] Rename STPApplePay -> STPApplePayPaymentOption --- CHANGELOG.md | 2 +- Stripe.xcodeproj/project.pbxproj | 24 +++++++++---------- ...PApplePay.h => STPApplePayPaymentOption.h} | 4 ++-- Stripe/PublicHeaders/Stripe.h | 2 +- ...PApplePay.m => STPApplePayPaymentOption.m} | 8 +++---- Stripe/STPPaymentContext.m | 4 ++-- Stripe/STPPaymentOptionTableViewCell.m | 4 ++-- Stripe/STPPaymentOptionTuple.m | 4 ++-- Tests/Tests/STPApplePayPaymentOptionTest.m | 12 +++++----- Tests/Tests/STPCustomerSourceTupleTest.m | 2 +- 10 files changed, 33 insertions(+), 33 deletions(-) rename Stripe/PublicHeaders/{STPApplePay.h => STPApplePayPaymentOption.h} (83%) rename Stripe/{STPApplePay.m => STPApplePayPaymentOption.m} (79%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 732ec1de87f..071495d8721 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ * Renames all references to 'PaymentMethod' to 'PaymentOption', in anticipation of a new 'PaymentMethod' type. [#1139](https://github.com/stripe/stripe-ios/pull/1139) * Renames `STPPaymentMethod` to `STPPaymentOption` * Renames `STPPaymentMethodType` to `STPPaymentOptionType` - * Renames `STPApplePaymentMethod` to `STPApplePay` + * Renames `STPApplePaymentMethod` to `STPApplePayPaymentOption` * Renames `STPPaymentMethodTuple` to `STPPaymentOptionTuple` * Renames `STPPaymentMethodsViewController` to `STPPaymentOptionsViewController` * Renames all properties, methods, comments referencing 'PaymentMethod' to 'PaymentOption' diff --git a/Stripe.xcodeproj/project.pbxproj b/Stripe.xcodeproj/project.pbxproj index 2270ea0b3b0..4b88d50ba69 100644 --- a/Stripe.xcodeproj/project.pbxproj +++ b/Stripe.xcodeproj/project.pbxproj @@ -171,7 +171,7 @@ 049A3FA71CC8071100F57DE7 /* stp_card_applepay@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 049A3FA41CC8071100F57DE7 /* stp_card_applepay@3x.png */; }; 049A3FA81CC963EB00F57DE7 /* STPPaymentOption.h in Headers */ = {isa = PBXBuildFile; fileRef = C11810851CC6AF4C0022FB55 /* STPPaymentOption.h */; settings = {ATTRIBUTES = (Public, ); }; }; 049A3FA91CC96B3B00F57DE7 /* STPBackendAPIAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = C11810A61CC6E2160022FB55 /* STPBackendAPIAdapter.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 049A3FAA1CC96B7C00F57DE7 /* STPApplePay.h in Headers */ = {isa = PBXBuildFile; fileRef = C11810871CC6B00D0022FB55 /* STPApplePay.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 049A3FAA1CC96B7C00F57DE7 /* STPApplePayPaymentOption.h in Headers */ = {isa = PBXBuildFile; fileRef = C11810871CC6B00D0022FB55 /* STPApplePayPaymentOption.h */; settings = {ATTRIBUTES = (Public, ); }; }; 049A3FAE1CC9AA9900F57DE7 /* STPAddressViewModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 049A3FAC1CC9AA9900F57DE7 /* STPAddressViewModel.h */; }; 049A3FAF1CC9AA9900F57DE7 /* STPAddressViewModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 049A3FAD1CC9AA9900F57DE7 /* STPAddressViewModel.m */; }; 049A3FB21CC9FEFC00F57DE7 /* UIToolbar+Stripe_InputAccessory.h in Headers */ = {isa = PBXBuildFile; fileRef = 049A3FB01CC9FEFC00F57DE7 /* UIToolbar+Stripe_InputAccessory.h */; }; @@ -312,7 +312,7 @@ 04F94DAE1D229F54004FC826 /* STPColorUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 0426B96D1CEADC98006AC8DD /* STPColorUtils.m */; }; 04F94DAF1D229F59004FC826 /* STPPaymentOptionsViewController+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 04E39F561CECF9A800AF3B96 /* STPPaymentOptionsViewController+Private.h */; }; 04F94DB41D229F71004FC826 /* STPPaymentActivityIndicatorView.m in Sources */ = {isa = PBXBuildFile; fileRef = 046FE9A01CE55D1D00DA6A7B /* STPPaymentActivityIndicatorView.m */; }; - 04F94DB91D229F86004FC826 /* STPApplePay.m in Sources */ = {isa = PBXBuildFile; fileRef = C11810881CC6B00D0022FB55 /* STPApplePay.m */; }; + 04F94DB91D229F86004FC826 /* STPApplePayPaymentOption.m in Sources */ = {isa = PBXBuildFile; fileRef = C11810881CC6B00D0022FB55 /* STPApplePayPaymentOption.m */; }; 04F94DBA1D229F8A004FC826 /* PKPaymentAuthorizationViewController+Stripe_Blocks.h in Headers */ = {isa = PBXBuildFile; fileRef = C11810931CC6C4700022FB55 /* PKPaymentAuthorizationViewController+Stripe_Blocks.h */; }; 04F94DBB1D229F8D004FC826 /* PKPaymentAuthorizationViewController+Stripe_Blocks.m in Sources */ = {isa = PBXBuildFile; fileRef = C11810941CC6C4700022FB55 /* PKPaymentAuthorizationViewController+Stripe_Blocks.m */; }; 04F94DBC1D229F92004FC826 /* UIToolbar+Stripe_InputAccessory.m in Sources */ = {isa = PBXBuildFile; fileRef = 049A3FB11CC9FEFC00F57DE7 /* UIToolbar+Stripe_InputAccessory.m */; }; @@ -453,8 +453,8 @@ C113D21B1EBB9A36006FACC2 /* STPEphemeralKey.m in Sources */ = {isa = PBXBuildFile; fileRef = C113D2181EBB9A36006FACC2 /* STPEphemeralKey.m */; }; C113D21C1EBB9A36006FACC2 /* STPEphemeralKey.m in Sources */ = {isa = PBXBuildFile; fileRef = C113D2181EBB9A36006FACC2 /* STPEphemeralKey.m */; }; C11810861CC6AF4C0022FB55 /* STPPaymentOption.h in Headers */ = {isa = PBXBuildFile; fileRef = C11810851CC6AF4C0022FB55 /* STPPaymentOption.h */; settings = {ATTRIBUTES = (Public, ); }; }; - C11810891CC6B00D0022FB55 /* STPApplePay.h in Headers */ = {isa = PBXBuildFile; fileRef = C11810871CC6B00D0022FB55 /* STPApplePay.h */; settings = {ATTRIBUTES = (Public, ); }; }; - C118108A1CC6B00D0022FB55 /* STPApplePay.m in Sources */ = {isa = PBXBuildFile; fileRef = C11810881CC6B00D0022FB55 /* STPApplePay.m */; }; + C11810891CC6B00D0022FB55 /* STPApplePayPaymentOption.h in Headers */ = {isa = PBXBuildFile; fileRef = C11810871CC6B00D0022FB55 /* STPApplePayPaymentOption.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C118108A1CC6B00D0022FB55 /* STPApplePayPaymentOption.m in Sources */ = {isa = PBXBuildFile; fileRef = C11810881CC6B00D0022FB55 /* STPApplePayPaymentOption.m */; }; C11810951CC6C4700022FB55 /* PKPaymentAuthorizationViewController+Stripe_Blocks.h in Headers */ = {isa = PBXBuildFile; fileRef = C11810931CC6C4700022FB55 /* PKPaymentAuthorizationViewController+Stripe_Blocks.h */; }; C11810961CC6C4700022FB55 /* PKPaymentAuthorizationViewController+Stripe_Blocks.m in Sources */ = {isa = PBXBuildFile; fileRef = C11810941CC6C4700022FB55 /* PKPaymentAuthorizationViewController+Stripe_Blocks.m */; }; C11810991CC6D46D0022FB55 /* NSDecimalNumber+StripeTest.m in Sources */ = {isa = PBXBuildFile; fileRef = C11810981CC6D46D0022FB55 /* NSDecimalNumber+StripeTest.m */; }; @@ -1167,8 +1167,8 @@ C113D2171EBB9A36006FACC2 /* STPEphemeralKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STPEphemeralKey.h; sourceTree = ""; }; C113D2181EBB9A36006FACC2 /* STPEphemeralKey.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPEphemeralKey.m; sourceTree = ""; }; C11810851CC6AF4C0022FB55 /* STPPaymentOption.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = STPPaymentOption.h; path = PublicHeaders/STPPaymentOption.h; sourceTree = ""; }; - C11810871CC6B00D0022FB55 /* STPApplePay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = STPApplePay.h; path = PublicHeaders/STPApplePay.h; sourceTree = ""; }; - C11810881CC6B00D0022FB55 /* STPApplePay.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPApplePay.m; sourceTree = ""; }; + C11810871CC6B00D0022FB55 /* STPApplePayPaymentOption.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = STPApplePayPaymentOption.h; path = PublicHeaders/STPApplePayPaymentOption.h; sourceTree = ""; }; + C11810881CC6B00D0022FB55 /* STPApplePayPaymentOption.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPApplePayPaymentOption.m; sourceTree = ""; }; C11810931CC6C4700022FB55 /* PKPaymentAuthorizationViewController+Stripe_Blocks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "PKPaymentAuthorizationViewController+Stripe_Blocks.h"; sourceTree = ""; }; C11810941CC6C4700022FB55 /* PKPaymentAuthorizationViewController+Stripe_Blocks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "PKPaymentAuthorizationViewController+Stripe_Blocks.m"; sourceTree = ""; }; C11810981CC6D46D0022FB55 /* NSDecimalNumber+StripeTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDecimalNumber+StripeTest.m"; sourceTree = ""; }; @@ -2042,8 +2042,8 @@ F1728CF31EAAA43B002E0C29 /* PaymentContext */ = { isa = PBXGroup; children = ( - C11810871CC6B00D0022FB55 /* STPApplePay.h */, - C11810881CC6B00D0022FB55 /* STPApplePay.m */, + C11810871CC6B00D0022FB55 /* STPApplePayPaymentOption.h */, + C11810881CC6B00D0022FB55 /* STPApplePayPaymentOption.m */, C11810A61CC6E2160022FB55 /* STPBackendAPIAdapter.h */, C192269B1EBA99F900BED563 /* STPCustomerContext.h */, C192269E1EBA9A0800BED563 /* STPCustomerContext.m */, @@ -2316,7 +2316,7 @@ 04F94DCF1D22A234004FC826 /* NSDecimalNumber+Stripe_Currency.h in Headers */, 8BD87B931EFB1C1E00269C2B /* STPSourceVerification+Private.h in Headers */, C1BD9B231E393FFE00CEE925 /* STPSourceReceiver.h in Headers */, - 049A3FAA1CC96B7C00F57DE7 /* STPApplePay.h in Headers */, + 049A3FAA1CC96B7C00F57DE7 /* STPApplePayPaymentOption.h in Headers */, 04F94DA51D229F21004FC826 /* STPPaymentContext+Private.h in Headers */, F12829DB1D7747E4008B10D6 /* STPBundleLocator.h in Headers */, 8BD87B891EFB131800269C2B /* STPSourceCardDetails+Private.h in Headers */, @@ -2458,7 +2458,7 @@ F1C7B8D51DBECF2400D9F6F0 /* STPDispatchFunctions.h in Headers */, 0426B9761CEBD001006AC8DD /* UINavigationBar+Stripe_Theme.h in Headers */, 04E39F581CECF9A800AF3B96 /* STPPaymentOptionsViewController+Private.h in Headers */, - C11810891CC6B00D0022FB55 /* STPApplePay.h in Headers */, + C11810891CC6B00D0022FB55 /* STPApplePayPaymentOption.h in Headers */, 0426B9721CEAE3EB006AC8DD /* UITableViewCell+Stripe_Borders.h in Headers */, 04CDE5C91BC20B1D00548833 /* STPBankAccountParams.h in Headers */, 049A3F891CC73C7100F57DE7 /* STPPaymentContext.h in Headers */, @@ -3078,7 +3078,7 @@ B36C6D762193676600D17575 /* STPPaymentIntentSourceActionAuthorizeWithURL.m in Sources */, B3A99BC61FEAF2CA003F6ED3 /* STPLegalEntityParams.m in Sources */, C180211D1E3A58710089D712 /* STPSourcePoller.m in Sources */, - 04F94DB91D229F86004FC826 /* STPApplePay.m in Sources */, + 04F94DB91D229F86004FC826 /* STPApplePayPaymentOption.m in Sources */, B3A2413C1FFEB57400A2F00D /* STPConnectAccountParams.m in Sources */, C1BD9B2B1E39406C00CEE925 /* STPSourceOwner.m in Sources */, C1BD9B311E3940A200CEE925 /* STPSourceRedirect.m in Sources */, @@ -3209,7 +3209,7 @@ 04695ADC1C77F9EF00E08063 /* STPPhoneNumberValidator.m in Sources */, C1785F5E1EC60B5E00E9CFAC /* STPCardIOProxy.m in Sources */, 04CDB5141A5F30A700B854EE /* STPToken.m in Sources */, - C118108A1CC6B00D0022FB55 /* STPApplePay.m in Sources */, + C118108A1CC6B00D0022FB55 /* STPApplePayPaymentOption.m in Sources */, 04A488341CA34D3000506E53 /* STPEmailAddressValidator.m in Sources */, 0433EB4C1BD06313003912B4 /* NSDictionary+Stripe.m in Sources */, F12C8DC31D63DE9F00ADA0D7 /* STPPaymentContextAmountModel.m in Sources */, diff --git a/Stripe/PublicHeaders/STPApplePay.h b/Stripe/PublicHeaders/STPApplePayPaymentOption.h similarity index 83% rename from Stripe/PublicHeaders/STPApplePay.h rename to Stripe/PublicHeaders/STPApplePayPaymentOption.h index a892882151d..5680b1f00cc 100644 --- a/Stripe/PublicHeaders/STPApplePay.h +++ b/Stripe/PublicHeaders/STPApplePayPaymentOption.h @@ -1,5 +1,5 @@ // -// STPApplePay.h +// STPApplePayPaymentOption.h // Stripe // // Created by Ben Guo on 4/19/16. @@ -19,6 +19,6 @@ } ``` */ -@interface STPApplePay : NSObject +@interface STPApplePayPaymentOption : NSObject @end diff --git a/Stripe/PublicHeaders/Stripe.h b/Stripe/PublicHeaders/Stripe.h index 27a82341a92..53875724a42 100644 --- a/Stripe/PublicHeaders/Stripe.h +++ b/Stripe/PublicHeaders/Stripe.h @@ -12,7 +12,7 @@ #import "STPAPIClient+ApplePay.h" #import "STPAPIClient.h" #import "STPAPIResponseDecodable.h" -#import "STPApplePay.h" +#import "STPApplePayPaymentOption.h" #import "STPBackendAPIAdapter.h" #import "STPBankAccount.h" #import "STPBankAccountParams.h" diff --git a/Stripe/STPApplePay.m b/Stripe/STPApplePayPaymentOption.m similarity index 79% rename from Stripe/STPApplePay.m rename to Stripe/STPApplePayPaymentOption.m index a47aa66b3aa..0158954c083 100644 --- a/Stripe/STPApplePay.m +++ b/Stripe/STPApplePayPaymentOption.m @@ -1,18 +1,18 @@ // -// STPApplePay.m +// STPApplePayPaymentOption.m // Stripe // // Created by Ben Guo on 4/19/16. // Copyright © 2016 Stripe, Inc. All rights reserved. // -#import "STPApplePay.h" +#import "STPApplePayPaymentOption.h" #import "STPImageLibrary.h" #import "STPImageLibrary+Private.h" #import "STPLocalizationUtils.h" -@implementation STPApplePay +@implementation STPApplePayPaymentOption #pragma mark - STPPaymentOption @@ -32,7 +32,7 @@ - (NSString *)label { #pragma mark - Equality - (BOOL)isEqual:(id)object { - return [object isKindOfClass:[STPApplePay class]]; + return [object isKindOfClass:[STPApplePayPaymentOption class]]; } - (NSUInteger)hash { diff --git a/Stripe/STPPaymentContext.m b/Stripe/STPPaymentContext.m index e712c4e13e3..51ce1f53b5e 100644 --- a/Stripe/STPPaymentContext.m +++ b/Stripe/STPPaymentContext.m @@ -208,7 +208,7 @@ - (void)setPrefilledInformation:(STPUserInformation *)prefilledInformation { - (void)setPaymentOptions:(NSArray> *)paymentOptions { _paymentOptions = [paymentOptions sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) { - Class applePayKlass = [STPApplePay class]; + Class applePayKlass = [STPApplePayPaymentOption class]; Class cardKlass = [STPCard class]; if ([obj1 isKindOfClass:applePayKlass]) { return NSOrderedAscending; @@ -596,7 +596,7 @@ - (void)requestPayment { }); }]; } - else if ([self.selectedPaymentOption isKindOfClass:[STPApplePay class]]) { + else if ([self.selectedPaymentOption isKindOfClass:[STPApplePayPaymentOption class]]) { self.state = STPPaymentContextStateRequestingPayment; PKPaymentRequest *paymentRequest = [self buildPaymentRequest]; STPShippingAddressSelectionBlock shippingAddressHandler = ^(STPAddress *shippingAddress, STPShippingAddressValidationBlock completion) { diff --git a/Stripe/STPPaymentOptionTableViewCell.m b/Stripe/STPPaymentOptionTableViewCell.m index 957beea26bf..37541d89579 100644 --- a/Stripe/STPPaymentOptionTableViewCell.m +++ b/Stripe/STPPaymentOptionTableViewCell.m @@ -8,7 +8,7 @@ #import "STPPaymentOptionTableViewCell.h" -#import "STPApplePay.h" +#import "STPApplePayPaymentOption.h" #import "STPCard.h" #import "STPImageLibrary+Private.h" #import "STPLocalizationUtils.h" @@ -131,7 +131,7 @@ - (NSAttributedString *)buildAttributedStringWithPaymentOption:(id> *)payment id _Nullable selected = selectedPaymentOption; if (applePayEnabled) { - STPApplePay *applePay = [STPApplePay new]; + STPApplePayPaymentOption *applePay = [STPApplePayPaymentOption new]; [mutablePaymentOptions addObject:applePay]; if (!selected) { diff --git a/Tests/Tests/STPApplePayPaymentOptionTest.m b/Tests/Tests/STPApplePayPaymentOptionTest.m index 87552de2504..4b49af71a68 100644 --- a/Tests/Tests/STPApplePayPaymentOptionTest.m +++ b/Tests/Tests/STPApplePayPaymentOptionTest.m @@ -8,7 +8,7 @@ #import -#import "STPApplePay.h" +#import "STPApplePayPaymentOption.h" @interface STPApplePayPaymentOptionTest : XCTestCase @@ -19,25 +19,25 @@ @implementation STPApplePayPaymentOptionTest #pragma mark - STPPaymentOption Tests - (void)testImage { - STPApplePay *applePay = [[STPApplePay alloc] init]; + STPApplePayPaymentOption *applePay = [[STPApplePayPaymentOption alloc] init]; XCTAssert([applePay image]); } - (void)testTemplateImage { - STPApplePay *applePay = [[STPApplePay alloc] init]; + STPApplePayPaymentOption *applePay = [[STPApplePayPaymentOption alloc] init]; XCTAssert([applePay templateImage]); } - (void)testLabel { - STPApplePay *applePay = [[STPApplePay alloc] init]; + STPApplePayPaymentOption *applePay = [[STPApplePayPaymentOption alloc] init]; XCTAssertEqualObjects([applePay label], @"Apple Pay"); } #pragma mark - Equality Tests - (void)testApplePayEquals { - STPApplePay *applePay1 = [[STPApplePay alloc] init]; - STPApplePay *applePay2 = [[STPApplePay alloc] init]; + STPApplePayPaymentOption *applePay1 = [[STPApplePayPaymentOption alloc] init]; + STPApplePayPaymentOption *applePay2 = [[STPApplePayPaymentOption alloc] init]; XCTAssertNotEqual(applePay1, applePay2); diff --git a/Tests/Tests/STPCustomerSourceTupleTest.m b/Tests/Tests/STPCustomerSourceTupleTest.m index 10af4dcd19c..41cd13b2f86 100644 --- a/Tests/Tests/STPCustomerSourceTupleTest.m +++ b/Tests/Tests/STPCustomerSourceTupleTest.m @@ -72,7 +72,7 @@ - (void)performSourceTupleTestWithCustomer:(STPCustomer *)sut [self performSourceTupleTestWithCustomer:sut applePayEnabled:YES expectedValidSources:expectedSourceCount + 1 - expectedSelectedSource:expectedSelectedSource ?: [STPApplePay new]]; + expectedSelectedSource:expectedSelectedSource ?: [STPApplePayPaymentOption new]]; } - (void)testSourceTupleCreationNoSources { From 5d0bcb0ef4b3b01a536ec8d49c69d6b18dc54034 Mon Sep 17 00:00:00 2001 From: Yuki Tokuhiro Date: Tue, 5 Mar 2019 21:15:00 -0800 Subject: [PATCH 11/11] Fix ci snapshot tests for legacy devices by renaming STPPaymentOptionsViewControllerLocalizationTests in the ignore list --- ci_scripts/run_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci_scripts/run_tests.sh b/ci_scripts/run_tests.sh index 244c9cefcf6..91d59e78098 100755 --- a/ci_scripts/run_tests.sh +++ b/ci_scripts/run_tests.sh @@ -61,7 +61,7 @@ xcodebuild clean test \ -destination "platform=iOS Simulator,name=iPhone 6,OS=9.3" \ -destination "platform=iOS Simulator,name=iPhone 4s,OS=9.3" \ -skip-testing:"StripeiOS Tests/STPAddCardViewControllerLocalizationTests" \ - -skip-testing:"StripeiOS Tests/STPPaymentMethodsViewControllerLocalizationTests" \ + -skip-testing:"StripeiOS Tests/STPPaymentOptionsViewControllerLocalizationTests" \ -skip-testing:"StripeiOS Tests/STPShippingAddressViewControllerLocalizationTests" \ -skip-testing:"StripeiOS Tests/STPShippingMethodsViewControllerLocalizationTests" \ ONLY_ACTIVE_ARCH=NO \