-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #281 from blockchyp/develop
Develop to Master
- Loading branch information
1 parent
832a7a7
commit 2936418
Showing
8 changed files
with
218 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#import <Foundation/Foundation.h> | ||
#import <BlockChyp/BlockChyp.h> | ||
|
||
int main (int argc, const char * argv[]) | ||
{ | ||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | ||
|
||
BlockChyp *client = [[BlockChyp alloc] | ||
initWithApiKey:@"SPBXTSDAQVFFX5MGQMUMIRINVI" | ||
bearerToken:@"7BXBTBUPSL3BP7I6Z2CFU6H3WQ" | ||
signingKey:@"bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e"]; | ||
|
||
NSMutableDictionary *request = [[NSMutableDictionary alloc] init]; | ||
var profile: [String:Any] = [:] | ||
profile["dbaName"] = "DBA Name" | ||
profile["companyName"] = "Corporate Entity Name" | ||
request["profile"] = profile | ||
[client addGatewayMerchantWithRequest:request handler:^(NSDictionary *request, NSDictionary *response, NSError *error) { | ||
NSNumber *success = [response objectForKey:@"success"]; | ||
if (success.boolValue) { | ||
NSLog(@"Success"); | ||
} | ||
}]; | ||
[pool drain]; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import BlockChyp | ||
|
||
class ExampleClass { | ||
|
||
func example() { | ||
let client = BlockChyp.init( | ||
apiKey: "ZN5WQGX5PN6BE2MF75CEAWRETM", | ||
bearerToken: "SVVHJCYVFWJR2QKYKFWMZQVZL4", | ||
signingKey: "7c1b9e4d1308e7bbe76a1920ddd9449ce50af2629f6bb70ed3c110365935970b" | ||
) | ||
|
||
var request: [String:Any] = [:] | ||
var profile: [String:Any] = [:] | ||
profile["dbaName"] = "DBA Name" | ||
profile["companyName"] = "Corporate Entity Name" | ||
request["profile"] = profile | ||
client.addGatewayMerchant(withRequest: request, handler: { (request, response, error) in | ||
let approved = response["success"] as? Bool | ||
if (approved.unsafelyUnwrapped) { | ||
NSLog("Success") | ||
} | ||
}) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// Copyright 2019-2022 BlockChyp, Inc. All rights reserved. Use of this code | ||
// is governed by a license that can be found in the LICENSE file. | ||
// | ||
// This file was generated automatically by the BlockChyp SDK Generator. | ||
// Changes to this file will be lost every time the code is regenerated. | ||
|
||
#import "BlockChypTest.h" | ||
|
||
@interface AddGatewayMerchantTest : BlockChypTest | ||
|
||
|
||
|
||
@end | ||
|
||
@implementation AddGatewayMerchantTest | ||
|
||
- (void)setUp { | ||
|
||
TestConfiguration *config = [self loadConfiguration]; | ||
BlockChyp *client = [[BlockChyp alloc] initWithApiKey:config.apiKey bearerToken:config.bearerToken signingKey:config.signingKey]; | ||
client.gatewayHost = config.gatewayHost; | ||
client.testGatewayHost = config.testGatewayHost; | ||
client.dashboardHost = config.dashboardHost; | ||
|
||
NSDictionary *profile = [config.profiles objectForKey:@"partner"]; | ||
client.apiKey = (NSString*) [profile objectForKey:@"apiKey"]; | ||
client.bearerToken = (NSString*) [profile objectForKey:@"bearerToken"]; | ||
client.signingKey = (NSString*) [profile objectForKey:@"signingKey"]; | ||
|
||
|
||
} | ||
|
||
- (void)tearDown { | ||
|
||
} | ||
|
||
- (void)testAddGatewayMerchant{ | ||
|
||
TestConfiguration *config = [self loadConfiguration]; | ||
BlockChyp *client = [[BlockChyp alloc] initWithApiKey:config.apiKey bearerToken:config.bearerToken signingKey:config.signingKey]; | ||
client.gatewayHost = config.gatewayHost; | ||
client.testGatewayHost = config.testGatewayHost; | ||
client.dashboardHost = config.dashboardHost; | ||
|
||
NSDictionary *profile = [config.profiles objectForKey:@"partner"]; | ||
client.apiKey = (NSString*) [profile objectForKey:@"apiKey"]; | ||
client.bearerToken = (NSString*) [profile objectForKey:@"bearerToken"]; | ||
client.signingKey = (NSString*) [profile objectForKey:@"signingKey"]; | ||
|
||
XCTestExpectation *expectation = [self expectationWithDescription:@"AddGatewayMerchant Test"]; | ||
|
||
NSMutableDictionary *request = [[NSMutableDictionary alloc] init]; | ||
NSMutableDictionary *profile = [[NSMutableDictionary alloc] init]; | ||
profile[@"dbaName"] = @"DBA Name"; | ||
profile[@"companyName"] = @"Corporate Entity Name"; | ||
request[@"profile"] = profile; | ||
|
||
[client addGatewayMerchantWithRequest:request handler:^(NSDictionary *request, NSDictionary *response, NSError *error) { | ||
|
||
[self logJSON:response]; | ||
XCTAssertNotNil(response); | ||
// response assertions | ||
XCTAssertTrue([[response objectForKey:@"success"]boolValue]); | ||
|
||
[expectation fulfill]; | ||
}]; | ||
|
||
@try { | ||
[self waitForExpectationsWithTimeout:60 handler:nil]; | ||
} | ||
@catch (NSException *exception) { | ||
NSLog(@"Exception:%@",exception); | ||
} | ||
|
||
} | ||
|
||
@end |