Commit 002a528c by Brent Gulanowski

Add "Address.isDefault" boolean <-> "default".

parent a353280d
...@@ -232,6 +232,9 @@ ...@@ -232,6 +232,9 @@
XCTAssertTrue([addresses.firstObject isKindOfClass:[BUYAddress class]]); XCTAssertTrue([addresses.firstObject isKindOfClass:[BUYAddress class]]);
XCTAssertNil(error); XCTAssertNil(error);
NSArray *defaultAddresses = [addresses filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"isDefault == 1"]];
XCTAssertEqual(1, defaultAddresses.count);
[expectation fulfill]; [expectation fulfill];
}]; }];
......
...@@ -41,6 +41,13 @@ ...@@ -41,6 +41,13 @@
<entry key="documentation" value="Unique identifier for the address"/> <entry key="documentation" value="Unique identifier for the address"/>
</userInfo> </userInfo>
</attribute> </attribute>
<attribute name="isDefault" optional="YES" attributeType="Boolean" syncable="YES">
<userInfo>
<entry key="discussion" value="Maps to &quot;default&quot; key in JSON."/>
<entry key="documentation" value="Whether the address is the owning customer's default address."/>
<entry key="JSONPropertyKey" value="default"/>
</userInfo>
</attribute>
<attribute name="lastName" optional="YES" attributeType="String" syncable="YES"> <attribute name="lastName" optional="YES" attributeType="String" syncable="YES">
<userInfo> <userInfo>
<entry key="documentation" value="The last name of the person associated with the payment method."/> <entry key="documentation" value="The last name of the person associated with the payment method."/>
...@@ -983,7 +990,7 @@ ...@@ -983,7 +990,7 @@
<memberEntity name="CheckoutAttribute"/> <memberEntity name="CheckoutAttribute"/>
</configuration> </configuration>
<elements> <elements>
<element name="Address" positionX="-990" positionY="1444" width="128" height="255"/> <element name="Address" positionX="-990" positionY="1444" width="128" height="270"/>
<element name="Cart" positionX="-1192" positionY="978" width="128" height="60"/> <element name="Cart" positionX="-1192" positionY="978" width="128" height="60"/>
<element name="CartLineItem" positionX="-987" positionY="1183" width="128" height="90"/> <element name="CartLineItem" positionX="-987" positionY="1183" width="128" height="90"/>
<element name="Checkout" positionX="-765" positionY="1072" width="128" height="630"/> <element name="Checkout" positionX="-765" positionY="1072" width="128" height="630"/>
......
...@@ -39,6 +39,7 @@ extern const struct BUYAddressAttributes { ...@@ -39,6 +39,7 @@ extern const struct BUYAddressAttributes {
__unsafe_unretained NSString *countryCode; __unsafe_unretained NSString *countryCode;
__unsafe_unretained NSString *firstName; __unsafe_unretained NSString *firstName;
__unsafe_unretained NSString *identifier; __unsafe_unretained NSString *identifier;
__unsafe_unretained NSString *isDefault;
__unsafe_unretained NSString *lastName; __unsafe_unretained NSString *lastName;
__unsafe_unretained NSString *phone; __unsafe_unretained NSString *phone;
__unsafe_unretained NSString *province; __unsafe_unretained NSString *province;
...@@ -115,6 +116,17 @@ extern const struct BUYAddressUserInfo { ...@@ -115,6 +116,17 @@ extern const struct BUYAddressUserInfo {
- (void)setIdentifierValue:(int64_t)value_; - (void)setIdentifierValue:(int64_t)value_;
/** /**
* Whether the address is the owning customer's default address.
*
* Maps to "default" key in JSON.
*/
@property (nonatomic, strong) NSNumber* isDefault;
@property (atomic) BOOL isDefaultValue;
- (BOOL)isDefaultValue;
- (void)setIsDefaultValue:(BOOL)value_;
/**
* The last name of the person associated with the payment method. * The last name of the person associated with the payment method.
*/ */
@property (nonatomic, strong) NSString* lastName; @property (nonatomic, strong) NSString* lastName;
...@@ -169,6 +181,9 @@ extern const struct BUYAddressUserInfo { ...@@ -169,6 +181,9 @@ extern const struct BUYAddressUserInfo {
- (NSNumber*)primitiveIdentifier; - (NSNumber*)primitiveIdentifier;
- (void)setPrimitiveIdentifier:(NSNumber*)value; - (void)setPrimitiveIdentifier:(NSNumber*)value;
- (NSNumber*)primitiveIsDefault;
- (void)setPrimitiveIsDefault:(NSNumber*)value;
- (NSString*)primitiveLastName; - (NSString*)primitiveLastName;
- (void)setPrimitiveLastName:(NSString*)value; - (void)setPrimitiveLastName:(NSString*)value;
......
...@@ -37,6 +37,7 @@ const struct BUYAddressAttributes BUYAddressAttributes = { ...@@ -37,6 +37,7 @@ const struct BUYAddressAttributes BUYAddressAttributes = {
.countryCode = @"countryCode", .countryCode = @"countryCode",
.firstName = @"firstName", .firstName = @"firstName",
.identifier = @"identifier", .identifier = @"identifier",
.isDefault = @"isDefault",
.lastName = @"lastName", .lastName = @"lastName",
.phone = @"phone", .phone = @"phone",
.province = @"province", .province = @"province",
...@@ -66,6 +67,11 @@ const struct BUYAddressUserInfo BUYAddressUserInfo = { ...@@ -66,6 +67,11 @@ const struct BUYAddressUserInfo BUYAddressUserInfo = {
keyPaths = [keyPaths setByAddingObjectsFromSet:affectingKey]; keyPaths = [keyPaths setByAddingObjectsFromSet:affectingKey];
return keyPaths; return keyPaths;
} }
if ([key isEqualToString:@"isDefaultValue"]) {
NSSet *affectingKey = [NSSet setWithObject:@"isDefault"];
keyPaths = [keyPaths setByAddingObjectsFromSet:affectingKey];
return keyPaths;
}
return keyPaths; return keyPaths;
} }
...@@ -79,6 +85,7 @@ const struct BUYAddressUserInfo BUYAddressUserInfo = { ...@@ -79,6 +85,7 @@ const struct BUYAddressUserInfo BUYAddressUserInfo = {
@dynamic countryCode; @dynamic countryCode;
@dynamic firstName; @dynamic firstName;
@dynamic identifier; @dynamic identifier;
@dynamic isDefault;
@dynamic lastName; @dynamic lastName;
@dynamic phone; @dynamic phone;
@dynamic province; @dynamic province;
...@@ -95,6 +102,15 @@ const struct BUYAddressUserInfo BUYAddressUserInfo = { ...@@ -95,6 +102,15 @@ const struct BUYAddressUserInfo BUYAddressUserInfo = {
[self setIdentifier:@(value_)]; [self setIdentifier:@(value_)];
} }
- (BOOL)isDefaultValue {
NSNumber *result = [self isDefault];
return [result boolValue];
}
- (void)setIsDefaultValue:(BOOL)value_ {
[self setIsDefault:@(value_)];
}
#if defined CORE_DATA_PERSISTENCE #if defined CORE_DATA_PERSISTENCE
@dynamic customer; @dynamic customer;
#endif #endif
......
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