Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds API bindings for AU BECS Debit PaymentMethod #1518

Merged
merged 3 commits into from
Mar 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions Stripe.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,8 @@
3604007B22C18DAE004CF80B /* STPThreeDSTextFieldCustomization.h in Headers */ = {isa = PBXBuildFile; fileRef = 3604006D22C18C78004CF80B /* STPThreeDSTextFieldCustomization.h */; settings = {ATTRIBUTES = (Public, ); }; };
3604007C22C18DB3004CF80B /* STPThreeDSUICustomization.h in Headers */ = {isa = PBXBuildFile; fileRef = 3604006A22C18C77004CF80B /* STPThreeDSUICustomization.h */; settings = {ATTRIBUTES = (Public, ); }; };
3604007D22C18DBA004CF80B /* STPThreeDSButtonCustomization.h in Headers */ = {isa = PBXBuildFile; fileRef = 3604006B22C18C78004CF80B /* STPThreeDSButtonCustomization.h */; settings = {ATTRIBUTES = (Public, ); }; };
360EC5C124241F5900372F1C /* STPPaymentMethodAUBECSDebit.h in Headers */ = {isa = PBXBuildFile; fileRef = 366658AE240F20AC00D00354 /* STPPaymentMethodAUBECSDebit.h */; settings = {ATTRIBUTES = (Public, ); }; };
360EC5C224241F6600372F1C /* STPPaymentMethodAUBECSDebitParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 366658AF240F20AD00D00354 /* STPPaymentMethodAUBECSDebitParams.h */; settings = {ATTRIBUTES = (Public, ); }; };
3617A51420FE5BBB001A9E6A /* NSLocale+STPSwizzling.h in Headers */ = {isa = PBXBuildFile; fileRef = 3617A51220FE5BBB001A9E6A /* NSLocale+STPSwizzling.h */; };
3617A51520FE5BBB001A9E6A /* NSLocale+STPSwizzling.m in Sources */ = {isa = PBXBuildFile; fileRef = 3617A51320FE5BBB001A9E6A /* NSLocale+STPSwizzling.m */; };
3620B63021C41E08009FC6FB /* MockCustomerContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 3620B62F21C41E08009FC6FB /* MockCustomerContext.m */; };
Expand Down Expand Up @@ -644,6 +646,12 @@
365FC5AB21C18F550092ADB0 /* Stripe.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 04CDB4421A5F2E1800B854EE /* Stripe.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
3666589C23FF494400D00354 /* STPTestingAPIClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 3666589A23FF494400D00354 /* STPTestingAPIClient.h */; };
3666589D23FF494400D00354 /* STPTestingAPIClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 3666589B23FF494400D00354 /* STPTestingAPIClient.m */; };
366658A3240F17A300D00354 /* STPPaymentMethodAUBECSDebit.m in Sources */ = {isa = PBXBuildFile; fileRef = 366658A1240F17A300D00354 /* STPPaymentMethodAUBECSDebit.m */; };
366658A9240F1D7D00D00354 /* STPPaymentMethodAUBECSDebitParams.m in Sources */ = {isa = PBXBuildFile; fileRef = 366658A7240F1D7C00D00354 /* STPPaymentMethodAUBECSDebitParams.m */; };
366658B0240F20AD00D00354 /* STPPaymentMethodAUBECSDebit.h in Headers */ = {isa = PBXBuildFile; fileRef = 366658AE240F20AC00D00354 /* STPPaymentMethodAUBECSDebit.h */; settings = {ATTRIBUTES = (Public, ); }; };
366658B1240F20AD00D00354 /* STPPaymentMethodAUBECSDebitParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 366658AF240F20AD00D00354 /* STPPaymentMethodAUBECSDebitParams.h */; settings = {ATTRIBUTES = (Public, ); }; };
366658B324105EF200D00354 /* STPPaymentMethodAUBECSDebitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 366658B224105EF200D00354 /* STPPaymentMethodAUBECSDebitTests.m */; };
366658B52410756100D00354 /* STPPaymentMethodAUBECSDebitParamsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 366658B42410756100D00354 /* STPPaymentMethodAUBECSDebitParamsTests.m */; };
367B46D722A0969000730BE0 /* STPThreeDSCustomizationSettings.m in Sources */ = {isa = PBXBuildFile; fileRef = 367B46D522A0969000730BE0 /* STPThreeDSCustomizationSettings.m */; };
3680BFCC23A9926500DB54AA /* STPPaymentIntentParams+Utilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 3680BFCB23A9926500DB54AA /* STPPaymentIntentParams+Utilities.h */; settings = {ATTRIBUTES = (Public, ); }; };
3680BFCD23A9926500DB54AA /* STPPaymentIntentParams+Utilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 3680BFCB23A9926500DB54AA /* STPPaymentIntentParams+Utilities.h */; };
Expand Down Expand Up @@ -1824,6 +1832,12 @@
365BE8A1228CAB6A0068D824 /* STPIntentActionUseStripeSDK.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = STPIntentActionUseStripeSDK.m; sourceTree = "<group>"; };
3666589A23FF494400D00354 /* STPTestingAPIClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = STPTestingAPIClient.h; sourceTree = "<group>"; };
3666589B23FF494400D00354 /* STPTestingAPIClient.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = STPTestingAPIClient.m; sourceTree = "<group>"; };
366658A1240F17A300D00354 /* STPPaymentMethodAUBECSDebit.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = STPPaymentMethodAUBECSDebit.m; sourceTree = "<group>"; };
366658A7240F1D7C00D00354 /* STPPaymentMethodAUBECSDebitParams.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = STPPaymentMethodAUBECSDebitParams.m; sourceTree = "<group>"; };
366658AE240F20AC00D00354 /* STPPaymentMethodAUBECSDebit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = STPPaymentMethodAUBECSDebit.h; path = PublicHeaders/STPPaymentMethodAUBECSDebit.h; sourceTree = "<group>"; };
366658AF240F20AD00D00354 /* STPPaymentMethodAUBECSDebitParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = STPPaymentMethodAUBECSDebitParams.h; path = PublicHeaders/STPPaymentMethodAUBECSDebitParams.h; sourceTree = "<group>"; };
366658B224105EF200D00354 /* STPPaymentMethodAUBECSDebitTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = STPPaymentMethodAUBECSDebitTests.m; sourceTree = "<group>"; };
366658B42410756100D00354 /* STPPaymentMethodAUBECSDebitParamsTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = STPPaymentMethodAUBECSDebitParamsTests.m; sourceTree = "<group>"; };
3674EAD4232AEE24008ADA25 /* en-GB */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "en-GB"; path = "en-GB.lproj/LaunchScreen.strings"; sourceTree = "<group>"; };
3674EAD5232AEE25008ADA25 /* en-GB */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = "en-GB"; path = "Localizations/en-GB.lproj/Localizable.strings"; sourceTree = "<group>"; };
3674EAD6232AEE37008ADA25 /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/LaunchScreen.strings; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2739,6 +2753,7 @@
isa = PBXGroup;
children = (
B656293023E10F6300458A8E /* Bacs Debit */,
3666589F240F177400D00354 /* AU BECS Debit */,
3626616523C9048500B13AE0 /* Card */,
3626616623C9049000B13AE0 /* Card Present */,
3626616723C9049D00B13AE0 /* Card Wallet */,
Expand Down Expand Up @@ -2984,6 +2999,17 @@
name = Backend;
sourceTree = "<group>";
};
3666589F240F177400D00354 /* AU BECS Debit */ = {
isa = PBXGroup;
children = (
366658AE240F20AC00D00354 /* STPPaymentMethodAUBECSDebit.h */,
366658A1240F17A300D00354 /* STPPaymentMethodAUBECSDebit.m */,
366658AF240F20AD00D00354 /* STPPaymentMethodAUBECSDebitParams.h */,
366658A7240F1D7C00D00354 /* STPPaymentMethodAUBECSDebitParams.m */,
);
name = "AU BECS Debit";
sourceTree = "<group>";
};
8BD2133A1F0458B7007F6FD1 /* Source */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -3121,6 +3147,8 @@
B3BDCACC20EEF4540034F7F5 /* STPPaymentIntentTest.m */,
B6D6C932223076600092AFC8 /* STPPaymentMethodAddressTest.m */,
B656292423E10AB100458A8E /* STPPaymentMethodBacsDebitTest.m */,
366658B42410756100D00354 /* STPPaymentMethodAUBECSDebitParamsTests.m */,
366658B224105EF200D00354 /* STPPaymentMethodAUBECSDebitTests.m */,
B6D6C934223078840092AFC8 /* STPPaymentMethodBillingDetailsTest.m */,
B66D5026222F8605004A9210 /* STPPaymentMethodCardChecksTest.m */,
B628476122307A4100957149 /* STPPaymentMethodCardTest.m */,
Expand Down Expand Up @@ -3664,6 +3692,7 @@
B32B176620F80442000D6EF8 /* STPRedirectContext+Private.h in Headers */,
319A608722E9186B00AACF66 /* STDSChallengeStatusReceiver.h in Headers */,
F1D3A2561EB012350095BFA9 /* STPMultipartFormDataPart.h in Headers */,
360EC5C224241F6600372F1C /* STPPaymentMethodAUBECSDebitParams.h in Headers */,
B604CF2222C56E9B00A23CC4 /* STPIntentActionRedirectToURL.h in Headers */,
B6DB0CA7223817A300AEF640 /* STPPaymentMethodEnums.h in Headers */,
04F94DCD1D22A22F004FC826 /* UIViewController+Stripe_KeyboardAvoiding.h in Headers */,
Expand Down Expand Up @@ -3737,6 +3766,7 @@
3604007A22C18DA9004CF80B /* STPThreeDSSelectionCustomization.h in Headers */,
0413CB29233FECD5006429EA /* STPPushProvisioningDetailsParams.h in Headers */,
3604007D22C18DBA004CF80B /* STPThreeDSButtonCustomization.h in Headers */,
360EC5C124241F5900372F1C /* STPPaymentMethodAUBECSDebit.h in Headers */,
3604007622C18D93004CF80B /* STPThreeDSCustomization+Private.h in Headers */,
F152322B1EA9306100D65C67 /* NSURLComponents+Stripe.h in Headers */,
C1A06F111E1D8A7F004DCA06 /* STPCard+Private.h in Headers */,
Expand Down Expand Up @@ -3918,6 +3948,7 @@
36239BAE2295EA23004FB1A5 /* STP3DS2AuthenticateResponse.h in Headers */,
C158AB3F1E1EE98900348D01 /* STPSectionHeaderView.h in Headers */,
04EBC7571B7533C300A0E6AE /* STPCardValidator.h in Headers */,
366658B0240F20AD00D00354 /* STPPaymentMethodAUBECSDebit.h in Headers */,
046FE9A11CE55D1D00DA6A7B /* STPPaymentActivityIndicatorView.h in Headers */,
C11810861CC6AF4C0022FB55 /* STPPaymentOption.h in Headers */,
0413CB28233FECD5006429EA /* STPPushProvisioningDetailsParams.h in Headers */,
Expand Down Expand Up @@ -3998,6 +4029,7 @@
0731328F2277A3F60019CE3F /* STPPinManagementService.h in Headers */,
3604007222C18C78004CF80B /* STPThreeDSUICustomization.h in Headers */,
B32B175E20F6D2C4000D6EF8 /* STPGenericStripeObject.h in Headers */,
366658B1240F20AD00D00354 /* STPPaymentMethodAUBECSDebitParams.h in Headers */,
049A3F991CC76A2400F57DE7 /* NSBundle+Stripe_AppName.h in Headers */,
3621DDCB22A5E4FD00281BC4 /* STPPaymentHandler.h in Headers */,
04E32A9D1B7A9490009C9E35 /* STPPaymentCardTextField.h in Headers */,
Expand Down Expand Up @@ -4803,6 +4835,7 @@
F14C872F1D4FCDBA00C7CC6A /* STPPaymentContextApplePayTest.m in Sources */,
3626615B23C8F8CD00B13AE0 /* STPConfirmCardOptions.m in Sources */,
C1BD9B1F1E390A2700CEE925 /* STPSourceParamsTest.m in Sources */,
366658B324105EF200D00354 /* STPPaymentMethodAUBECSDebitTests.m in Sources */,
B664D65922B81C1700E6354B /* STPThreeDSFooterCustomizationTest.m in Sources */,
B66D5027222F8605004A9210 /* STPPaymentMethodCardChecksTest.m in Sources */,
B664D66222B83BAF00E6354B /* STPThreeDSLabelCustomizationTest.m in Sources */,
Expand Down Expand Up @@ -4843,6 +4876,7 @@
8B013C891F1E784A00DD831B /* STPPaymentConfigurationTest.m in Sources */,
C1EEDCC81CA2172700A54582 /* NSString+StripeTest.m in Sources */,
3626615223C8F89F00B13AE0 /* STPConfirmPaymentMethodOptions.m in Sources */,
366658B52410756100D00354 /* STPPaymentMethodAUBECSDebitParamsTests.m in Sources */,
8BD87B901EFB17AA00269C2B /* STPSourceRedirectTest.m in Sources */,
04415C6A1A6605B5001225ED /* STPApplePayFunctionalTest.m in Sources */,
8BE5AE8B1EF8905B0081A33C /* STPCardParamsTest.m in Sources */,
Expand Down Expand Up @@ -5117,6 +5151,7 @@
3626615A23C8F8CD00B13AE0 /* STPConfirmCardOptions.m in Sources */,
B640DB1422C58E82003C8810 /* STPSetupIntentConfirmParams.m in Sources */,
B664D64F22B8085900E6354B /* STPThreeDSUICustomization.m in Sources */,
366658A3240F17A300D00354 /* STPPaymentMethodAUBECSDebit.m in Sources */,
04BC29A51CD8697900318357 /* STPTheme.m in Sources */,
C15993391D8808680047950D /* STPShippingMethodTableViewCell.m in Sources */,
C1BD9B2A1E39406C00CEE925 /* STPSourceOwner.m in Sources */,
Expand Down Expand Up @@ -5159,6 +5194,7 @@
F148ABC81D5D334B0014FD92 /* STPLocalizationUtils.m in Sources */,
04A4C38B1C4F25F900B3B290 /* NSArray+Stripe.m in Sources */,
3691EB722119111A008C49E1 /* STPCardValidator+Private.m in Sources */,
366658A9240F1D7D00D00354 /* STPPaymentMethodAUBECSDebitParams.m in Sources */,
0413CB22233FECD5006429EA /* STPPushProvisioningContext.m in Sources */,
F19491E41E60DD72001E1FC2 /* STPSourceSEPADebitDetails.m in Sources */,
04A4C38F1C4F25F900B3B290 /* UIViewController+Stripe_ParentViewController.m in Sources */,
Expand Down
3 changes: 3 additions & 0 deletions Stripe/Payments/STPPaymentHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,14 @@ + (BOOL)_isProcessingIntentSuccessForType:(STPPaymentMethodType)type {
switch (type) {
case STPPaymentMethodTypeSEPADebit:
case STPPaymentMethodTypeBacsDebit: // Bacs Debit takes 2-3 business days
// fall through
case STPPaymentMethodTypeAUBECSDebit:
return YES;
case STPPaymentMethodTypeCard:
case STPPaymentMethodTypeiDEAL:
case STPPaymentMethodTypeFPX:
case STPPaymentMethodTypeCardPresent:
// fall through
case STPPaymentMethodTypeUnknown:
return NO;
}
Expand Down
8 changes: 7 additions & 1 deletion Stripe/PublicHeaders/STPPaymentMethod.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
#import "STPPaymentMethodEnums.h"
#import "STPPaymentOption.h"

@class STPPaymentMethodBillingDetails,
@class STPPaymentMethodAUBECSDebit,
STPPaymentMethodBillingDetails,
STPPaymentMethodCard,
STPPaymentMethodCardPresent,
STPPaymentMethodFPX,
Expand Down Expand Up @@ -85,6 +86,11 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (nonatomic, nullable, readonly) STPPaymentMethodBacsDebit *bacsDebit;

/**
If this is an AU BECS Debit PaymentMethod (i.e. `self.type == STPPaymentMethodTypeAUBECSDebit`), this contains additional details.
*/
@property (nonatomic, nullable, readonly) STPPaymentMethodAUBECSDebit *auBECSDebit;

/**
The ID of the Customer to which this PaymentMethod is saved. Nil when the PaymentMethod has not been saved to a Customer.
*/
Expand Down
45 changes: 45 additions & 0 deletions Stripe/PublicHeaders/STPPaymentMethodAUBECSDebit.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//
// STPPaymentMethodAUBECSDebit.h
// StripeiOS
//
// Created by Cameron Sabol on 3/3/20.
// Copyright © 2020 Stripe, Inc. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "STPAPIResponseDecodable.h"

NS_ASSUME_NONNULL_BEGIN

/**
An AU BECS Debit Payment Method.

@see https://stripe.com/docs/api/payment_methods/object#payment_method_object-au_becs_debit
*/
@interface STPPaymentMethodAUBECSDebit : NSObject <STPAPIResponseDecodable>

/**
You cannot directly instantiate an `STPPaymentMethodAUBECSDebit`.
You should only use one that is part of an existing `STPPaymentMethod` object.
*/
- (instancetype)init NS_UNAVAILABLE;

/**
Six-digit number identifying bank and branch associated with this bank account.
*/
@property (nonatomic, readonly, copy) NSString *bsbNumber;

/**
Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same.
*/
@property (nonatomic, readonly, copy) NSString *fingerprint;

/**
Last four digits of the bank account number.
*/
@property (nonatomic, readonly, copy) NSString *last4;

@end

NS_ASSUME_NONNULL_END
32 changes: 32 additions & 0 deletions Stripe/PublicHeaders/STPPaymentMethodAUBECSDebitParams.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// STPPaymentMethodAUBECSDebitParams.h
// StripeiOS
//
// Created by Cameron Sabol on 3/3/20.
// Copyright © 2020 Stripe, Inc. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "STPFormEncodable.h"

NS_ASSUME_NONNULL_BEGIN

/**
An object representing parameters used to create an AU BECS Debit Payment Method
*/
@interface STPPaymentMethodAUBECSDebitParams : NSObject <STPFormEncodable>

/**
The account number to debit.
*/
@property (nonatomic, copy) NSString *accountNumber;

/**
Six-digit number identifying bank and branch associated with this bank account.
*/
@property (nonatomic, copy) NSString *bsbNumber;

@end

NS_ASSUME_NONNULL_END
5 changes: 5 additions & 0 deletions Stripe/PublicHeaders/STPPaymentMethodEnums.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ typedef NS_ENUM(NSUInteger, STPPaymentMethodType) {
A SEPA Debit payment method.
*/
STPPaymentMethodTypeSEPADebit,

/**
An AU BECS Debit payment method.
*/
STPPaymentMethodTypeAUBECSDebit,

/**
A Bacs Debit payment method.
Expand Down
16 changes: 16 additions & 0 deletions Stripe/PublicHeaders/STPPaymentMethodParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

@class STPPaymentMethod,
STPPaymentMethodBacsDebitParams,
STPPaymentMethodAUBECSDebitParams,
STPPaymentMethodBillingDetails,
STPPaymentMethodCardParams,
STPPaymentMethodFPXParams,
Expand Down Expand Up @@ -78,6 +79,11 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (nonatomic, nullable) STPPaymentMethodBacsDebitParams *bacsDebit;

/**
If this is an AU BECS Debit PaymentMethod, this contains details about the bank to debit.
*/
@property (nonatomic, nullable) STPPaymentMethodAUBECSDebitParams *auBECSDebit;

/**
Set of key-value pairs that you can attach to the PaymentMethod. This can be useful for storing additional information about the PaymentMethod in a structured format.
*/
Expand Down Expand Up @@ -138,6 +144,16 @@ NS_ASSUME_NONNULL_BEGIN
billingDetails:(STPPaymentMethodBillingDetails *)billingDetails
metadata:(nullable NSDictionary<NSString *, NSString *> *)metadata;

/**
Creates params for an AU BECS Debit PaymentMethod;

@param auBECSDebit An object containing the AU BECS bank debit details.
@param billingDetails An object containing the user's billing details. Note that `billingDetails.name` and `billingDetails.email` are required for AU BECS Debit PaymentMethods.
@param metadata Additional information to attach to the PaymentMethod.
*/
+ (nullable STPPaymentMethodParams *)paramsWithAUBECSDebit:(STPPaymentMethodAUBECSDebitParams *)auBECSDebit
billingDetails:(STPPaymentMethodBillingDetails *)billingDetails
metadata:(nullable NSDictionary<NSString *, NSString *> *)metadata;

/**
Creates params from a single-use PaymentMethod. This is useful for recreating a new payment method
Expand Down
2 changes: 2 additions & 0 deletions Stripe/PublicHeaders/Stripe.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
#import "STPPaymentMethodAddress.h"
#import "STPPaymentMethodBacsDebit.h"
#import "STPPaymentMethodBacsDebitParams.h"
#import "STPPaymentMethodAUBECSDebit.h"
#import "STPPaymentMethodAUBECSDebitParams.h"
#import "STPPaymentMethodBillingDetails.h"
#import "STPPaymentMethodCard.h"
#import "STPPaymentMethodCardPresent.h"
Expand Down
Loading