-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3362d0f
commit da9fb43
Showing
7 changed files
with
221 additions
and
2 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
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,42 @@ | ||
use blockchyp; | ||
use std::error::Error; | ||
|
||
fn add_gateway_merchant_example() -> Result<(), Box<dyn Error>> { | ||
// sample credentials | ||
let creds = blockchyp::APICredentials { | ||
api_key: "ZDSMMZLGRPBPRTJUBTAFBYZ33Q".to_string(), | ||
bearer_token: "ZLBW5NR4U5PKD5PNP3ZP3OZS5U".to_string(), | ||
signing_key: "9c6a5e8e763df1c9256e3d72bd7f53dfbd07312938131c75b3bfd254da787947".to_string(), | ||
}; | ||
|
||
// instantiate the client | ||
let client = blockchyp::Client::new(creds); | ||
|
||
let request = blockchyp::AddGatewayMerchantRequest{ | ||
profile: blockchyp::MerchantProfile{ | ||
dba_name: "DBA Name".to_string(), | ||
company_name: "Corporate Entity Name".to_string(), | ||
..Default::default() | ||
}, | ||
..Default::default() | ||
}; | ||
let (response, err) = client.add_gateway_merchant(&request); | ||
|
||
if let Some(e) = err { | ||
eprintln!("Unexpected error occurred: {:?}", e); | ||
return Err(e) | ||
} | ||
|
||
if response.success { | ||
println!("Success"); | ||
} | ||
|
||
println!("Response: {:?}", response); | ||
Ok(()) | ||
} | ||
|
||
fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
add_gateway_merchant_example()?; | ||
println!("Example completed successfully!"); | ||
Ok(()) | ||
} |
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,33 @@ | ||
// Copyright 2019-2024 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. | ||
|
||
mod test_utils; | ||
use blockchyp; | ||
|
||
#[test] | ||
fn test_add_gateway_merchant() { | ||
let config = test_utils::load_test_configuration(); | ||
let client = config.new_test_client(Some("partner")); | ||
|
||
// request object | ||
let request = blockchyp::AddGatewayMerchantRequest{ | ||
profile: blockchyp::MerchantProfile{ | ||
dba_name: "DBA Name".to_string(), | ||
company_name: "Corporate Entity Name".to_string(), | ||
..Default::default() | ||
}, | ||
..Default::default() | ||
}; | ||
println!("Request: {:?}", request); | ||
|
||
let (response, err) = client.add_gateway_merchant(&request); | ||
assert!(err.is_none(), "err is not none: {:?}", err); | ||
|
||
println!("Response: {:?}", response); | ||
|
||
// response assertions | ||
assert!(response.success); | ||
} |