Skip to content

Commit

Permalink
Revert to using the undefined dictionary and include an example of a …
Browse files Browse the repository at this point in the history
…dictionary with the webhook session ID parameter in the Example App (#70)

*Update the usage of webhook_session_id
Co-authored-by: Victor Zhu <[email protected]>
  • Loading branch information
hoyelo authored Mar 13, 2020
1 parent e7e0b85 commit 3c005a2
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 159 deletions.
6 changes: 0 additions & 6 deletions AffirmSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
0841E335223A9948006D8B97 /* AffirmConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 0841E333223A9948006D8B97 /* AffirmConstants.m */; };
0876CA2B22FA6804006F8062 /* AffirmReasonCode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0876CA2922FA6803006F8062 /* AffirmReasonCode.h */; settings = {ATTRIBUTES = (Public, ); }; };
0876CA2C22FA6804006F8062 /* AffirmReasonCode.m in Sources */ = {isa = PBXBuildFile; fileRef = 0876CA2A22FA6803006F8062 /* AffirmReasonCode.m */; };
0885F17423D8419F00123729 /* AffirmCheckoutMetadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 0885F17223D8419F00123729 /* AffirmCheckoutMetadata.h */; settings = {ATTRIBUTES = (Public, ); }; };
08A4D3EB23264FE0003A4BEB /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 08A4D3EA23264FE0003A4BEB /* README.md */; };
08A81F49223F986D00FAA8D2 /* AffirmClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 08A81F47223F986D00FAA8D2 /* AffirmClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
08A81F4A223F986D00FAA8D2 /* AffirmClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 08A81F48223F986D00FAA8D2 /* AffirmClient.m */; };
Expand Down Expand Up @@ -103,8 +102,6 @@
0841E333223A9948006D8B97 /* AffirmConstants.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AffirmConstants.m; sourceTree = "<group>"; };
0876CA2922FA6803006F8062 /* AffirmReasonCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AffirmReasonCode.h; sourceTree = "<group>"; };
0876CA2A22FA6803006F8062 /* AffirmReasonCode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AffirmReasonCode.m; sourceTree = "<group>"; };
0885F17223D8419F00123729 /* AffirmCheckoutMetadata.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AffirmCheckoutMetadata.h; sourceTree = "<group>"; };
0885F17323D8419F00123729 /* AffirmCheckoutMetadata.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AffirmCheckoutMetadata.m; sourceTree = "<group>"; };
08A4D3EA23264FE0003A4BEB /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
08A81F47223F986D00FAA8D2 /* AffirmClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AffirmClient.h; sourceTree = "<group>"; };
08A81F48223F986D00FAA8D2 /* AffirmClient.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AffirmClient.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -252,8 +249,6 @@
7965AB35223656680063198F /* AffirmSDK.bundle */,
0827FF892325EB9200AEC14C /* AffirmDataHandler.h */,
0827FF8A2325EB9200AEC14C /* AffirmDataHandler.m */,
0885F17223D8419F00123729 /* AffirmCheckoutMetadata.h */,
0885F17323D8419F00123729 /* AffirmCheckoutMetadata.m */,
);
path = AffirmSDK;
sourceTree = "<group>";
Expand Down Expand Up @@ -297,7 +292,6 @@
0876CA2B22FA6804006F8062 /* AffirmReasonCode.h in Headers */,
0827FF8B2325EB9200AEC14C /* AffirmDataHandler.h in Headers */,
7944D9C12248A84D0040525E /* AffirmUtils.h in Headers */,
0885F17423D8419F00123729 /* AffirmCheckoutMetadata.h in Headers */,
7944D9B72240E2250040525E /* AffirmLogger.h in Headers */,
7944D9932240BF830040525E /* AffirmActivityIndicatorView.h in Headers */,
79088B512238DB840059D691 /* AffirmPromoModalViewController.h in Headers */,
Expand Down
18 changes: 9 additions & 9 deletions AffirmSDK/AffirmCheckout.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
@class AffirmDiscount;
@class AffirmShippingDetail;
@class AffirmBillingDetail;
@class AffirmCheckoutMetadata;

NS_ASSUME_NONNULL_BEGIN

Expand Down Expand Up @@ -63,7 +62,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
Additional metadata for the checkout. Optional.
*/
@property (nonatomic, copy, readonly, nullable) AffirmCheckoutMetadata *metadata;
@property (nonatomic, copy, readonly, nullable) NSDictionary *metadata;

/**
The total amount. Dynamically computed from the other properties of the checkout if not available
Expand Down Expand Up @@ -102,7 +101,7 @@ NS_ASSUME_NONNULL_BEGIN
taxAmount:(NSDecimalNumber *)taxAmount
shippingAmount:(NSDecimalNumber *)shippingAmount
discounts:(nullable NSArray <AffirmDiscount *>*)discounts
metadata:(nullable AffirmCheckoutMetadata *)metadata
metadata:(nullable NSDictionary *)metadata
financingProgram:(nullable NSString *)financingProgram
NS_SWIFT_NAME(init(items:shipping:taxAmount:shippingAmount:discounts:metadata:financingProgram:));

Expand All @@ -124,7 +123,7 @@ NS_SWIFT_NAME(init(items:shipping:taxAmount:shippingAmount:discounts:metadata:fi
taxAmount:(NSDecimalNumber *)taxAmount
shippingAmount:(NSDecimalNumber *)shippingAmount
discounts:(nullable NSArray <AffirmDiscount *>*)discounts
metadata:(nullable AffirmCheckoutMetadata *)metadata
metadata:(nullable NSDictionary *)metadata
financingProgram:(nullable NSString *)financingProgram
orderId:(nullable NSString *)orderId
NS_SWIFT_NAME(init(items:shipping:taxAmount:shippingAmount:discounts:metadata:financingProgram:orderId:));
Expand Down Expand Up @@ -163,7 +162,7 @@ NS_SWIFT_NAME(checkout(items:shipping:taxAmount:shippingAmount:financingProgram:
taxAmount:(NSDecimalNumber *)taxAmount
shippingAmount:(NSDecimalNumber *)shippingAmount
discounts:(nullable NSArray <AffirmDiscount *>*)discounts
metadata:(nullable AffirmCheckoutMetadata *)metadata
metadata:(nullable NSDictionary *)metadata
financingProgram:(nullable NSString *)financingProgram
NS_SWIFT_NAME(checkout(items:shipping:taxAmount:shippingAmount:discounts:metadata:financingProgram:));

Expand Down Expand Up @@ -198,7 +197,7 @@ NS_SWIFT_NAME(checkout(items:shipping:taxAmount:shippingAmount:));
taxAmount:(NSDecimalNumber *)taxAmount
shippingAmount:(NSDecimalNumber *)shippingAmount
discounts:(nullable NSArray <AffirmDiscount *>*)discounts
metadata:(nullable AffirmCheckoutMetadata *)metadata
metadata:(nullable NSDictionary *)metadata
NS_SWIFT_NAME(checkout(items:shipping:taxAmount:shippingAmount:discounts:metadata:));

/**
Expand All @@ -215,7 +214,7 @@ NS_SWIFT_NAME(checkout(items:shipping:taxAmount:shippingAmount:discounts:metadat
- (instancetype)initWithItems:(NSArray <AffirmItem *>*)items
shipping:(nullable AffirmShippingDetail *)shipping
discounts:(nullable NSArray <AffirmDiscount *>*)discounts
metadata:(nullable AffirmCheckoutMetadata *)metadata
metadata:(nullable NSDictionary *)metadata
financingProgram:(nullable NSString *)financingProgram
payoutAmount:(NSDecimalNumber *)payoutAmount API_DEPRECATED("Use initWithItems:shipping:discounts:metadata:financingProgram:totalAmount: instead.", ios(2.0, 13.0))
NS_SWIFT_NAME(init(items:shipping:discounts:metadata:financingProgram:payoutAmount:));
Expand All @@ -234,7 +233,7 @@ NS_SWIFT_NAME(init(items:shipping:discounts:metadata:financingProgram:payoutAmou
- (instancetype)initWithItems:(NSArray <AffirmItem *>*)items
shipping:(nullable AffirmShippingDetail *)shipping
discounts:(nullable NSArray <AffirmDiscount *>*)discounts
metadata:(nullable AffirmCheckoutMetadata *)metadata
metadata:(nullable NSDictionary *)metadata
financingProgram:(nullable NSString *)financingProgram
totalAmount:(NSDecimalNumber *)totalAmount
NS_SWIFT_NAME(init(items:shipping:discounts:metadata:financingProgram:totalAmount:));
Expand Down Expand Up @@ -277,8 +276,9 @@ NS_SWIFT_NAME(checkout(items:shipping:totalAmount:));
+ (AffirmCheckout *)checkoutWithItems:(NSArray <AffirmItem *>*)items
shipping:(nullable AffirmShippingDetail *)shipping
totalAmount:(NSDecimalNumber *)totalAmount
metadata:(nullable AffirmCheckoutMetadata *)metadata
metadata:(nullable NSDictionary *)metadata
NS_SWIFT_NAME(checkout(items:shipping:totalAmount:metadata:));

@end

NS_ASSUME_NONNULL_END
21 changes: 10 additions & 11 deletions AffirmSDK/AffirmCheckout.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#import "AffirmShippingDetail.h"
#import "AffirmBillingDetail.h"
#import "AffirmLogger.h"
#import "AffirmCheckoutMetadata.h"

@implementation AffirmCheckout

Expand All @@ -23,7 +22,7 @@ - (instancetype)initWithItems:(NSArray <AffirmItem *>*)items
taxAmount:(NSDecimalNumber *)taxAmount
shippingAmount:(NSDecimalNumber *)shippingAmount
discounts:(nullable NSArray <AffirmDiscount *>*)discounts
metadata:(nullable AffirmCheckoutMetadata *)metadata
metadata:(nullable NSDictionary *)metadata
financingProgram:(nullable NSString *)financingProgram
{
[AffirmValidationUtils checkNotNil:items name:@"items"];
Expand All @@ -38,7 +37,7 @@ - (instancetype)initWithItems:(NSArray <AffirmItem *>*)items
_taxAmount = [taxAmount copy];
_shippingAmount = [shippingAmount copy];
_discounts = (discounts) ? [[NSArray alloc] initWithArray:discounts copyItems:YES] : nil;
_metadata = (metadata) ? [metadata copy] : nil;
_metadata = (metadata) ? [[NSDictionary alloc] initWithDictionary:metadata copyItems:YES] : nil;
_financingProgram = (financingProgram) ? [financingProgram copy] : nil;
_orderId = nil;
_sendShippingAddress = YES;
Expand All @@ -51,7 +50,7 @@ - (instancetype)initWithItems:(NSArray <AffirmItem *>*)items
taxAmount:(NSDecimalNumber *)taxAmount
shippingAmount:(NSDecimalNumber *)shippingAmount
discounts:(nullable NSArray <AffirmDiscount *>*)discounts
metadata:(nullable AffirmCheckoutMetadata *)metadata
metadata:(nullable NSDictionary *)metadata
financingProgram:(nullable NSString *)financingProgram
orderId:(nullable NSString *)orderId
{
Expand All @@ -67,7 +66,7 @@ - (instancetype)initWithItems:(NSArray <AffirmItem *>*)items
_taxAmount = [taxAmount copy];
_shippingAmount = [shippingAmount copy];
_discounts = discounts ? [[NSArray alloc] initWithArray:discounts copyItems:YES] : nil;
_metadata = metadata ? [metadata copy] : nil;
_metadata = metadata ? [[NSDictionary alloc] initWithDictionary:metadata copyItems:YES] : nil;
_financingProgram = financingProgram ? [financingProgram copy] : nil;
_orderId = orderId ? [orderId copy] : nil;
_sendShippingAddress = YES;
Expand Down Expand Up @@ -109,7 +108,7 @@ + (AffirmCheckout *)checkoutWithItems:(NSArray <AffirmItem *>*)items
taxAmount:(NSDecimalNumber *)taxAmount
shippingAmount:(NSDecimalNumber *)shippingAmount
discounts:(nullable NSArray <AffirmDiscount *>*)discounts
metadata:(nullable AffirmCheckoutMetadata *)metadata
metadata:(nullable NSDictionary *)metadata
{
return [self checkoutWithItems:items
shipping:shipping
Expand All @@ -125,7 +124,7 @@ + (AffirmCheckout *)checkoutWithItems:(NSArray <AffirmItem *>*)items
taxAmount:(NSDecimalNumber *)taxAmount
shippingAmount:(NSDecimalNumber *)shippingAmount
discounts:(nullable NSArray <AffirmDiscount *>*)discounts
metadata:(nullable AffirmCheckoutMetadata *)metadata
metadata:(nullable NSDictionary *)metadata
financingProgram:(nullable NSString *)financingProgram
{
return [[self alloc] initWithItems:items
Expand All @@ -140,7 +139,7 @@ + (AffirmCheckout *)checkoutWithItems:(NSArray <AffirmItem *>*)items
- (instancetype)initWithItems:(NSArray <AffirmItem *>*)items
shipping:(nullable AffirmShippingDetail *)shipping
discounts:(nullable NSArray <AffirmDiscount *>*)discounts
metadata:(nullable AffirmCheckoutMetadata *)metadata
metadata:(nullable NSDictionary *)metadata
financingProgram:(nullable NSString *)financingProgram
payoutAmount:(NSDecimalNumber *)payoutAmount
{
Expand All @@ -162,7 +161,7 @@ - (instancetype)initWithItems:(NSArray <AffirmItem *>*)items
- (instancetype)initWithItems:(NSArray <AffirmItem *>*)items
shipping:(nullable AffirmShippingDetail *)shipping
discounts:(nullable NSArray <AffirmDiscount *>*)discounts
metadata:(nullable AffirmCheckoutMetadata *)metadata
metadata:(nullable NSDictionary *)metadata
financingProgram:(nullable NSString *)financingProgram
totalAmount:(NSDecimalNumber *)totalAmount
{
Expand Down Expand Up @@ -208,7 +207,7 @@ + (AffirmCheckout *)checkoutWithItems:(NSArray <AffirmItem *>*)items
+ (AffirmCheckout *)checkoutWithItems:(NSArray <AffirmItem *>*)items
shipping:(nullable AffirmShippingDetail *)shipping
totalAmount:(NSDecimalNumber *)totalAmount
metadata:(nullable AffirmCheckoutMetadata *)metadata
metadata:(nullable NSDictionary *)metadata
{
return [[self alloc] initWithItems:items
shipping:shipping
Expand Down Expand Up @@ -294,7 +293,7 @@ - (NSDictionary *)toJSONDictionary
}

if (self.metadata != nil) {
[dict setObject:[self.metadata toJSONDictionary] forKey:@"metadata"];
[dict setObject:self.metadata forKey:@"metadata"];
}

if (self.financingProgram != nil) {
Expand Down
59 changes: 0 additions & 59 deletions AffirmSDK/AffirmCheckoutMetadata.h

This file was deleted.

57 changes: 0 additions & 57 deletions AffirmSDK/AffirmCheckoutMetadata.m

This file was deleted.

1 change: 0 additions & 1 deletion AffirmSDK/AffirmSDK.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ FOUNDATION_EXPORT const unsigned char AffirmSDKVersionString[];
#import <AffirmSDK/AffirmItem.h>
#import <AffirmSDK/AffirmShippingDetail.h>
#import <AffirmSDK/AffirmBillingDetail.h>
#import <AffirmSDK/AffirmCheckoutMetadata.h>
#import <AffirmSDK/AffirmDiscount.h>
#import <AffirmSDK/AffirmOrder.h>
#import <AffirmSDK/AffirmProduct.h>
Expand Down
18 changes: 4 additions & 14 deletions Examples/Examples.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -354,16 +354,11 @@
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-ExamplesSwift/Pods-ExamplesSwift-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/AffirmSDK/AffirmSDK.framework",
"${PODS_ROOT}/Target Support Files/Pods-ExamplesSwift/Pods-ExamplesSwift-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
);
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AffirmSDK.framework",
"${PODS_ROOT}/Target Support Files/Pods-ExamplesSwift/Pods-ExamplesSwift-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand All @@ -376,16 +371,11 @@
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Examples/Pods-Examples-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/AffirmSDK/AffirmSDK.framework",
"${PODS_ROOT}/Target Support Files/Pods-Examples/Pods-Examples-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
);
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AffirmSDK.framework",
"${PODS_ROOT}/Target Support Files/Pods-Examples/Pods-Examples-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down
Loading

0 comments on commit 3c005a2

Please sign in to comment.