Commit 2f906584 by Rune Madsen

Remove shippingRateId on checkout. No longer needed.

parent 4c8548c6
...@@ -73,17 +73,6 @@ ...@@ -73,17 +73,6 @@
XCTAssertTrue([checkout isDirty]); XCTAssertTrue([checkout isDirty]);
} }
- (void)testSettingAShippingRateMarksShippingRateIdAsDirty
{
BUYShippingRate *shippingRate = [[BUYShippingRate alloc] initWithDictionary:@{ @"id" : @"banana" }];
XCTAssertNil(_checkout.shippingRate);
XCTAssertNil(_checkout.shippingRateId);
_checkout.shippingRate = shippingRate;
XCTAssertEqualObjects(@"banana", _checkout.shippingRateId);
XCTAssertTrue([[_checkout dirtyProperties] containsObject:@"shippingRateId"]);
}
- (void)testDirtyPropertiesAreReturnedInJSON - (void)testDirtyPropertiesAreReturnedInJSON
{ {
BUYShippingRate *shippingRate = [[BUYShippingRate alloc] initWithDictionary:@{ @"id" : @"banana" }]; BUYShippingRate *shippingRate = [[BUYShippingRate alloc] initWithDictionary:@{ @"id" : @"banana" }];
...@@ -93,12 +82,10 @@ ...@@ -93,12 +82,10 @@
_checkout.currency = @"BANANA"; _checkout.currency = @"BANANA";
NSSet *dirtyProperties = [_checkout dirtyProperties]; NSSet *dirtyProperties = [_checkout dirtyProperties];
XCTAssertTrue([dirtyProperties containsObject:@"currency"]); XCTAssertTrue([dirtyProperties containsObject:@"currency"]);
XCTAssertTrue([dirtyProperties containsObject:@"shippingRateId"]);
XCTAssertTrue([dirtyProperties containsObject:@"shippingRate"]); XCTAssertTrue([dirtyProperties containsObject:@"shippingRate"]);
NSDictionary *json = [_checkout jsonDictionaryForCheckout]; NSDictionary *json = [_checkout jsonDictionaryForCheckout];
XCTAssertEqualObjects(json[@"checkout"][@"currency"], @"BANANA"); XCTAssertEqualObjects(json[@"checkout"][@"currency"], @"BANANA");
XCTAssertEqualObjects(json[@"checkout"][@"shipping_rate_id"], @"banana");
} }
- (void)testRequiresShippingAndIncludesTaxesSerialization - (void)testRequiresShippingAndIncludesTaxesSerialization
......
...@@ -149,11 +149,6 @@ ...@@ -149,11 +149,6 @@
@property (nonatomic, strong) BUYShippingRate *shippingRate; @property (nonatomic, strong) BUYShippingRate *shippingRate;
/** /**
* Shipping rate identifier
*/
@property (nonatomic, readonly) NSString *shippingRateId;
/**
* A discount added to the checkout * A discount added to the checkout
* Only one discount can be added to a checkout. Call `updateCheckout:completion:` * Only one discount can be added to a checkout. Call `updateCheckout:completion:`
* after adding a discount to apply the discount code to the checkout. * after adding a discount to apply the discount code to the checkout.
......
...@@ -71,20 +71,11 @@ ...@@ -71,20 +71,11 @@
return self; return self;
} }
- (void)setShippingRateId:(NSString *)shippingRateIdentifier
{
[self willChangeValueForKey:@"shippingRateId"];
_shippingRateId = shippingRateIdentifier;
[self didChangeValueForKey:@"shippingRateId"];
}
- (void)setShippingRate:(BUYShippingRate *)shippingRate - (void)setShippingRate:(BUYShippingRate *)shippingRate
{ {
[self willChangeValueForKey:@"shippingRate"]; [self willChangeValueForKey:@"shippingRate"];
_shippingRate = shippingRate; _shippingRate = shippingRate;
[self didChangeValueForKey:@"shippingRate"]; [self didChangeValueForKey:@"shippingRate"];
[self setShippingRateId:shippingRate.shippingRateIdentifier];
} }
+ (NSString *)jsonKeyForProperty:(NSString *)property + (NSString *)jsonKeyForProperty:(NSString *)property
......
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