Crates.io | sp-plugin-rust-test |
lib.rs | sp-plugin-rust-test |
version | 0.3.6 |
source | src |
created_at | 2022-12-11 11:22:55.095119 |
updated_at | 2022-12-31 09:27:30.593917 |
description | Rust plugin for for quick integration of shurjopay API |
homepage | |
repository | https://github.com/mahmudulislam299/sp-plugin-rust-test |
max_upload_size | |
id | 734282 |
size | 53,551 |
It handles many of the things that most people need to do manually
Handles http request and request errors
JSON serialization and deserialization
Authentication during checkout and verification of payments
📝 NOTE For shurjoPay live engine integration's all necessary credential will be given to merchant after subscription completed on shurjoPay gateway.
Add this to your Cargo.toml
:
[dependencies]
sp-plugin-rust-test = "0.1.0"
[dependencies]
sp-plugin-rust-test = "0.1.0"
use sp_plugin_rust_test::Shurjopay::ShurjopayPlugin;
let mut sp_instance = ShurjopayPlugin::new();
you can configure ShurjopayPlugin two ways
sp_instance.set_config_from_env_file();
in this way you need to configure .env file in this way.
*** keep the .toml and .evn file in the same directiory ***
# .env
SP_USER="sp_sandbox"
SP_PASS="pyyk97hu&6u6"
POST_DEFAULT_ADDRESS="https://sandbox.shurjopayment.com"
TOKEN_END_POINT="/api/get_token"
SECURE_PAYMENT_END_POINT="/api/secret-pay"
VERIFICATION_END_POINT="/api/verification"
PAYMENT_STATUS_END_POINT="/api/payment-status"
DEFAULT_RETURN_URL="https://sandbox.shurjopayment.com/response"
DEFAULT_CANCEL_URL="https://sandbox.shurjopayment.com/response"
sp_instance.set_all_config(
"sp_sandbox".to_string(),
"pyyk97hu&6u6".to_string(),
"https://sandbox.shurjopayment.com".to_string(),
"/api/get_token".to_string(),
"/api/secret-pay".to_string(),
"/api/verification".to_string(),
"/api/payment-status".to_string(),
"https://www.sandbox.shurjopayment.com/response".to_string(),
"https://www.sandbox.shurjopayment.com/response".to_string(),
);
let payment_req_obj = sp_instance.make_payment_request_object(
"786".to_string(), // amount
"abc123".to_string(), // order_id
"BDT".to_string(), // currency
"Mahmudul Islam".to_string(), // customer_name
"Dhaka".to_string(), // customer_address
"01811177722".to_string(), // customer_phone
"Dhaka".to_string(), // customer_city
"1203".to_string(), // customer_post_code
);
let checkout_url = sp_instance.make_payment(payment_req_obj)
let response = sp_instance.verify_payment(Some("sp63935da67dfd3".to_string()));
println!("verify Payment Response: {:?}",response);
if response.is_some()
{
println!("{:#?}", response.unwrap().clone().sp_message.unwrap());
}
Licensed under:
For any technical assistance please contact to: https://shurjopay.com.bd/#contacts