Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
shopify_iossdk
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cemarose
shopify_iossdk
Commits
839f95b0
Commit
839f95b0
authored
Jun 03, 2016
by
Dima Bart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert deprecated BUYCheckout initializers to use model manager.
parent
10f92a7e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
21 deletions
+21
-21
BUYApplePayAdditionsTest.m
...e Buy SDK/Mobile Buy SDK Tests/BUYApplePayAdditionsTest.m
+1
-1
BUYCheckoutTest.m
Mobile Buy SDK/Mobile Buy SDK Tests/BUYCheckoutTest.m
+2
-2
BUYClientTest.m
Mobile Buy SDK/Mobile Buy SDK Tests/BUYClientTest.m
+3
-3
BUYIntegrationTest.m
Mobile Buy SDK/Mobile Buy SDK Tests/BUYIntegrationTest.m
+9
-9
BUYCheckout.h
Mobile Buy SDK/Mobile Buy SDK/Models/Transient/BUYCheckout.h
+2
-2
BUYCheckout.m
Mobile Buy SDK/Mobile Buy SDK/Models/Transient/BUYCheckout.m
+4
-4
No files found.
Mobile Buy SDK/Mobile Buy SDK Tests/BUYApplePayAdditionsTest.m
View file @
839f95b0
...
@@ -46,7 +46,7 @@
...
@@ -46,7 +46,7 @@
-
(
void
)
setUp
-
(
void
)
setUp
{
{
_modelManager
=
[
BUYModelManager
modelManager
];
_modelManager
=
[
BUYModelManager
modelManager
];
_checkout
=
[[
BUYCheckout
alloc
]
initWith
C
art
:
nil
];
_checkout
=
[[
BUYCheckout
alloc
]
initWith
ModelManager
:
_modelManager
c
art
:
nil
];
}
}
-
(
void
)
tearDown
-
(
void
)
tearDown
...
...
Mobile Buy SDK/Mobile Buy SDK Tests/BUYCheckoutTest.m
View file @
839f95b0
...
@@ -72,7 +72,7 @@
...
@@ -72,7 +72,7 @@
-
(
void
)
testInitWithCartAddsLineItems
-
(
void
)
testInitWithCartAddsLineItems
{
{
[
_cart
addVariant
:
_variant
];
[
_cart
addVariant
:
_variant
];
BUYCheckout
*
checkout
=
[[
BUYCheckout
alloc
]
initWith
C
art
:
_cart
];
BUYCheckout
*
checkout
=
[[
BUYCheckout
alloc
]
initWith
ModelManager
:
_modelManager
c
art
:
_cart
];
XCTAssertEqual
([[
checkout
lineItems
]
count
],
[[
_cart
lineItems
]
count
]);
XCTAssertEqual
([[
checkout
lineItems
]
count
],
[[
_cart
lineItems
]
count
]);
XCTAssertTrue
([
checkout
isDirty
]);
XCTAssertTrue
([
checkout
isDirty
]);
}
}
...
@@ -140,7 +140,7 @@
...
@@ -140,7 +140,7 @@
-
(
void
)
testHasToken
-
(
void
)
testHasToken
{
{
BUYCheckout
*
checkout
=
[[
BUYCheckout
alloc
]
initWith
C
art
:
_cart
];
BUYCheckout
*
checkout
=
[[
BUYCheckout
alloc
]
initWith
ModelManager
:
_modelManager
c
art
:
_cart
];
checkout
.
token
=
nil
;
checkout
.
token
=
nil
;
XCTAssertFalse
([
checkout
hasToken
]);
XCTAssertFalse
([
checkout
hasToken
]);
checkout
.
token
=
@""
;
checkout
.
token
=
@""
;
...
...
Mobile Buy SDK/Mobile Buy SDK Tests/BUYClientTest.m
View file @
839f95b0
...
@@ -70,7 +70,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
...
@@ -70,7 +70,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
-
(
NSData
*
)
dataForCartFromClient
:
(
BUYClient
*
)
client
-
(
NSData
*
)
dataForCartFromClient
:
(
BUYClient
*
)
client
{
{
BUYCart
*
cart
=
[
self
cart
];
BUYCart
*
cart
=
[
self
cart
];
BUYCheckout
*
checkout
=
[[
BUYCheckout
alloc
]
initWith
C
art
:
cart
];
BUYCheckout
*
checkout
=
[[
BUYCheckout
alloc
]
initWith
ModelManager
:
cart
.
modelManager
c
art
:
cart
];
BUYRequestOperation
*
task
=
(
BUYRequestOperation
*
)[
self
.
client
createCheckout
:
checkout
completion
:
^
(
BUYCheckout
*
checkout
,
NSError
*
error
)
{}];
BUYRequestOperation
*
task
=
(
BUYRequestOperation
*
)[
self
.
client
createCheckout
:
checkout
completion
:
^
(
BUYCheckout
*
checkout
,
NSError
*
error
)
{}];
XCTAssertNotNil
(
task
);
XCTAssertNotNil
(
task
);
...
@@ -99,7 +99,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
...
@@ -99,7 +99,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
-
(
void
)
testPartialAddressesFlag
-
(
void
)
testPartialAddressesFlag
{
{
BUYCart
*
cart
=
[
self
cart
];
BUYCart
*
cart
=
[
self
cart
];
BUYCheckout
*
checkout
=
[[
BUYCheckout
alloc
]
initWith
C
art
:
cart
];
BUYCheckout
*
checkout
=
[[
BUYCheckout
alloc
]
initWith
ModelManager
:
cart
.
modelManager
c
art
:
cart
];
XCTAssertThrows
([
checkout
setPartialAddressesValue
:
NO
]);
XCTAssertThrows
([
checkout
setPartialAddressesValue
:
NO
]);
...
@@ -107,7 +107,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
...
@@ -107,7 +107,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
NSDictionary
*
json
=
[
NSJSONSerialization
JSONObjectWithData
:
task
.
originalRequest
.
HTTPBody
options
:
0
error
:
nil
];
NSDictionary
*
json
=
[
NSJSONSerialization
JSONObjectWithData
:
task
.
originalRequest
.
HTTPBody
options
:
0
error
:
nil
];
XCTAssertFalse
([
json
[
@"checkout"
][
@"partial_addresses"
]
boolValue
]);
XCTAssertFalse
([
json
[
@"checkout"
][
@"partial_addresses"
]
boolValue
]);
checkout
=
[[
BUYCheckout
alloc
]
initWith
C
art
:
cart
];
checkout
=
[[
BUYCheckout
alloc
]
initWith
ModelManager
:
cart
.
modelManager
c
art
:
cart
];
BUYAddress
*
partialAddress
=
[
self
.
client
.
modelManager
insertAddressWithJSONDictionary
:
nil
];
BUYAddress
*
partialAddress
=
[
self
.
client
.
modelManager
insertAddressWithJSONDictionary
:
nil
];
partialAddress
.
address1
=
nil
;
partialAddress
.
address1
=
nil
;
...
...
Mobile Buy SDK/Mobile Buy SDK Tests/BUYIntegrationTest.m
View file @
839f95b0
...
@@ -101,7 +101,7 @@
...
@@ -101,7 +101,7 @@
{
{
[
OHHTTPStubs
stubUsingResponseWithKey
:
@"testCheckoutFlowUsingCreditCard_1"
useMocks
:[
self
shouldUseMocks
]];
[
OHHTTPStubs
stubUsingResponseWithKey
:
@"testCheckoutFlowUsingCreditCard_1"
useMocks
:[
self
shouldUseMocks
]];
_checkout
=
[[
BUYCheckout
alloc
]
initWith
C
art
:
_cart
];
_checkout
=
[[
BUYCheckout
alloc
]
initWith
ModelManager
:
_modelManager
c
art
:
_cart
];
_checkout
.
shippingAddress
=
[
self
shippingAddress
];
_checkout
.
shippingAddress
=
[
self
shippingAddress
];
_checkout
.
billingAddress
=
[
self
billingAddress
];
_checkout
.
billingAddress
=
[
self
billingAddress
];
XCTestExpectation
*
expectation
=
[
self
expectationWithDescription
:
NSStringFromSelector
(
_cmd
)];
XCTestExpectation
*
expectation
=
[
self
expectationWithDescription
:
NSStringFromSelector
(
_cmd
)];
...
@@ -124,7 +124,7 @@
...
@@ -124,7 +124,7 @@
[
OHHTTPStubs
stubUsingResponseWithKey
:
@"testCheckoutFlowUsingCreditCard_1"
useMocks
:[
self
shouldUseMocks
]];
[
OHHTTPStubs
stubUsingResponseWithKey
:
@"testCheckoutFlowUsingCreditCard_1"
useMocks
:[
self
shouldUseMocks
]];
[
self
createCart
];
[
self
createCart
];
_checkout
=
[[
BUYCheckout
alloc
]
initWith
C
art
:
_cart
];
_checkout
=
[[
BUYCheckout
alloc
]
initWith
ModelManager
:
_modelManager
c
art
:
_cart
];
NSString
*
note
=
@"Order note"
;
NSString
*
note
=
@"Order note"
;
_checkout
.
note
=
note
;
_checkout
.
note
=
note
;
...
@@ -709,7 +709,7 @@
...
@@ -709,7 +709,7 @@
-
(
void
)
testCheckoutWithInvalidShop
-
(
void
)
testCheckoutWithInvalidShop
{
{
[
self
createCart
];
[
self
createCart
];
_checkout
=
[[
BUYCheckout
alloc
]
initWith
C
art
:
_cart
];
_checkout
=
[[
BUYCheckout
alloc
]
initWith
ModelManager
:
_modelManager
c
art
:
_cart
];
XCTestExpectation
*
expectation
=
[
self
expectationWithDescription
:
NSStringFromSelector
(
_cmd
)];
XCTestExpectation
*
expectation
=
[
self
expectationWithDescription
:
NSStringFromSelector
(
_cmd
)];
[
OHHTTPStubs
stubUsingResponseWithKey
:
@"testInvalidIntegrationBadShopUrl_0"
useMocks
:[
self
shouldUseMocks
]];
[
OHHTTPStubs
stubUsingResponseWithKey
:
@"testInvalidIntegrationBadShopUrl_0"
useMocks
:[
self
shouldUseMocks
]];
...
@@ -733,7 +733,7 @@
...
@@ -733,7 +733,7 @@
[
OHHTTPStubs
stubUsingResponseWithKey
:
@"testFetchingShippingRatesWithoutShippingAddress_1"
useMocks
:[
self
shouldUseMocks
]];
[
OHHTTPStubs
stubUsingResponseWithKey
:
@"testFetchingShippingRatesWithoutShippingAddress_1"
useMocks
:[
self
shouldUseMocks
]];
[
self
createCart
];
[
self
createCart
];
_checkout
=
[[
BUYCheckout
alloc
]
initWith
C
art
:
_cart
];
_checkout
=
[[
BUYCheckout
alloc
]
initWith
ModelManager
:
_modelManager
c
art
:
_cart
];
XCTestExpectation
*
expectation
=
[
self
expectationWithDescription
:
NSStringFromSelector
(
_cmd
)];
XCTestExpectation
*
expectation
=
[
self
expectationWithDescription
:
NSStringFromSelector
(
_cmd
)];
[
self
.
client
createCheckout
:
_checkout
completion
:
^
(
BUYCheckout
*
returnedCheckout
,
NSError
*
error
)
{
[
self
.
client
createCheckout
:
_checkout
completion
:
^
(
BUYCheckout
*
returnedCheckout
,
NSError
*
error
)
{
...
@@ -766,7 +766,7 @@
...
@@ -766,7 +766,7 @@
{
{
[
OHHTTPStubs
stubUsingResponseWithKey
:
@"testFetchingShippingRatesWithInvalidCheckout_1"
useMocks
:[
self
shouldUseMocks
]];
[
OHHTTPStubs
stubUsingResponseWithKey
:
@"testFetchingShippingRatesWithInvalidCheckout_1"
useMocks
:[
self
shouldUseMocks
]];
BUYCheckout
*
checkout
=
[[
BUYCheckout
alloc
]
initWith
C
art
:
nil
];
BUYCheckout
*
checkout
=
[[
BUYCheckout
alloc
]
initWith
ModelManager
:
_modelManager
c
art
:
nil
];
checkout
.
token
=
@"bananaaaa"
;
checkout
.
token
=
@"bananaaaa"
;
XCTestExpectation
*
expectation
=
[
self
expectationWithDescription
:
NSStringFromSelector
(
_cmd
)];
XCTestExpectation
*
expectation
=
[
self
expectationWithDescription
:
NSStringFromSelector
(
_cmd
)];
...
@@ -792,7 +792,7 @@
...
@@ -792,7 +792,7 @@
-
(
void
)
testCheckoutWithAPartialAddress
-
(
void
)
testCheckoutWithAPartialAddress
{
{
[
self
createCart
];
[
self
createCart
];
_checkout
=
[[
BUYCheckout
alloc
]
initWith
C
art
:
_cart
];
_checkout
=
[[
BUYCheckout
alloc
]
initWith
ModelManager
:
_modelManager
c
art
:
_cart
];
_checkout
.
shippingAddress
=
[
self
partialShippingAddress
];
_checkout
.
shippingAddress
=
[
self
partialShippingAddress
];
if
([
_checkout
.
shippingAddress
isPartialAddress
])
{
if
([
_checkout
.
shippingAddress
isPartialAddress
])
{
...
@@ -836,7 +836,7 @@
...
@@ -836,7 +836,7 @@
[
OHHTTPStubs
stubUsingResponseWithKey
:
@"testCreateCheckoutWithValidDiscount_1"
useMocks
:[
self
shouldUseMocks
]];
[
OHHTTPStubs
stubUsingResponseWithKey
:
@"testCreateCheckoutWithValidDiscount_1"
useMocks
:[
self
shouldUseMocks
]];
_checkout
=
[[
BUYCheckout
alloc
]
initWith
C
art
:
_cart
];
_checkout
=
[[
BUYCheckout
alloc
]
initWith
ModelManager
:
_modelManager
c
art
:
_cart
];
_checkout
.
discount
=
[
self
applicableDiscount
];
_checkout
.
discount
=
[
self
applicableDiscount
];
// Create the checkout
// Create the checkout
...
@@ -865,7 +865,7 @@
...
@@ -865,7 +865,7 @@
[
OHHTTPStubs
stubUsingResponseWithKey
:
@"testCreateCheckoutWithExpiredDiscount_1"
useMocks
:[
self
shouldUseMocks
]];
[
OHHTTPStubs
stubUsingResponseWithKey
:
@"testCreateCheckoutWithExpiredDiscount_1"
useMocks
:[
self
shouldUseMocks
]];
_checkout
=
[[
BUYCheckout
alloc
]
initWith
C
art
:
_cart
];
_checkout
=
[[
BUYCheckout
alloc
]
initWith
ModelManager
:
_modelManager
c
art
:
_cart
];
_checkout
.
discount
=
[
self
inapplicableDiscount
];
_checkout
.
discount
=
[
self
inapplicableDiscount
];
//Create the checkout
//Create the checkout
...
@@ -887,7 +887,7 @@
...
@@ -887,7 +887,7 @@
[
OHHTTPStubs
stubUsingResponseWithKey
:
@"testCreateCheckoutWithNonExistentDiscount_1"
useMocks
:[
self
shouldUseMocks
]];
[
OHHTTPStubs
stubUsingResponseWithKey
:
@"testCreateCheckoutWithNonExistentDiscount_1"
useMocks
:[
self
shouldUseMocks
]];
_checkout
=
[[
BUYCheckout
alloc
]
initWith
C
art
:
_cart
];
_checkout
=
[[
BUYCheckout
alloc
]
initWith
ModelManager
:
_modelManager
c
art
:
_cart
];
_checkout
.
discount
=
[
self
nonExistentDiscount
];
_checkout
.
discount
=
[
self
nonExistentDiscount
];
//Create the checkout
//Create the checkout
...
...
Mobile Buy SDK/Mobile Buy SDK/Models/Transient/BUYCheckout.h
View file @
839f95b0
...
@@ -39,8 +39,8 @@
...
@@ -39,8 +39,8 @@
@property
(
nonatomic
)
BOOL
hasToken
;
@property
(
nonatomic
)
BOOL
hasToken
;
-
(
instancetype
)
initWith
Cart
:(
BUYCart
*
)
cart
NS_DEPRECATED_IOS
(
8
_0
,
9
_0
,
"Use `BUYModelManager` to create new instances of model objects instead"
)
;
-
(
instancetype
)
initWith
ModelManager
:(
id
<
BUYModelManager
>
)
modelManager
cart
:(
BUYCart
*
)
cart
;
-
(
instancetype
)
initWith
CartToken
:(
NSString
*
)
token
NS_DEPRECATED_IOS
(
8
_0
,
9
_0
,
"Use `BUYModelManager` to create new instances of model objects instead"
);
;
-
(
instancetype
)
initWith
ModelManager
:(
id
<
BUYModelManager
>
)
modelManager
cartToken
:(
NSString
*
)
token
;
-
(
void
)
updateWithCart
:(
BUYCart
*
)
cart
;
-
(
void
)
updateWithCart
:(
BUYCart
*
)
cart
;
...
...
Mobile Buy SDK/Mobile Buy SDK/Models/Transient/BUYCheckout.m
View file @
839f95b0
...
@@ -94,18 +94,18 @@
...
@@ -94,18 +94,18 @@
}
}
#endif
#endif
-
(
instancetype
)
initWith
C
art
:
(
BUYCart
*
)
cart
-
(
instancetype
)
initWith
ModelManager
:
(
id
<
BUYModelManager
>
)
modelManager
c
art
:
(
BUYCart
*
)
cart
{
{
self
=
[
self
initWithModelManager
:
cart
.
modelManager
JSONDictionary
:
nil
];
self
=
[
self
initWithModelManager
:
modelManager
JSONDictionary
:
nil
];
if
(
self
)
{
if
(
self
)
{
[
self
updateWithCart
:
cart
];
[
self
updateWithCart
:
cart
];
}
}
return
self
;
return
self
;
}
}
-
(
instancetype
)
initWith
C
artToken
:
(
NSString
*
)
token
-
(
instancetype
)
initWith
ModelManager
:
(
id
<
BUYModelManager
>
)
modelManager
c
artToken
:
(
NSString
*
)
token
{
{
self
=
[
self
initWithModelManager
:
nil
JSONDictionary
:
nil
];
self
=
[
self
initWithModelManager
:
modelManager
JSONDictionary
:
nil
];
if
(
self
)
{
if
(
self
)
{
self
.
cartToken
=
token
;
self
.
cartToken
=
token
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment