Skip to content

Commit

Permalink
Merge pull request #868 from Shopify/develop
Browse files Browse the repository at this point in the history
SDK 3.1.7
  • Loading branch information
dbart01 authored Jun 13, 2018
2 parents ae59031 + 5a6a830 commit 7818271
Show file tree
Hide file tree
Showing 9 changed files with 233 additions and 19 deletions.
40 changes: 24 additions & 16 deletions Buy.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@
9A41E2AA1F8509770059485A /* CustomerDefaultAddressUpdatePayload.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A41E2A91F8509770059485A /* CustomerDefaultAddressUpdatePayload.swift */; };
9A41E2AB1F8509770059485A /* CustomerDefaultAddressUpdatePayload.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A41E2A91F8509770059485A /* CustomerDefaultAddressUpdatePayload.swift */; };
9A41E2AC1F8509770059485A /* CustomerDefaultAddressUpdatePayload.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A41E2A91F8509770059485A /* CustomerDefaultAddressUpdatePayload.swift */; };
9A43489B20C84A56005EAD56 /* CheckoutDiscountCodeRemovePayload.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A43489A20C84A56005EAD56 /* CheckoutDiscountCodeRemovePayload.swift */; };
9A43489C20C84A56005EAD56 /* CheckoutDiscountCodeRemovePayload.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A43489A20C84A56005EAD56 /* CheckoutDiscountCodeRemovePayload.swift */; };
9A43489D20C84A56005EAD56 /* CheckoutDiscountCodeRemovePayload.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A43489A20C84A56005EAD56 /* CheckoutDiscountCodeRemovePayload.swift */; };
9A49DC831EC4AD580053710B /* Header.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A49DC821EC4AD580053710B /* Header.swift */; };
9A52D3A21F3CA58E00C093C8 /* ProductImageSortKeys.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A52D3A01F3CA58E00C093C8 /* ProductImageSortKeys.swift */; };
9A52D3A31F3CA58E00C093C8 /* CardBrand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A52D3A11F3CA58E00C093C8 /* CardBrand.swift */; };
Expand Down Expand Up @@ -650,6 +653,7 @@
9A4069CE1E8ED98A000254CD /* Graph.Task.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Graph.Task.swift; sourceTree = "<group>"; };
9A41E2A51F85096B0059485A /* CheckoutDiscountCodeApplyPayload.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckoutDiscountCodeApplyPayload.swift; sourceTree = "<group>"; };
9A41E2A91F8509770059485A /* CustomerDefaultAddressUpdatePayload.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomerDefaultAddressUpdatePayload.swift; sourceTree = "<group>"; };
9A43489A20C84A56005EAD56 /* CheckoutDiscountCodeRemovePayload.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CheckoutDiscountCodeRemovePayload.swift; sourceTree = "<group>"; };
9A49DC821EC4AD580053710B /* Header.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Header.swift; sourceTree = "<group>"; };
9A52D3A01F3CA58E00C093C8 /* ProductImageSortKeys.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductImageSortKeys.swift; sourceTree = "<group>"; };
9A52D3A11F3CA58E00C093C8 /* CardBrand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CardBrand.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -792,6 +796,7 @@
9A0C80051EAA51C50020F187 /* CheckoutCustomerAssociatePayload.swift */,
9A0C80061EAA51C50020F187 /* CheckoutCustomerDisassociatePayload.swift */,
9A41E2A51F85096B0059485A /* CheckoutDiscountCodeApplyPayload.swift */,
9A43489A20C84A56005EAD56 /* CheckoutDiscountCodeRemovePayload.swift */,
9A0C80071EAA51C50020F187 /* CheckoutEmailUpdatePayload.swift */,
9A0C80081EAA51C50020F187 /* CheckoutGiftCardApplyPayload.swift */,
9A0C80091EAA51C50020F187 /* CheckoutGiftCardRemovePayload.swift */,
Expand Down Expand Up @@ -1485,6 +1490,7 @@
9AC2EF551F6818180037E0D7 /* CheckoutGiftCardRemovePayload.swift in Sources */,
9AC2EF561F6818180037E0D7 /* CheckoutCompleteFreePayload.swift in Sources */,
9AC2EF571F6818180037E0D7 /* DigitalWallet.swift in Sources */,
9A43489C20C84A56005EAD56 /* CheckoutDiscountCodeRemovePayload.swift in Sources */,
9AC2EF581F6818180037E0D7 /* MailingAddressInput.swift in Sources */,
9AC2EF591F6818180037E0D7 /* CustomerRecoverPayload.swift in Sources */,
9AC2EF5A1F6818180037E0D7 /* PaymentSettings.swift in Sources */,
Expand Down Expand Up @@ -1634,6 +1640,7 @@
9A0C80681EAA51C50020F187 /* CheckoutGiftCardRemovePayload.swift in Sources */,
9A0C805F1EAA51C50020F187 /* CheckoutCompleteFreePayload.swift in Sources */,
9A52D3A51F3CA5DB00C093C8 /* DigitalWallet.swift in Sources */,
9A43489B20C84A56005EAD56 /* CheckoutDiscountCodeRemovePayload.swift in Sources */,
9A0C80941EAA51C50020F187 /* MailingAddressInput.swift in Sources */,
9A0C80881EAA51C50020F187 /* CustomerRecoverPayload.swift in Sources */,
9AF1C1881F13B45C0064AEA0 /* PaymentSettings.swift in Sources */,
Expand Down Expand Up @@ -1783,6 +1790,7 @@
9AF255CF1F6FEE50005BB0C9 /* CheckoutGiftCardRemovePayload.swift in Sources */,
9AF255D01F6FEE50005BB0C9 /* CheckoutCompleteFreePayload.swift in Sources */,
9AF255D11F6FEE50005BB0C9 /* DigitalWallet.swift in Sources */,
9A43489D20C84A56005EAD56 /* CheckoutDiscountCodeRemovePayload.swift in Sources */,
9AF255D21F6FEE50005BB0C9 /* MailingAddressInput.swift in Sources */,
9AF255D31F6FEE50005BB0C9 /* CustomerRecoverPayload.swift in Sources */,
9AF255D41F6FEE50005BB0C9 /* PaymentSettings.swift in Sources */,
Expand Down Expand Up @@ -1954,11 +1962,11 @@
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "";
CURRENT_PROJECT_VERSION = 3.1.6;
CURRENT_PROJECT_VERSION = 3.1.7;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 3.1.6;
DYLIB_CURRENT_VERSION = 3.1.7;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Pay/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
Expand All @@ -1979,11 +1987,11 @@
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "";
CURRENT_PROJECT_VERSION = 3.1.6;
CURRENT_PROJECT_VERSION = 3.1.7;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 3.1.6;
DYLIB_CURRENT_VERSION = 3.1.7;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Pay/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
Expand Down Expand Up @@ -2032,11 +2040,11 @@
CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=watchos*]" = "";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3.1.6;
CURRENT_PROJECT_VERSION = 3.1.7;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 3.1.6;
DYLIB_CURRENT_VERSION = 3.1.7;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Buy/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
Expand All @@ -2059,11 +2067,11 @@
CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=watchos*]" = "";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3.1.6;
CURRENT_PROJECT_VERSION = 3.1.7;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 3.1.6;
DYLIB_CURRENT_VERSION = 3.1.7;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Buy/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
Expand Down Expand Up @@ -2198,11 +2206,11 @@
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "";
CURRENT_PROJECT_VERSION = 3.1.6;
CURRENT_PROJECT_VERSION = 3.1.7;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 3.1.6;
DYLIB_CURRENT_VERSION = 3.1.7;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Buy/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
Expand All @@ -2220,11 +2228,11 @@
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "";
CURRENT_PROJECT_VERSION = 3.1.6;
CURRENT_PROJECT_VERSION = 3.1.7;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 3.1.6;
DYLIB_CURRENT_VERSION = 3.1.7;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Buy/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
Expand All @@ -2243,11 +2251,11 @@
CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=watchos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3.1.6;
CURRENT_PROJECT_VERSION = 3.1.7;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 3.1.6;
DYLIB_CURRENT_VERSION = 3.1.7;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Buy/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
Expand All @@ -2272,11 +2280,11 @@
CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=watchos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3.1.6;
CURRENT_PROJECT_VERSION = 3.1.7;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 3.1.6;
DYLIB_CURRENT_VERSION = 3.1.7;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Buy/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
Expand Down
4 changes: 4 additions & 0 deletions Buy/Client/Graph.Task.swift
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ internal extension Graph {
let (model, error) = self.processResponse(data, response, error)

DispatchQueue.main.async {
guard self.isCancelled == false else {
return
}

if var retryHandler = retryHandler, retryHandler.canRetry, retryHandler.condition(model, error) == true {

/* ---------------------------------
Expand Down
119 changes: 119 additions & 0 deletions Buy/Generated/Storefront/CheckoutDiscountCodeRemovePayload.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
//
// CheckoutDiscountCodeRemovePayload.swift
// Buy
//
// Created by Shopify.
// Copyright (c) 2017 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

import Foundation

extension Storefront {
open class CheckoutDiscountCodeRemovePayloadQuery: GraphQL.AbstractQuery, GraphQLQuery {
public typealias Response = CheckoutDiscountCodeRemovePayload

/// The updated checkout object.
@discardableResult
open func checkout(alias: String? = nil, _ subfields: (CheckoutQuery) -> Void) -> CheckoutDiscountCodeRemovePayloadQuery {
let subquery = CheckoutQuery()
subfields(subquery)

addField(field: "checkout", aliasSuffix: alias, subfields: subquery)
return self
}

/// List of errors that occurred executing the mutation.
@discardableResult
open func userErrors(alias: String? = nil, _ subfields: (UserErrorQuery) -> Void) -> CheckoutDiscountCodeRemovePayloadQuery {
let subquery = UserErrorQuery()
subfields(subquery)

addField(field: "userErrors", aliasSuffix: alias, subfields: subquery)
return self
}
}

open class CheckoutDiscountCodeRemovePayload: GraphQL.AbstractResponse, GraphQLObject {
public typealias Query = CheckoutDiscountCodeRemovePayloadQuery

internal override func deserializeValue(fieldName: String, value: Any) throws -> Any? {
let fieldValue = value
switch fieldName {
case "checkout":
if value is NSNull { return nil }
guard let value = value as? [String: Any] else {
throw SchemaViolationError(type: CheckoutDiscountCodeRemovePayload.self, field: fieldName, value: fieldValue)
}
return try Checkout(fields: value)

case "userErrors":
guard let value = value as? [[String: Any]] else {
throw SchemaViolationError(type: CheckoutDiscountCodeRemovePayload.self, field: fieldName, value: fieldValue)
}
return try value.map { return try UserError(fields: $0) }

default:
throw SchemaViolationError(type: CheckoutDiscountCodeRemovePayload.self, field: fieldName, value: fieldValue)
}
}

/// The updated checkout object.
open var checkout: Storefront.Checkout? {
return internalGetCheckout()
}

func internalGetCheckout(alias: String? = nil) -> Storefront.Checkout? {
return field(field: "checkout", aliasSuffix: alias) as! Storefront.Checkout?
}

/// List of errors that occurred executing the mutation.
open var userErrors: [Storefront.UserError] {
return internalGetUserErrors()
}

func internalGetUserErrors(alias: String? = nil) -> [Storefront.UserError] {
return field(field: "userErrors", aliasSuffix: alias) as! [Storefront.UserError]
}

internal override func childResponseObjectMap() -> [GraphQL.AbstractResponse] {
var response: [GraphQL.AbstractResponse] = []
objectMap.keys.forEach {
switch($0) {
case "checkout":
if let value = internalGetCheckout() {
response.append(value)
response.append(contentsOf: value.childResponseObjectMap())
}

case "userErrors":
internalGetUserErrors().forEach {
response.append($0)
response.append(contentsOf: $0.childResponseObjectMap())
}

default:
break
}
}
return response
}
}
}
3 changes: 3 additions & 0 deletions Buy/Generated/Storefront/CurrencyCode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ extension Storefront {
/// Indian Rupees (INR)
case inr = "INR"

/// Iraqi Dinar (IQD)
case iqd = "IQD"

/// Icelandic Kronur (ISK)
case isk = "ISK"

Expand Down
46 changes: 46 additions & 0 deletions Buy/Generated/Storefront/Mutation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,26 @@ extension Storefront {
return self
}

/// Removes the applied discount from an existing checkout.
///
/// - parameters:
/// - checkoutId: The ID of the checkout.
///
@discardableResult
open func checkoutDiscountCodeRemove(alias: String? = nil, checkoutId: GraphQL.ID, _ subfields: (CheckoutDiscountCodeRemovePayloadQuery) -> Void) -> MutationQuery {
var args: [String] = []

args.append("checkoutId:\(GraphQL.quoteString(input: "\(checkoutId.rawValue)"))")

let argsString = "(\(args.joined(separator: ",")))"

let subquery = CheckoutDiscountCodeRemovePayloadQuery()
subfields(subquery)

addField(field: "checkoutDiscountCodeRemove", aliasSuffix: alias, args: argsString, subfields: subquery)
return self
}

/// Updates the email on an existing checkout.
///
/// - parameters:
Expand Down Expand Up @@ -727,6 +747,13 @@ extension Storefront {
}
return try CheckoutDiscountCodeApplyPayload(fields: value)

case "checkoutDiscountCodeRemove":
if value is NSNull { return nil }
guard let value = value as? [String: Any] else {
throw SchemaViolationError(type: Mutation.self, field: fieldName, value: fieldValue)
}
return try CheckoutDiscountCodeRemovePayload(fields: value)

case "checkoutEmailUpdate":
if value is NSNull { return nil }
guard let value = value as? [String: Any] else {
Expand Down Expand Up @@ -975,6 +1002,19 @@ extension Storefront {
return field(field: "checkoutDiscountCodeApply", aliasSuffix: alias) as! Storefront.CheckoutDiscountCodeApplyPayload?
}

/// Removes the applied discount from an existing checkout.
open var checkoutDiscountCodeRemove: Storefront.CheckoutDiscountCodeRemovePayload? {
return internalGetCheckoutDiscountCodeRemove()
}

open func aliasedCheckoutDiscountCodeRemove(alias: String) -> Storefront.CheckoutDiscountCodeRemovePayload? {
return internalGetCheckoutDiscountCodeRemove(alias: alias)
}

func internalGetCheckoutDiscountCodeRemove(alias: String? = nil) -> Storefront.CheckoutDiscountCodeRemovePayload? {
return field(field: "checkoutDiscountCodeRemove", aliasSuffix: alias) as! Storefront.CheckoutDiscountCodeRemovePayload?
}

/// Updates the email on an existing checkout.
open var checkoutEmailUpdate: Storefront.CheckoutEmailUpdatePayload? {
return internalGetCheckoutEmailUpdate()
Expand Down Expand Up @@ -1291,6 +1331,12 @@ extension Storefront {
response.append(contentsOf: value.childResponseObjectMap())
}

case "checkoutDiscountCodeRemove":
if let value = internalGetCheckoutDiscountCodeRemove() {
response.append(value)
response.append(contentsOf: value.childResponseObjectMap())
}

case "checkoutEmailUpdate":
if let value = internalGetCheckoutEmailUpdate() {
response.append(value)
Expand Down
Loading

0 comments on commit 7818271

Please sign in to comment.