Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
1.7.17 (August 31, 2017)
=====================
* Removes the legacy payments API, which was recently removed from the CloudMine platform
* Prevents the SDK from throwing-then-catching internal errors when decoding non-CMObject
nested types. This should make breakpoint debugging easier for developers using the SDK.

1.7.16 (July 20, 2017)
=====================
Adds CMFileMetadata class, a first-class object for interacting with metadata
Expand Down
42 changes: 3 additions & 39 deletions ios/cloudmine-ios.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@
AA0351A01992AD6A00A3027E /* CMSocialAccountChooserSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = AA03519F1992AD6A00A3027E /* CMSocialAccountChooserSpec.m */; };
AA095166194B6C09008602DB /* CMAPICredentialsSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = AA095165194B6C09008602DB /* CMAPICredentialsSpec.m */; };
AA095168194B6CB4008602DB /* CMAppDelegateBaseSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = AA095167194B6CB4008602DB /* CMAppDelegateBaseSpec.m */; };
AA09516D194B7AA7008602DB /* CMPaymentServiceSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = AA09516C194B7AA7008602DB /* CMPaymentServiceSpec.m */; };
AA104FE8196326D70043C141 /* TestUser.m in Sources */ = {isa = PBXBuildFile; fileRef = AA104FE7196326D70043C141 /* TestUser.m */; };
AA5693C31901790300C4A15A /* CMConstants.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = AA5693C21901790300C4A15A /* CMConstants.h */; };
AA5693C71902E90500C4A15A /* CMTestEncoder.m in Sources */ = {isa = PBXBuildFile; fileRef = AA5693C61902E90500C4A15A /* CMTestEncoder.m */; };
Expand All @@ -155,12 +154,6 @@
AA9528D4194B422800AEB90D /* CMNullStoreSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = AA9528D3194B422800AEB90D /* CMNullStoreSpec.m */; };
AA9927C0195C7DBF00C46F02 /* Accounts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA9927BF195C7DBF00C46F02 /* Accounts.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
AA9927C2195C7DC700C46F02 /* Social.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA9927C1195C7DC700C46F02 /* Social.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
AAA05FB9183A756B009652C9 /* CMPaymentService.m in Sources */ = {isa = PBXBuildFile; fileRef = AAA05FB3183A756B009652C9 /* CMPaymentService.m */; };
AAA05FBB183A756B009652C9 /* CMPaymentService.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = AAA05FB4183A756B009652C9 /* CMPaymentService.h */; };
AAA05FBC183A756B009652C9 /* CMCardPayment.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = AAA05FB5183A756B009652C9 /* CMCardPayment.h */; };
AAA05FBD183A756B009652C9 /* CMPaymentResponse.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = AAA05FB6183A756B009652C9 /* CMPaymentResponse.h */; };
AAA05FBE183A756B009652C9 /* CMCardPayment.m in Sources */ = {isa = PBXBuildFile; fileRef = AAA05FB7183A756B009652C9 /* CMCardPayment.m */; };
AAA05FC0183A756B009652C9 /* CMPaymentResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = AAA05FB8183A756B009652C9 /* CMPaymentResponse.m */; };
AAA102D519265AEC00A11BC4 /* CMObjectIntegrationSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = AAA102D419265AEC00A11BC4 /* CMObjectIntegrationSpec.m */; };
AAA850ED168271B600C18957 /* CMDeviceTokenResult.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = AAA850EC168271B500C18957 /* CMDeviceTokenResult.h */; };
AAA92FF3181966370064F773 /* NSDictionary+CMJSON.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = AAA92FF1181966370064F773 /* NSDictionary+CMJSON.h */; };
Expand Down Expand Up @@ -226,7 +219,6 @@
AAC1D8FA16DD5B34002A7DC0 /* CMChannelResponse.h in CopyFiles */,
AAB2E0B4167BA05700D2C699 /* CMAppDelegateBase.h in CopyFiles */,
715217581653F5C4007FB0A9 /* CMSocialLoginViewController.h in CopyFiles */,
AAA05FBB183A756B009652C9 /* CMPaymentService.h in CopyFiles */,
D03A4D5C15B48D2200A956BC /* CMACLFetchResponse.h in CopyFiles */,
7AF00BA215A8DC7C0070442A /* CMACL.h in CopyFiles */,
AA5C4632190C19990086FBD6 /* CMCoding.h in CopyFiles */,
Expand Down Expand Up @@ -270,9 +262,7 @@
7A87315714BB0AD0000D6DEA /* CMWebService.h in CopyFiles */,
7A87315914BB0AD0000D6DEA /* CMAPICredentials.h in CopyFiles */,
7A87315A14BB0AD0000D6DEA /* CMServerFunction.h in CopyFiles */,
AAA05FBC183A756B009652C9 /* CMCardPayment.h in CopyFiles */,
7A87315B14BB0AD0000D6DEA /* CMSerializable.h in CopyFiles */,
AAA05FBD183A756B009652C9 /* CMPaymentResponse.h in CopyFiles */,
AAA850ED168271B600C18957 /* CMDeviceTokenResult.h in CopyFiles */,
AA5693C31901790300C4A15A /* CMConstants.h in CopyFiles */,
AA00CED21886E1C700F9958C /* UIImageView+CloudMine.h in CopyFiles */,
Expand Down Expand Up @@ -401,7 +391,6 @@
AA03519F1992AD6A00A3027E /* CMSocialAccountChooserSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CMSocialAccountChooserSpec.m; sourceTree = "<group>"; };
AA095165194B6C09008602DB /* CMAPICredentialsSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CMAPICredentialsSpec.m; sourceTree = "<group>"; };
AA095167194B6CB4008602DB /* CMAppDelegateBaseSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CMAppDelegateBaseSpec.m; sourceTree = "<group>"; };
AA09516C194B7AA7008602DB /* CMPaymentServiceSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CMPaymentServiceSpec.m; sourceTree = "<group>"; };
AA104FE6196326D70043C141 /* TestUser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestUser.h; sourceTree = "<group>"; };
AA104FE7196326D70043C141 /* TestUser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestUser.m; sourceTree = "<group>"; };
AA4DE2BA1A6972A600888CB2 /* CMTestMacros.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CMTestMacros.h; sourceTree = "<group>"; };
Expand All @@ -425,12 +414,6 @@
AA9528D3194B422800AEB90D /* CMNullStoreSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CMNullStoreSpec.m; sourceTree = "<group>"; };
AA9927BF195C7DBF00C46F02 /* Accounts.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accounts.framework; path = System/Library/Frameworks/Accounts.framework; sourceTree = SDKROOT; };
AA9927C1195C7DC700C46F02 /* Social.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Social.framework; path = System/Library/Frameworks/Social.framework; sourceTree = SDKROOT; };
AAA05FB3183A756B009652C9 /* CMPaymentService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CMPaymentService.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
AAA05FB4183A756B009652C9 /* CMPaymentService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CMPaymentService.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
AAA05FB5183A756B009652C9 /* CMCardPayment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CMCardPayment.h; sourceTree = "<group>"; };
AAA05FB6183A756B009652C9 /* CMPaymentResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CMPaymentResponse.h; sourceTree = "<group>"; };
AAA05FB7183A756B009652C9 /* CMCardPayment.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CMCardPayment.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
AAA05FB8183A756B009652C9 /* CMPaymentResponse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CMPaymentResponse.m; sourceTree = "<group>"; };
AAA102D419265AEC00A11BC4 /* CMObjectIntegrationSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CMObjectIntegrationSpec.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
AAA850EC168271B500C18957 /* CMDeviceTokenResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CMDeviceTokenResult.h; sourceTree = "<group>"; };
AAA92FF1181966370064F773 /* NSDictionary+CMJSON.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+CMJSON.h"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -756,7 +739,6 @@
7AD36F7B146C64F300DD4734 /* Web Services */ = {
isa = PBXGroup;
children = (
AAA05FB2183A7558009652C9 /* Payment */,
AAB2E0A8167B935C00D2C699 /* Push Notifications */,
71E886B3165161050060C217 /* Social Login */,
7AABA2FA14818DCA00FD52A0 /* Decoding */,
Expand Down Expand Up @@ -879,7 +861,6 @@
7AD9221F14CF5B9B0032DDDE /* CMPagingDescriptorSpec.m */,
7AD9222514D06EB10032DDDE /* CMStoreOptionsSpec.m */,
7A766208156307DF009840EE /* CMSortDescriptorSpec.m */,
AA09516C194B7AA7008602DB /* CMPaymentServiceSpec.m */,
AA03519F1992AD6A00A3027E /* CMSocialAccountChooserSpec.m */,
AA5EB16C1A3FEB300081DAC1 /* Bugs */,
);
Expand Down Expand Up @@ -909,19 +890,6 @@
name = Bugs;
sourceTree = "<group>";
};
AAA05FB2183A7558009652C9 /* Payment */ = {
isa = PBXGroup;
children = (
AAA05FB4183A756B009652C9 /* CMPaymentService.h */,
AAA05FB3183A756B009652C9 /* CMPaymentService.m */,
AAA05FB5183A756B009652C9 /* CMCardPayment.h */,
AAA05FB7183A756B009652C9 /* CMCardPayment.m */,
AAA05FB6183A756B009652C9 /* CMPaymentResponse.h */,
AAA05FB8183A756B009652C9 /* CMPaymentResponse.m */,
);
name = Payment;
sourceTree = "<group>";
};
AAA92FEB181965F80064F773 /* JSON */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1215,7 +1183,6 @@
7A7E31C914C88F8A0091F1E3 /* CMStore.m in Sources */,
7AD9221D14CF47360032DDDE /* CMPagingDescriptor.m in Sources */,
7AD9222414D06B9A0032DDDE /* CMStoreOptions.m in Sources */,
AAA05FC0183A756B009652C9 /* CMPaymentResponse.m in Sources */,
B4AD7C581C80FF6D00D9F1D1 /* RTUnregisteredClass.m in Sources */,
7A58CC2214F1B544003E864B /* CMMimeType.m in Sources */,
7AE2848B1562C3C8003E8A8F /* CMSortDescriptor.m in Sources */,
Expand All @@ -1240,12 +1207,10 @@
7AFDFE46158E959B00388D6E /* CMObjectClassNameRegistry.m in Sources */,
7AFDFE47158E959B00388D6E /* CMUntypedObject.m in Sources */,
7A0D7CFC1581479000C7C476 /* CMNullStore.m in Sources */,
AAA05FBE183A756B009652C9 /* CMCardPayment.m in Sources */,
7AFDFE4A158E965400388D6E /* CMActiveUser.m in Sources */,
7AF00BA015A8DC650070442A /* CMACL.m in Sources */,
B4C114D11DA2CF2B00414F35 /* CMLegacyCacheCleaner.m in Sources */,
B4AD7C521C80FF6D00D9F1D1 /* MARTNSObject.m in Sources */,
AAA05FB9183A756B009652C9 /* CMPaymentService.m in Sources */,
7AF00BA115A8DC650070442A /* CMUser.m in Sources */,
D042C2EB15AF41F100A88888 /* CMACLFetchResponse.m in Sources */,
AAA92FFE181972DA0064F773 /* CMTools.m in Sources */,
Expand Down Expand Up @@ -1282,7 +1247,6 @@
7AD9222014CF5B9B0032DDDE /* CMPagingDescriptorSpec.m in Sources */,
AAD4AD161908104B006B93F2 /* CMUserIntegrationSpec.m in Sources */,
AA9528D4194B422800AEB90D /* CMNullStoreSpec.m in Sources */,
AA09516D194B7AA7008602DB /* CMPaymentServiceSpec.m in Sources */,
AAE92211194B923D004DA1AC /* CMWebServiceIntegrationSpec.m in Sources */,
7AD9222614D06EB10032DDDE /* CMStoreOptionsSpec.m in Sources */,
7AD93BAF14D1CCFE00CC1CC9 /* CMFileSpec.m in Sources */,
Expand Down Expand Up @@ -1434,7 +1398,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = EE1B44A5F6B4AA8E61850EFA /* Pods-cloudmine-ios.debug.xcconfig */;
buildSettings = {
CURRENT_PROJECT_VERSION = 1.7.16;
CURRENT_PROJECT_VERSION = 1.7.17;
DSTROOT = /tmp/ios.dst;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GCC_GENERATE_TEST_COVERAGE_FILES = YES;
Expand Down Expand Up @@ -1462,7 +1426,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = B2A33E73BEDE10A94973E9FE /* Pods-cloudmine-ios.release.xcconfig */;
buildSettings = {
CURRENT_PROJECT_VERSION = 1.7.16;
CURRENT_PROJECT_VERSION = 1.7.17;
DSTROOT = /tmp/ios.dst;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO;
Expand Down Expand Up @@ -1588,7 +1552,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = C3444874F77B35F0544725D1 /* Pods-cloudmine-ios.test.xcconfig */;
buildSettings = {
CURRENT_PROJECT_VERSION = 1.7.16;
CURRENT_PROJECT_VERSION = 1.7.17;
DSTROOT = /tmp/ios.dst;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GCC_GENERATE_TEST_COVERAGE_FILES = YES;
Expand Down
2 changes: 1 addition & 1 deletion ios/ios/src/CMConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@

#define CM_DEFAULT_API_VERSION @"v1"

#define CM_VERSION @"1.7.16"
#define CM_VERSION @"1.7.17"

#endif
3 changes: 0 additions & 3 deletions ios/ios/src/CloudMine.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,5 @@
#import "CMDeleteResponse.h"
#import "CMChannelResponse.h"
#import "CMUserResponse.h"
#import "CMPaymentService.h"
#import "CMPaymentResponse.h"
#import "CMCardPayment.h"

#import "UIImageView+CloudMine.h"
33 changes: 0 additions & 33 deletions ios/ios/src/Users/CMUser.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#import "CMSerializable.h"
#import "CMUserAccountResult.h"
#import "CMSocialLoginViewController.h"
#import "CMPaymentResponse.h"

@class CMCardPayment, CMUserResponse, ACAccount, CMObjectFetchResponse;

Expand Down Expand Up @@ -645,36 +644,4 @@ typedef void (^CMUserFetchWithMetaCallback)(CMObjectFetchResponse *response);
*/
+ (void)userWithIdentifier:(NSString *)identifier callback:(CMUserFetchCallback)callback;

/**
* Asynchronously adds a payment method (A credit card) to the user. The user should be logged in.
*
* @param paymentMethod The Credit Card you are adding.
* @param callback The block that will be called on completion of the operation.
*/
- (void)addPaymentMethod:(CMCardPayment *)paymentMethod callback:(CMPaymentServiceCallback)callback;

/**
* Asynchronously adds payment methods (credit cards) to the user. The user should be logged in.
*
* @param paymentMethods The Credit Cards (CMPayment) you are adding.
* @param callback The block that will be called on completion of the operation.
*/
- (void)addPaymentMethods:(NSArray *)paymentMethods callback:(CMPaymentServiceCallback)callback;

/**
* Asynchronously removes a payment (A credit card) from the user. The user should be logged in. The
* index is which credit card you want to remove.
*
* @param index The index for the Payment you are removing.
* @param callback The block that will be called on completion of the operation.
*/
- (void)removePaymentMethodAtIndex:(NSUInteger)index callback:(CMPaymentServiceCallback)callback;

/**
* Asynchronously fetches the payment methods for the user. The user should be logged in.
*
* @param callback The block that will be called on completion of the operation.
*/
- (void)paymentMethods:(CMPaymentServiceCallback)callback;

@end
95 changes: 4 additions & 91 deletions ios/ios/src/Users/CMUser.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
#import "CMObjectSerialization.h"
#import "CMObjectDecoder.h"
#import "CMObjectEncoder.h"
#import "CMCardPayment.h"
#import "NSDictionary+CMJSON.h"
#import "CMUserResponse.h"

#import "CMStoreOptions.h"
#import "CMObjectFetchResponse.h"
#import "CMResponseMetadata.h"
#import "CMSnippetResult.h"
#import "MARTNSObject.h"
#import "RTProperty.h"

Expand Down Expand Up @@ -509,95 +511,6 @@ - (void)getProfile:(CMUserOperationCallback)callback;
}];
}

#pragma mark - Payment Methods

- (void)addPaymentMethod:(CMCardPayment *)paymentMethod callback:(CMPaymentServiceCallback)callback;
{
[self addPaymentMethods:@[paymentMethod] callback:callback];
}

- (void)addPaymentMethods:(NSArray *)paymentMethods callback:(CMPaymentServiceCallback)callback;
{
//serialize payment method
NSString *urlString = @"payments/account/methods/card";

NSURL *url = [_webService constructAppURLWithString:urlString andDescriptors:nil];
NSMutableURLRequest *request = [_webService constructHTTPRequestWithVerb:@"POST" URL:url binaryData:NO user:self];

NSMutableArray *payments = [NSMutableArray array];
NSDictionary *encoded = [CMObjectEncoder encodeObjects:paymentMethods];
[encoded enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
[payments addObject:obj];
}];

NSDictionary *finalEncoding = @{@"payments": payments};

NSError *error = nil;
NSData *data = [NSJSONSerialization dataWithJSONObject:finalEncoding options:0 error:&error];
if (error) {
NSLog(@"There was an error serializing the CMPayment Object! %@", error);
}

[request setHTTPBody:data];

[_webService executeGenericRequest:request successHandler:^(id parsedBody, NSUInteger httpCode, NSDictionary *headers) {
CMPaymentResponse *response = [[CMPaymentResponse alloc] initWithResponseBody:parsedBody httpCode:httpCode headers:headers errors:nil];
response.result = CMPaymentResultSuccessful;
if (callback) callback(response);
} errorHandler:^(id responseBody, NSUInteger httpCode, NSDictionary *headers, NSError *error, NSDictionary *errorInfo) {
CMPaymentResponse *response = [[CMPaymentResponse alloc] initWithResponseBody:responseBody httpCode:httpCode headers:headers errors:errorInfo];
response.result = CMPaymentResultFailed;
if (callback) callback(response);
}];
}

- (void)removePaymentMethodAtIndex:(NSUInteger)index callback:(CMPaymentServiceCallback)callback;
{
NSString *urlString = [NSString stringWithFormat:@"payments/account/methods/card/%lu", (unsigned long)index];

NSURL *url = [_webService constructAppURLWithString:urlString andDescriptors:nil];
NSMutableURLRequest *request = [_webService constructHTTPRequestWithVerb:@"DELETE" URL:url binaryData:NO user:self];

[_webService executeGenericRequest:request successHandler:^(id parsedBody, NSUInteger httpCode, NSDictionary *headers) {
CMPaymentResponse *response = [[CMPaymentResponse alloc] initWithResponseBody:parsedBody httpCode:httpCode headers:headers errors:nil];
response.result = CMPaymentResultSuccessful;
if (callback) callback(response);
} errorHandler:^(id responseBody, NSUInteger httpCode, NSDictionary *headers, NSError *error, NSDictionary *errorInfo) {
CMPaymentResponse *response = [[CMPaymentResponse alloc] initWithResponseBody:responseBody httpCode:httpCode headers:headers errors:errorInfo];
response.result = CMPaymentResultFailed;
if (callback) callback(response);
}];
}

- (void)paymentMethods:(CMPaymentServiceCallback)callback;
{
NSString *urlString = @"payments/account/methods";

NSURL *url = [_webService constructAppURLWithString:urlString andDescriptors:nil];
NSMutableURLRequest *request = [_webService constructHTTPRequestWithVerb:@"GET" URL:url binaryData:NO user:self];

[_webService executeGenericRequest:request successHandler:^(id parsedBody, NSUInteger httpCode, NSDictionary *headers) {

NSMutableArray *finishedObjects = [NSMutableArray array];
for (NSDictionary *dictionary in parsedBody[@"card"]) {
CMObjectDecoder *decoder = [[CMObjectDecoder alloc] initWithSerializedObjectRepresentation:dictionary];
CMCardPayment *newPayment = [[CMCardPayment alloc] initWithCoder:decoder];
[finishedObjects addObject:newPayment];
}

CMPaymentResponse *response = [[CMPaymentResponse alloc] initWithResponseBody:finishedObjects httpCode:httpCode headers:headers errors:nil];
response.result = CMPaymentResultSuccessful;
if (callback) callback(response);
} errorHandler:^(id responseBody, NSUInteger httpCode, NSDictionary *headers, NSError *error, NSDictionary *errorInfo) {
CMPaymentResponse *response = [[CMPaymentResponse alloc] initWithResponseBody:responseBody httpCode:httpCode headers:headers errors:errorInfo];
response.result = CMPaymentResultFailed;
if (callback) callback(response);
}];
}




#pragma mark - Social Login

// This code is very similar to login above, perhaps we can refactor.
Expand Down
Loading