Commit 2f906584 by Rune Madsen

Remove shippingRateId on checkout. No longer needed.

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