Skip to content

Commit

Permalink
Bump version to 2.18.5
Browse files Browse the repository at this point in the history
  • Loading branch information
devops-blockchyp committed Apr 29, 2024
1 parent 3ed8264 commit 8c53383
Show file tree
Hide file tree
Showing 28 changed files with 697 additions and 186 deletions.
Binary file not shown.
77 changes: 76 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The preferred method of installing BlockChyp is via cocoapods. Add the following
dependency to your Podfile and type `pod install`.

```
pod 'BlockChyp', '~> 2.17.3'
pod 'BlockChyp', '~> 2.18.5'
```

Note: If you're using Swift, you'll need to make sure dynamic frameworks are turned
Expand Down Expand Up @@ -7125,6 +7125,81 @@ class ExampleClass {



#### Merchant Credential Generation



* **API Credential Types:** Partner
* **Required Role:** Partner API Access

This API allows partners to generate API credentials for a merchant.

The `merchantId` is required and must be the id of a valid merchant.

Credentials are not delete protected by default. Pass in `deleteProtected` to enable delete protection.

The optional `notes` field will populate the notes in the credentials.

By default no roles will be assigned unless valid, comma-delimited, role codes are passed in the `roles` field.



##### From Objective-C:

```objective-c
#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];
[client merchantCredentialGenerationWithRequest:request handler:^(NSDictionary *request, NSDictionary *response, NSError *error) {
NSNumber *success = [response objectForKey:@"success"];
if (success.boolValue) {
NSLog(@"Success");
}
}];
[pool drain];
return 0;
}

```

##### From Swift:

```swift
import BlockChyp

class ExampleClass {

func example() {
let client = BlockChyp.init(
apiKey: "ZN5WQGX5PN6BE2MF75CEAWRETM",
bearerToken: "SVVHJCYVFWJR2QKYKFWMZQVZL4",
signingKey: "7c1b9e4d1308e7bbe76a1920ddd9449ce50af2629f6bb70ed3c110365935970b"
)

var request: [String:Any] = [:]
client.merchantCredentialGeneration(withRequest: request, handler: { (request, response, error) in
let approved = response["success"] as? Bool
if (approved.unsafelyUnwrapped) {
NSLog("Success")
}
})
}


```






Expand Down
22 changes: 22 additions & 0 deletions blockchyp-ios-examples/MerchantCredentialGenerationExample.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#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];
[client merchantCredentialGenerationWithRequest:request handler:^(NSDictionary *request, NSDictionary *response, NSError *error) {
NSNumber *success = [response objectForKey:@"success"];
if (success.boolValue) {
NSLog(@"Success");
}
}];
[pool drain];
return 0;
}
20 changes: 20 additions & 0 deletions blockchyp-ios-examples/MerchantCredentialGenerationExample.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import BlockChyp

class ExampleClass {

func example() {
let client = BlockChyp.init(
apiKey: "ZN5WQGX5PN6BE2MF75CEAWRETM",
bearerToken: "SVVHJCYVFWJR2QKYKFWMZQVZL4",
signingKey: "7c1b9e4d1308e7bbe76a1920ddd9449ce50af2629f6bb70ed3c110365935970b"
)

var request: [String:Any] = [:]
client.merchantCredentialGeneration(withRequest: request, handler: { (request, response, error) in
let approved = response["success"] as? Bool
if (approved.unsafelyUnwrapped) {
NSLog("Success")
}
})
}

2 changes: 1 addition & 1 deletion blockchyp-ios/BlockChyp.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |spec|

spec.name = "BlockChyp"
spec.version = "2.17.3"
spec.version = "2.18.5"
spec.summary = "BlockChyp SDK for iOS Developers."
spec.description = <<-DESC
This is the SDK for iOS. Like all BlockChyp SDKs, it provides a full
Expand Down
3 changes: 3 additions & 0 deletions blockchyp-ios/BlockChyp/BlockChyp.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ NS_ASSUME_NONNULL_BEGIN



// Generates and returns api credentials for a given merchant.
-(void)merchantCredentialGenerationWithRequest:(NSDictionary *)request handler:(BlockChypCompletionHandler)handler;

// Adds a test merchant account.
-(void)getMerchantsWithRequest:(NSDictionary *)request handler:(BlockChypCompletionHandler)handler;

Expand Down
8 changes: 8 additions & 0 deletions blockchyp-ios/BlockChyp/BlockChyp.m
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,14 @@ -(void)deleteTokenWithRequest:(NSDictionary *)request handler:(BlockChypCompleti



// Generates and returns api credentials for a given merchant.
-(void)merchantCredentialGenerationWithRequest:(NSDictionary *)request handler:(BlockChypCompletionHandler)handler {

[self routeDashboardRequestWith:request path:@"/api/generate-merchant-creds" method:@"POST" handler:handler];

}


// Adds a test merchant account.
-(void)getMerchantsWithRequest:(NSDictionary *)request handler:(BlockChypCompletionHandler)handler {

Expand Down
9 changes: 7 additions & 2 deletions blockchyp-ios/BlockChyp/HTTPRequestDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ -(void)gatewayGetWithPath:(NSString *)path test:(BOOL)test handler:(BlockChypGet
NSString *json = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
response = [EncodingUtils parseJSON:json];;
}

self.getHandler(response, error);
}];

Expand All @@ -150,7 +150,7 @@ -(void)routeTerminalRequestWith:(NSDictionary *)request terminalPath:(NSString *
[self gatewayGetWithPath:url test:false handler:^(NSDictionary * response, NSError * error) {

if (error != nil) {
self.handler(request, [[NSDictionary alloc] init], error);
self.handler(request, response, error);
return;
}

Expand All @@ -159,6 +159,11 @@ -(void)routeTerminalRequestWith:(NSDictionary *)request terminalPath:(NSString *
return;
}

if (response[@"success"] != nil && ![response[@"success"] boolValue]) {
self.handler(request, response, error);
return;
}

//update cache asyncronously
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_async(queue, ^{
Expand Down
2 changes: 1 addition & 1 deletion blockchyp-ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
PODFILE CHECKSUM: 915a0737343046da9ecfbb48bd571bc56e185b1f

COCOAPODS: 1.8.4
COCOAPODS: 1.14.3
2 changes: 1 addition & 1 deletion blockchyp-ios/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8c53383

Please sign in to comment.