Commit 2e5a6170 by David Muzi Committed by GitHub

Merge pull request #259 from Shopify/task/remove-password-confirmation

Remove password confirmation
parents a79a3661 1b573e78
...@@ -63,8 +63,7 @@ class SignupViewController: UITableViewController { ...@@ -63,8 +63,7 @@ class SignupViewController: UITableViewController {
BUYAccountCredentialItem(firstName: self.firstName), BUYAccountCredentialItem(firstName: self.firstName),
BUYAccountCredentialItem(lastName: self.lastName), BUYAccountCredentialItem(lastName: self.lastName),
BUYAccountCredentialItem(email: self.email), BUYAccountCredentialItem(email: self.email),
BUYAccountCredentialItem(password: self.password), BUYAccountCredentialItem(password: self.password)
BUYAccountCredentialItem(passwordConfirmation: self.passwordConfirm),
]) ])
self.actionCell.loading = true self.actionCell.loading = true
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
- (void)testValidationWithInvalidItems { - (void)testValidationWithInvalidItems {
BUYAccountCredentials *credentials = [BUYAccountCredentials credentialsWithItems:[self sampleWithInvalidItems]]; BUYAccountCredentials *credentials = [BUYAccountCredentials credentialsWithItems:[self sampleWithInvalidItems]];
XCTAssertEqual(credentials.count, 3); XCTAssertEqual(credentials.count, 2);
XCTAssertFalse(credentials.isValid); XCTAssertFalse(credentials.isValid);
} }
...@@ -78,7 +78,6 @@ ...@@ -78,7 +78,6 @@
[BUYAccountCredentialItem itemWithFirstName:@"John"], [BUYAccountCredentialItem itemWithFirstName:@"John"],
[BUYAccountCredentialItem itemWithLastName:@"Doe"], [BUYAccountCredentialItem itemWithLastName:@"Doe"],
[BUYAccountCredentialItem itemWithPassword:@"pass"], [BUYAccountCredentialItem itemWithPassword:@"pass"],
[BUYAccountCredentialItem itemWithPasswordConfirmation:@"pass"],
]]; ]];
NSDictionary *json = [credentials JSONRepresentation]; NSDictionary *json = [credentials JSONRepresentation];
...@@ -91,7 +90,6 @@ ...@@ -91,7 +90,6 @@
XCTAssertEqual(customer[BUYAccountFirstNameKey], @"John"); XCTAssertEqual(customer[BUYAccountFirstNameKey], @"John");
XCTAssertEqual(customer[BUYAccountLastNameKey], @"Doe"); XCTAssertEqual(customer[BUYAccountLastNameKey], @"Doe");
XCTAssertEqual(customer[BUYAccountPasswordKey], @"pass"); XCTAssertEqual(customer[BUYAccountPasswordKey], @"pass");
XCTAssertEqual(customer[BUYAccountPasswordConfirmationKey], @"pass");
} }
#pragma mark - Utilities - #pragma mark - Utilities -
...@@ -105,11 +103,6 @@ ...@@ -105,11 +103,6 @@
return [BUYAccountCredentialItem itemWithPassword:@"password"]; return [BUYAccountCredentialItem itemWithPassword:@"password"];
} }
- (BUYAccountCredentialItem *)passwordConfirmationItem
{
return [BUYAccountCredentialItem itemWithPasswordConfirmation:@"password"];
}
- (NSArray *)sampleWithValidItems { - (NSArray *)sampleWithValidItems {
NSMutableArray *items = [NSMutableArray new]; NSMutableArray *items = [NSMutableArray new];
[items addObject:[self emailItem]]; [items addObject:[self emailItem]];
...@@ -121,7 +114,6 @@ ...@@ -121,7 +114,6 @@
NSMutableArray *items = [NSMutableArray new]; NSMutableArray *items = [NSMutableArray new];
[items addObject:[self emailItem]]; [items addObject:[self emailItem]];
[items addObject:[BUYAccountCredentialItem itemWithPassword:@""]]; [items addObject:[BUYAccountCredentialItem itemWithPassword:@""]];
[items addObject:[BUYAccountCredentialItem itemWithPasswordConfirmation:@""]];
return items; return items;
} }
......
...@@ -120,16 +120,12 @@ ...@@ -120,16 +120,12 @@
XCTAssertNotNil(error); XCTAssertNotNil(error);
NSArray<BUYError *> *errors = [BUYError errorsFromSignUpJSON:error.userInfo]; NSArray<BUYError *> *errors = [BUYError errorsFromSignUpJSON:error.userInfo];
XCTAssertEqual(errors.count, 3); XCTAssertEqual(errors.count, 2);
BUYError *emailError = errors[0]; BUYError *emailError = errors[0];
XCTAssertEqualObjects(emailError.code, @"invalid"); XCTAssertEqualObjects(emailError.code, @"invalid");
BUYError *passwordConfError = errors[1]; BUYError *passwordError = errors[1];
XCTAssertEqualObjects(passwordConfError.code, @"confirmation");
XCTAssertEqualObjects(passwordConfError.options[@"attribute"], @"Password");
BUYError *passwordError = errors[2];
XCTAssertEqualObjects(passwordError.code, @"too_short"); XCTAssertEqualObjects(passwordError.code, @"too_short");
XCTAssertEqualObjects(passwordError.options[@"count"], @5); XCTAssertEqualObjects(passwordError.options[@"count"], @5);
...@@ -412,16 +408,14 @@ ...@@ -412,16 +408,14 @@
{ {
BUYAccountCredentialItem *email = [BUYAccountCredentialItem itemWithEmail:self.customerEmail]; BUYAccountCredentialItem *email = [BUYAccountCredentialItem itemWithEmail:self.customerEmail];
BUYAccountCredentialItem *password = [BUYAccountCredentialItem itemWithPassword:self.customerPassword]; BUYAccountCredentialItem *password = [BUYAccountCredentialItem itemWithPassword:self.customerPassword];
BUYAccountCredentialItem *password2 = [BUYAccountCredentialItem itemWithPasswordConfirmation:self.customerPassword]; return [BUYAccountCredentials credentialsWithItems:@[email, password]];
return [BUYAccountCredentials credentialsWithItems:@[email, password, password2]];
} }
- (BUYAccountCredentials *)credentialsForFailure - (BUYAccountCredentials *)credentialsForFailure
{ {
BUYAccountCredentialItem *email = [BUYAccountCredentialItem itemWithEmail:@"a"]; BUYAccountCredentialItem *email = [BUYAccountCredentialItem itemWithEmail:@"a"];
BUYAccountCredentialItem *password = [BUYAccountCredentialItem itemWithPassword:@"b"]; BUYAccountCredentialItem *password = [BUYAccountCredentialItem itemWithPassword:@"b"];
BUYAccountCredentialItem *password2 = [BUYAccountCredentialItem itemWithPasswordConfirmation:@"c"]; return [BUYAccountCredentials credentialsWithItems:@[email, password]];
return [BUYAccountCredentials credentialsWithItems:@[email, password, password2]];
} }
@end @end
...@@ -208,7 +208,6 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg"; ...@@ -208,7 +208,6 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
[BUYAccountCredentialItem itemWithLastName:@"scott"], [BUYAccountCredentialItem itemWithLastName:@"scott"],
[BUYAccountCredentialItem itemWithEmail:@"fake@example.com"], [BUYAccountCredentialItem itemWithEmail:@"fake@example.com"],
[BUYAccountCredentialItem itemWithPassword:@"password"], [BUYAccountCredentialItem itemWithPassword:@"password"],
[BUYAccountCredentialItem itemWithPasswordConfirmation:@"password"],
]; ];
BUYAccountCredentials *credentials = [BUYAccountCredentials credentialsWithItems:items]; BUYAccountCredentials *credentials = [BUYAccountCredentials credentialsWithItems:items];
...@@ -229,7 +228,6 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg"; ...@@ -229,7 +228,6 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
BUYAccountLastNameKey: @"scott", BUYAccountLastNameKey: @"scott",
BUYAccountEmailKey: @"fake@example.com", BUYAccountEmailKey: @"fake@example.com",
BUYAccountPasswordKey: @"password", BUYAccountPasswordKey: @"password",
BUYAccountPasswordConfirmationKey: @"password"
}}; }};
XCTAssertEqualObjects(payload, dict); XCTAssertEqualObjects(payload, dict);
} }
...@@ -325,8 +323,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg"; ...@@ -325,8 +323,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
- (void)testCustomerActivation - (void)testCustomerActivation
{ {
NSArray *items = @[ NSArray *items = @[
[BUYAccountCredentialItem itemWithPassword:@"12345"], [BUYAccountCredentialItem itemWithPassword:@"12345"]
[BUYAccountCredentialItem itemWithPasswordConfirmation:@"12345"],
]; ];
BUYAccountCredentials *credentials = [BUYAccountCredentials credentialsWithItems:items]; BUYAccountCredentials *credentials = [BUYAccountCredentials credentialsWithItems:items];
NSString *customerID = @"12345"; NSString *customerID = @"12345";
......
...@@ -122,7 +122,7 @@ ...@@ -122,7 +122,7 @@
"testGetOutOfIndexCollectionPage_0":{"body":"{\"collection_listings\":[]}","code":200,"message":"OK"}, "testGetOutOfIndexCollectionPage_0":{"body":"{\"collection_listings\":[]}","code":200,"message":"OK"},
"testOutOfStockVariant":{"body":"{\"errors\":{\"checkout\":{\"line_items\":[null,{\"quantity\":[{\"code\":\"not_enough_in_stock\",\"message\":\"Not enough items available. Only 0 left.\",\"options\":{\"remaining\":0}}]},{\"quantity\":[{\"code\":\"not_enough_in_stock\",\"message\":\"Not enough items available. Only 0 left.\",\"options\":{\"remaining\":0}}]}],\"source_name\":[],\"reservation_time\":[]}}}"}, "testOutOfStockVariant":{"body":"{\"errors\":{\"checkout\":{\"line_items\":[null,{\"quantity\":[{\"code\":\"not_enough_in_stock\",\"message\":\"Not enough items available. Only 0 left.\",\"options\":{\"remaining\":0}}]},{\"quantity\":[{\"code\":\"not_enough_in_stock\",\"message\":\"Not enough items available. Only 0 left.\",\"options\":{\"remaining\":0}}]}],\"source_name\":[],\"reservation_time\":[]}}}"},
"testCustomerDuplicateEmail":{"body":"{\"errors\":{\"customer\":{\"email\":[{\"code\":\"taken\",\"message\":\"has already been taken\",\"options\":{\"rescue_from_duplicate\":true,\"value\":\"asd@asd.com\"}}]}}}"}, "testCustomerDuplicateEmail":{"body":"{\"errors\":{\"customer\":{\"email\":[{\"code\":\"taken\",\"message\":\"has already been taken\",\"options\":{\"rescue_from_duplicate\":true,\"value\":\"asd@asd.com\"}}]}}}"},
"testCustomerInvalidEmailPassword":{"body":"{\"errors\":{\"customer\":{\"password\":[{\"code\":\"too_short\",\"message\":\"is too short (minimum is 5 characters)\",\"options\":{\"count\":5}}],\"password_confirmation\":[{\"code\":\"confirmation\",\"message\":\"doesn't match Password\",\"options\":{\"attribute\":\"Password\"}}],\"email\":[{\"code\":\"invalid\",\"message\":\"is invalid\",\"options\":{}}]}}}"}, "testCustomerInvalidEmailPassword":{"body":"{\"errors\":{\"customer\":{\"password\":[{\"code\":\"too_short\",\"message\":\"is too short (minimum is 5 characters)\",\"options\":{\"count\":5}}],\"email\":[{\"code\":\"invalid\",\"message\":\"is invalid\",\"options\":{}}]}}}"},
"testCustomerLogout":{"body":"{}","code":204,"message":"OK"}, "testCustomerLogout":{"body":"{}","code":204,"message":"OK"},
"testCustomerLogin":{"body":"{\"customer\":{\"id\":2529265094,\"email\":\"asd@asd.com\",\"default_address\":{\"id\":2839567814,\"first_name\":\"Fast\",\"last_name\":\"Add\",\"company\":\"Shopify Inc.\",\"address1\":\"Sass\",\"address2\":\"12\",\"city\":\"Qsdasd\",\"province\":null,\"country\":\"Bouvet Island\",\"zip\":\"24124124\",\"phone\":\"123124124\",\"name\":\"Fast Add\",\"province_code\":null,\"country_code\":\"BV\",\"country_name\":\"Bouvet Island\",\"default\":true},\"verified_email\":true,\"accepts_marketing\":false,\"first_name\":\"Fast\",\"last_name\":\"Add\",\"orders_count\":9,\"total_spent\":\"375.00\",\"created_at\":\"2016-02-16T14:42:24-05:00\",\"updated_at\":\"2016-03-10T16:34:04-05:00\",\"state\":\"enabled\",\"last_order_id\":2566266118,\"last_order_name\":\"#1137\",\"addresses\":[{\"id\":2785988486,\"first_name\":\"AA\",\"last_name\":\"A\",\"phone\":\"\",\"company\":\"\",\"address1\":\"Assiniboine Road\",\"address2\":\"\",\"city\":\"Toronto\",\"province\":\"Ontario\",\"province_code\":\"ON\",\"country\":\"Canada\",\"country_code\":\"CA\",\"zip\":\"M3J1E1\"},{\"id\":2839567814,\"first_name\":\"Fast\",\"last_name\":\"Add\",\"phone\":\"123124124\",\"company\":\"Shopify Inc.\",\"address1\":\"Sass\",\"address2\":\"12\",\"city\":\"Qsdasd\",\"province\":null,\"province_code\":null,\"country\":\"Bouvet Island\",\"country_code\":\"BV\",\"zip\":\"24124124\"}],\"multipass_identifier\":null,\"tax_exempt\":false}}","code":200,"message":"OK"}, "testCustomerLogin":{"body":"{\"customer\":{\"id\":2529265094,\"email\":\"asd@asd.com\",\"default_address\":{\"id\":2839567814,\"first_name\":\"Fast\",\"last_name\":\"Add\",\"company\":\"Shopify Inc.\",\"address1\":\"Sass\",\"address2\":\"12\",\"city\":\"Qsdasd\",\"province\":null,\"country\":\"Bouvet Island\",\"zip\":\"24124124\",\"phone\":\"123124124\",\"name\":\"Fast Add\",\"province_code\":null,\"country_code\":\"BV\",\"country_name\":\"Bouvet Island\",\"default\":true},\"verified_email\":true,\"accepts_marketing\":false,\"first_name\":\"Fast\",\"last_name\":\"Add\",\"orders_count\":9,\"total_spent\":\"375.00\",\"created_at\":\"2016-02-16T14:42:24-05:00\",\"updated_at\":\"2016-03-10T16:34:04-05:00\",\"state\":\"enabled\",\"last_order_id\":2566266118,\"last_order_name\":\"#1137\",\"addresses\":[{\"id\":2785988486,\"first_name\":\"AA\",\"last_name\":\"A\",\"phone\":\"\",\"company\":\"\",\"address1\":\"Assiniboine Road\",\"address2\":\"\",\"city\":\"Toronto\",\"province\":\"Ontario\",\"province_code\":\"ON\",\"country\":\"Canada\",\"country_code\":\"CA\",\"zip\":\"M3J1E1\"},{\"id\":2839567814,\"first_name\":\"Fast\",\"last_name\":\"Add\",\"phone\":\"123124124\",\"company\":\"Shopify Inc.\",\"address1\":\"Sass\",\"address2\":\"12\",\"city\":\"Qsdasd\",\"province\":null,\"province_code\":null,\"country\":\"Bouvet Island\",\"country_code\":\"BV\",\"zip\":\"24124124\"}],\"multipass_identifier\":null,\"tax_exempt\":false}}","code":200,"message":"OK"},
"testCustomerAddresses":{"code":200,"message":"OK","body":"{\"addresses\":[{\"id\":3228337350,\"first_name\":\"MobileBuy\",\"last_name\":\"TestBot\",\"phone\":\"1-555-555-5555\",\"company\":\"Shopify Inc.\",\"address1\":\"150 Elgin Street\",\"address2\":\"8th Floor\",\"city\":\"Toledo\",\"province\":null,\"province_code\":null,\"country\":null,\"country_code\":null,\"zip\":\"K1N5T5\"},{\"id\":3228402182,\"first_name\":\"MobileBuy\",\"last_name\":\"TestBot\",\"phone\":\"1-555-555-5555\",\"company\":\"Shopify Inc.\",\"address1\":\"150 Elgin Street\",\"address2\":\"8th Floor\",\"city\":\"Ottawa\",\"province\":null,\"province_code\":null,\"country\":null,\"country_code\":null,\"zip\":\"K1N5T5\"},{\"id\":3228535430,\"first_name\":\"Testy\",\"last_name\":\"McTesterson\",\"phone\":\"1-555-555-5555\",\"company\":\"Shopify Inc.\",\"address1\":\"150 Elgin Street\",\"address2\":\"8th Floor\",\"city\":\"Ottawa\",\"province\":null,\"province_code\":null,\"country\":null,\"country_code\":null,\"zip\":\"K1N5T5\"},{\"id\":3279871622,\"first_name\":\"MobileBuy\",\"last_name\":\"asfas\",\"phone\":null,\"company\":null,\"address1\":\"150 Elgin Street\",\"address2\":\"8th Floor\",\"city\":\"Toledo\",\"province\":\"Ciudad Autónoma de Buenos Aires\",\"province_code\":\"C\",\"country\":\"Argentina\",\"country_code\":\"AR\",\"zip\":\"124124\"}]}"}, "testCustomerAddresses":{"code":200,"message":"OK","body":"{\"addresses\":[{\"id\":3228337350,\"first_name\":\"MobileBuy\",\"last_name\":\"TestBot\",\"phone\":\"1-555-555-5555\",\"company\":\"Shopify Inc.\",\"address1\":\"150 Elgin Street\",\"address2\":\"8th Floor\",\"city\":\"Toledo\",\"province\":null,\"province_code\":null,\"country\":null,\"country_code\":null,\"zip\":\"K1N5T5\"},{\"id\":3228402182,\"first_name\":\"MobileBuy\",\"last_name\":\"TestBot\",\"phone\":\"1-555-555-5555\",\"company\":\"Shopify Inc.\",\"address1\":\"150 Elgin Street\",\"address2\":\"8th Floor\",\"city\":\"Ottawa\",\"province\":null,\"province_code\":null,\"country\":null,\"country_code\":null,\"zip\":\"K1N5T5\"},{\"id\":3228535430,\"first_name\":\"Testy\",\"last_name\":\"McTesterson\",\"phone\":\"1-555-555-5555\",\"company\":\"Shopify Inc.\",\"address1\":\"150 Elgin Street\",\"address2\":\"8th Floor\",\"city\":\"Ottawa\",\"province\":null,\"province_code\":null,\"country\":null,\"country_code\":null,\"zip\":\"K1N5T5\"},{\"id\":3279871622,\"first_name\":\"MobileBuy\",\"last_name\":\"asfas\",\"phone\":null,\"company\":null,\"address1\":\"150 Elgin Street\",\"address2\":\"8th Floor\",\"city\":\"Toledo\",\"province\":\"Ciudad Autónoma de Buenos Aires\",\"province_code\":\"C\",\"country\":\"Argentina\",\"country_code\":\"AR\",\"zip\":\"124124\"}]}"},
......
...@@ -93,7 +93,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl ...@@ -93,7 +93,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
/** /**
* POST /api/customers * POST /api/customers
* Creates a new customer * Creates a new customer
* Expects first name, last name, email, password, and password confirmation * Expects first name, last name, email, and password
* *
* @param credentials Credentials object containing items for required fields * @param credentials Credentials object containing items for required fields
* @param block (BUYCustomer *customer, NSString *token, NSError *error) * @param block (BUYCustomer *customer, NSString *token, NSError *error)
...@@ -108,7 +108,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl ...@@ -108,7 +108,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
* PUT /api/customers/:customer_id/activate * PUT /api/customers/:customer_id/activate
* Activates an unactivated customer * Activates an unactivated customer
* *
* @param credentials Credentials containing a password and password confirmation * @param credentials Credentials containing a password
* @param customerID ID of customer being activated * @param customerID ID of customer being activated
* @param token Token contained in activation URL * @param token Token contained in activation URL
* @param block (BUYCustomer *customer, NSString *token, NSError *error) * @param block (BUYCustomer *customer, NSString *token, NSError *error)
...@@ -121,7 +121,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl ...@@ -121,7 +121,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
* PUT /api/customers/:customer_id * PUT /api/customers/:customer_id
* Update customer credentials represented by BUYAccountCredentials object * Update customer credentials represented by BUYAccountCredentials object
* *
* @param credentials Credentials containing a password and password confirmation * @param credentials Credentials containing a password
* @param customerID ID of customer being activated * @param customerID ID of customer being activated
* @param block (BUYCustomer *customer, NSError *error) * @param block (BUYCustomer *customer, NSError *error)
* *
...@@ -133,7 +133,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl ...@@ -133,7 +133,7 @@ typedef void (^BUYDataOrderBlock)(BUYOrder * _Nullable order, NSError * _Nullabl
* PUT /api/customers/:customer_id/reset * PUT /api/customers/:customer_id/reset
* Resets an existing customer's password * Resets an existing customer's password
* *
* @param credentials Credentials containing a password and password confirmation * @param credentials Credentials containing a password
* @param customerID ID of customer resetting password * @param customerID ID of customer resetting password
* @param token Token contained in reset URL * @param token Token contained in reset URL
* @param block (BUYCustomer *customer, NSString *token, NSError *error) * @param block (BUYCustomer *customer, NSString *token, NSError *error)
......
...@@ -31,7 +31,6 @@ OBJC_EXTERN NSString * const BUYAccountFirstNameKey; ...@@ -31,7 +31,6 @@ OBJC_EXTERN NSString * const BUYAccountFirstNameKey;
OBJC_EXTERN NSString * const BUYAccountLastNameKey; OBJC_EXTERN NSString * const BUYAccountLastNameKey;
OBJC_EXTERN NSString * const BUYAccountEmailKey; OBJC_EXTERN NSString * const BUYAccountEmailKey;
OBJC_EXTERN NSString * const BUYAccountPasswordKey; OBJC_EXTERN NSString * const BUYAccountPasswordKey;
OBJC_EXTERN NSString * const BUYAccountPasswordConfirmationKey;
@class BUYAccountCredentialItem; @class BUYAccountCredentialItem;
...@@ -69,7 +68,6 @@ OBJC_EXTERN NSString * const BUYAccountPasswordConfirmationKey; ...@@ -69,7 +68,6 @@ OBJC_EXTERN NSString * const BUYAccountPasswordConfirmationKey;
+ (instancetype)itemWithFirstName:(NSString *)value; + (instancetype)itemWithFirstName:(NSString *)value;
+ (instancetype)itemWithLastName:(NSString *)value; + (instancetype)itemWithLastName:(NSString *)value;
+ (instancetype)itemWithPassword:(NSString *)value; + (instancetype)itemWithPassword:(NSString *)value;
+ (instancetype)itemWithPasswordConfirmation:(NSString *)value;
@end @end
......
...@@ -31,7 +31,6 @@ NSString * const BUYAccountFirstNameKey = @"first_name"; ...@@ -31,7 +31,6 @@ NSString * const BUYAccountFirstNameKey = @"first_name";
NSString * const BUYAccountLastNameKey = @"last_name"; NSString * const BUYAccountLastNameKey = @"last_name";
NSString * const BUYAccountEmailKey = @"email"; NSString * const BUYAccountEmailKey = @"email";
NSString * const BUYAccountPasswordKey = @"password"; NSString * const BUYAccountPasswordKey = @"password";
NSString * const BUYAccountPasswordConfirmationKey = @"password_confirmation";
#pragma mark - BUYAccountCredentials - #pragma mark - BUYAccountCredentials -
@interface BUYAccountCredentials() @interface BUYAccountCredentials()
...@@ -129,11 +128,6 @@ NSString * const BUYAccountPasswordConfirmationKey = @"password_confirmation"; ...@@ -129,11 +128,6 @@ NSString * const BUYAccountPasswordConfirmationKey = @"password_confirmation";
return [BUYAccountCredentialItem itemWithKey:BUYAccountPasswordKey value:value]; return [BUYAccountCredentialItem itemWithKey:BUYAccountPasswordKey value:value];
} }
+ (instancetype)itemWithPasswordConfirmation:(NSString *)value
{
return [BUYAccountCredentialItem itemWithKey:BUYAccountPasswordConfirmationKey value:value];
}
+ (instancetype)itemWithKey:(NSString *)key value:(NSString *)value + (instancetype)itemWithKey:(NSString *)key value:(NSString *)value
{ {
return [[BUYAccountCredentialItem alloc] initWithKey:key value:value]; return [[BUYAccountCredentialItem alloc] initWithKey:key value:value];
......
...@@ -149,12 +149,11 @@ NSArray *credentialItems = @[ ...@@ -149,12 +149,11 @@ NSArray *credentialItems = @[
[BUYAccountCredentialItem itemWithFirstName:@"John"], [BUYAccountCredentialItem itemWithFirstName:@"John"],
[BUYAccountCredentialItem itemWithLastName:@"Smith"], [BUYAccountCredentialItem itemWithLastName:@"Smith"],
[BUYAccountCredentialItem itemWithEmail:@"john.smith@gmail.com"], [BUYAccountCredentialItem itemWithEmail:@"john.smith@gmail.com"],
[BUYAccountCredentialItem itemWithPassword:@"password"], [BUYAccountCredentialItem itemWithPassword:@"password"]
[BUYAccountCredentialItem itemWithPasswordConfirmation:@"password"],
]; ];
BUYAccountCredentials *credentials = [BUYAccountCredentials credentialsWithItems:credentialItems]; BUYAccountCredentials *credentials = [BUYAccountCredentials credentialsWithItems:credentialItems];
``` ```
After we obtain the customers first name, last name and password confirmation in addition to the email and password fields, we can create an account. After we obtain the customers first name, last name and password in addition to the email and password fields, we can create an account.
```objc ```objc
[client createCustomerWithCredentials:credentials callback:^(BUYCustomer *customer, NSString *token, NSError *error) { [client createCustomerWithCredentials:credentials callback:^(BUYCustomer *customer, NSString *token, NSError *error) {
if (customer && token && !error) { if (customer && token && !error) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment