Skip to content

Commit

Permalink
Bump version to 2.19.0
Browse files Browse the repository at this point in the history
  • Loading branch information
devops-blockchyp committed Sep 16, 2024
1 parent 3362d0f commit da9fb43
Show file tree
Hide file tree
Showing 7 changed files with 221 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "blockchyp"
version = "2.18.8"
version = "2.19.0"
edition = "2021"
description = "This is the SDK for Rust. Like all BlockChyp SDKs, it provides a full client for the BlockChyp gateway and BlockChyp payment terminals."
documentation = "https://docs.blockchyp.com/#overview"
Expand Down
62 changes: 62 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5251,6 +5251,68 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {

```

#### Add Gateway Merchant



* **API Credential Types:** Partner
* **Required Role:** Gateway Boarding

This is a partner level API that can be used to manually board gateway merchants. Use this API in conjunction
with Platform Configuration to instantly board gateway merchants. Note that most partners don't have
permission to do this and are unlikely to get it.

Settings can be changed by using the Update Merchant API.




```rust
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(())
}

```

#### Add Test Merchant


Expand Down
42 changes: 42 additions & 0 deletions examples/add_gateway_merchant_example.rs
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(())
}
2 changes: 1 addition & 1 deletion examples/update_merchant_platforms_example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fn update_merchant_platforms_example() -> Result<(), Box<dyn Error>> {
let client = blockchyp::Client::new(creds);

let request = blockchyp::MerchantPlatform{
merchant_id: "XXXXXXXXXXXXX".to_string(),

..Default::default()
};
let (response, err) = client.update_merchant_platforms(&request);
Expand Down
22 changes: 22 additions & 0 deletions src/blockchyp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2058,6 +2058,28 @@ impl Client {
None
};

(response, err)
}
/// Adds a live gateway merchant account.
pub fn add_gateway_merchant(&self, request: &AddGatewayMerchantRequest) -> (MerchantProfileResponse, Option<Box<dyn Error>>) {
let mut response = MerchantProfileResponse::default();
let response_err = self.dashboard_request("/api/add-gateway-merchant", "POST", request, &mut response, Some(request.timeout));

let err = if let Err(e) = response_err {
if let Some(reqwest_err) = e.downcast_ref::<reqwest::Error>() {
if reqwest_err.is_timeout() {
response.response_description = RESPONSE_TIMED_OUT.to_string();
} else {
response.response_description = e.to_string();
}
} else {
response.response_description = e.to_string();
}
Some(e)
} else {
None
};

(response, err)
}
/// Adds a test merchant account.
Expand Down
60 changes: 60 additions & 0 deletions src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4194,6 +4194,21 @@ pub struct AddTestMerchantRequest {

}

/// Models basic information needed to create a gateway merchant.
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct AddGatewayMerchantRequest {
/// Whether or not to route transaction to the test gateway.
#[serde(rename = "test")]
pub test: bool,
/// The merchant profile to be boarded.
#[serde(rename = "profile")]
pub profile: MerchantProfile,
/// The request timeout in seconds.
#[serde(rename = "timeout")]
pub timeout: i32,

}

/// Models a request for information about the merchant profile.
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct MerchantProfileRequest {
Expand Down Expand Up @@ -4390,6 +4405,9 @@ pub struct MerchantProfile {
/// The merchant id.
#[serde(rename = "merchantId")]
pub merchant_id: String,
/// The primary bank mid.
#[serde(rename = "bankMid")]
pub bank_mid: String,
/// The merchant's company name.
#[serde(rename = "companyName")]
pub company_name: String,
Expand Down Expand Up @@ -4562,6 +4580,9 @@ pub struct MerchantProfileResponse {
/// The merchant id.
#[serde(rename = "merchantId")]
pub merchant_id: String,
/// The primary bank mid.
#[serde(rename = "bankMid")]
pub bank_mid: String,
/// The merchant's company name.
#[serde(rename = "companyName")]
pub company_name: String,
Expand Down Expand Up @@ -5257,6 +5278,39 @@ pub struct MerchantPlatformsResponse {

}

/// Used to up platform configuration for gateway merchants.
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct UpdateMerchantPlatformRequest {
/// The request timeout in seconds.
#[serde(rename = "timeout")]
pub timeout: i32,
/// Whether or not to route transaction to the test gateway.
#[serde(rename = "test")]
pub test: bool,
/// The merchant platform configuration.
#[serde(rename = "platform")]
pub platform: MerchantPlatform,

}

/// Echoes back the state of the current platform configuration after a change.
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct UpdateMerchantPlatformResponse {
/// Whether or not the request succeeded.
#[serde(rename = "success")]
pub success: bool,
/// The error, if an error occurred.
#[serde(rename = "error")]
pub error: String,
/// A narrative description of the transaction result.
#[serde(rename = "responseDescription")]
pub response_description: String,
/// The current platform configuration.
#[serde(rename = "platform")]
pub platform: MerchantPlatform,

}

/// Details about a merchant board platform configuration.
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct MerchantPlatform {
Expand Down Expand Up @@ -7115,6 +7169,9 @@ pub struct MerchantCredentialGenerationRequest {
/// Free form description of the purpose or intent behind the credentials.
#[serde(rename = "notes")]
pub notes: String,
/// Type of credentials to generate, either API or TOKENIZING. Defaults to API.
#[serde(rename = "credentialType")]
pub credential_type: String,

}

Expand All @@ -7139,6 +7196,9 @@ pub struct MerchantCredentialGenerationResponse {
/// The merchant signing key.
#[serde(rename = "signingKey")]
pub signing_key: String,
/// The tokenizing key.
#[serde(rename = "tokenizingKey")]
pub tokenizing_key: String,

}

Expand Down
33 changes: 33 additions & 0 deletions tests/add_gateway_merchant_tests.rs
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);
}

0 comments on commit da9fb43

Please sign in to comment.