-
Notifications
You must be signed in to change notification settings - Fork 997
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add STPAPIClient method for creating Connect Account tokens.
It takes a single parameter, an `STPConnectAccountParams` object. This has an optional BOOL and an optional STPLegalEntityParams object (one of fields must be provided). Still TODO: adding `description` implementations in STPLegalEntityParams.m, and testing!
- Loading branch information
1 parent
8b3dc19
commit 3f2bc39
Showing
12 changed files
with
563 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// | ||
// STPConnectAccountParams.h | ||
// Stripe | ||
// | ||
// Created by Daniel Jackson on 1/4/18. | ||
// Copyright © 2018 Stripe, Inc. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
#import "STPFormEncodable.h" | ||
|
||
@class STPLegalEntityParams; | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
/** | ||
Parameters for creating a Connect Account token. | ||
*/ | ||
@interface STPConnectAccountParams : NSObject<STPFormEncodable> | ||
|
||
/** | ||
Optional boolean indicating that the Terms Of Service were shown to the user & | ||
the user accepted them. | ||
*/ | ||
@property (nonatomic, nullable, readonly) NSNumber *tosShownAndAccepted; | ||
|
||
/** | ||
Required property with information about the legal entity for this account. | ||
At least one field in the legalEntity must have a value, otherwise the create token | ||
call will fail. | ||
*/ | ||
@property (nonatomic, readonly) STPLegalEntityParams *legalEntity; | ||
|
||
/** | ||
`STPConnectAccountParams` cannot be directly instantiated, use `initTosShownAndAccepted:legalEntity:` | ||
or `initWithLegalEntity:` | ||
*/ | ||
- (instancetype)init __attribute__((unavailable("Cannot be directly instantiated"))); | ||
|
||
/** | ||
Initialize `STPConnectAccountParams` with tosShownAndAccepted = YES | ||
This method cannot be called with `wasAccepted == NO`, guarded by a `NSParameterAssert()`. | ||
Use this init method if you want to set the `tosShownAndAccepted` parameter. If you | ||
don't, use the `initWithLegalEntity:` version instead. | ||
@param wasAccepted Must be YES, but only if the user was shown & accepted the ToS | ||
@param legalEntity data about the legal entity | ||
*/ | ||
- (instancetype)initTosShownAndAccepted:(BOOL)wasAccepted | ||
legalEntity:(STPLegalEntityParams *)legalEntity; | ||
|
||
/** | ||
Initialize `STPConnectAccountParams` with the `STPLegalEntityParams` provided. | ||
This init method cannot change the `tosShownAndAccepted` parameter. Use | ||
`initTosShownAndAccepted:legalEntity:` instead if you need to do that. | ||
These two init methods exist to avoid the (slightly awkward) NSNumber box that would | ||
be needed around `tosShownAndAccepted` if it was optional/nullable, and to enforce | ||
that it is either nil or YES. | ||
@param legalEntity data to send to Stripe about the legal entity | ||
*/ | ||
- (instancetype)initWithLegalEntity:(STPLegalEntityParams *)legalEntity; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
// | ||
// STPLegalEntityParams.h | ||
// Stripe | ||
// | ||
// Created by Daniel Jackson on 12/20/17. | ||
// Copyright © 2017 Stripe, Inc. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "STPFormEncodable.h" | ||
|
||
@class STPAddress, STPVerificationParams; | ||
|
||
|
||
/** | ||
Stripe API parameters to define a Person. Things like their name, address, etc. | ||
All of the fields are optional. | ||
*/ | ||
@interface STPPersonParams: NSObject<STPFormEncodable> | ||
|
||
/** | ||
The first name of this person. | ||
*/ | ||
@property (nonatomic, copy, nullable) NSString *firstName; | ||
|
||
/** | ||
The last name of this person. | ||
*/ | ||
@property (nonatomic, copy, nullable) NSString *lastName; | ||
|
||
/** | ||
The maiden name of this person. | ||
*/ | ||
@property (nonatomic, copy, nullable) NSString *maidenName; | ||
|
||
/** | ||
The address parameter. For `STPPersonParams`, this is the address of the person. | ||
For the `STPLegalEntityParams` subclass, see also `personalAddress`. | ||
*/ | ||
@property (nonatomic, strong, nullable) STPAddress *address; | ||
|
||
/** | ||
The date of birth (dob) of this person. | ||
Must include `day`, `month`, and `year`, and only those fields are used. | ||
*/ | ||
@property (nonatomic, copy, nullable) NSDateComponents *dateOfBirth; | ||
|
||
/** | ||
Verification document for this person. | ||
*/ | ||
@property (nonatomic, strong, nullable) STPVerificationParams *verification; | ||
|
||
@end | ||
|
||
|
||
/** | ||
Stripe API parameters to define a Legal Entity. This extends `STPPersonParams` | ||
and adds some more fields. | ||
Legal entities can be either an individual or a company. | ||
*/ | ||
@interface STPLegalEntityParams : STPPersonParams | ||
|
||
/** | ||
Additional owners of the legal entity. | ||
*/ | ||
@property (nonatomic, strong, nullable) NSArray<STPPersonParams *> *additionalOwners; | ||
|
||
/** | ||
The business name | ||
*/ | ||
@property (nonatomic, copy, nullable) NSString *businessName; | ||
|
||
/** | ||
The business Tax Id | ||
*/ | ||
@property (nonatomic, copy, nullable) NSString *businessTaxId; | ||
|
||
/** | ||
The business VAT Id | ||
*/ | ||
@property (nonatomic, copy, nullable) NSString *businessVATId; | ||
|
||
/** | ||
The gender of the individual, as a string. | ||
Currently either `male` or `female` are supported values. | ||
*/ | ||
@property (nonatomic, copy, nullable) NSString *genderString; | ||
|
||
/** | ||
The personal address field. | ||
*/ | ||
@property (nonatomic, strong, nullable) STPAddress *personalAddress; | ||
|
||
/** | ||
The Personal Id number | ||
*/ | ||
@property (nonatomic, copy, nullable) NSString *personalIdNumber; | ||
|
||
/** | ||
The phone number of the entity. | ||
*/ | ||
@property (nonatomic, copy, nullable) NSString *phoneNumber; | ||
|
||
/** | ||
The last four digits of the SSN of the individual. | ||
*/ | ||
@property (nonatomic, copy, nullable) NSString *ssnLast4; | ||
|
||
/** | ||
The Tax Id Registrar | ||
*/ | ||
@property (nonatomic, copy, nullable) NSString *taxIdRegistrar; | ||
|
||
/** | ||
The type of this legal entity, as a string. | ||
Currently `individual` or `company` are supported values. | ||
*/ | ||
@property (nonatomic, copy, nullable) NSString *entityTypeString; | ||
|
||
@end | ||
|
||
|
||
/** | ||
Parameters for supported types of verification. | ||
*/ | ||
@interface STPVerificationParams: NSObject<STPFormEncodable> | ||
|
||
/** | ||
The file id for the uploaded verification document. | ||
*/ | ||
@property (nonatomic, copy, nullable) NSString *document; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.