pub struct Snap {
pub api_config: ApiConfig,
}Expand description
Snap struct used to do request to Midtrans Snap API
Fields§
§api_config: ApiConfigImplementations§
Source§impl Snap
impl Snap
pub fn new(is_production: bool, server_key: String) -> SnapBuilder
Sourcepub fn create_transaction(
&self,
parameters: &str,
) -> Result<HashMap<String, Value>, MidtransError>
pub fn create_transaction( &self, parameters: &str, ) -> Result<HashMap<String, Value>, MidtransError>
Trigger API call to Snap API
§Argument
parameters is a &str of Core API JSON
(more params detail refer to: https://snap-docs.midtrans.com)
§Return
HashMap from JSON decoded response, that contains token and redirect_url
Sourcepub fn create_transaction_token(
&self,
parameters: &str,
) -> Result<Value, MidtransError>
pub fn create_transaction_token( &self, parameters: &str, ) -> Result<Value, MidtransError>
Wrapper method that call create_transaction and directly return token
Sourcepub fn create_transaction_redirect_url(
&self,
parameters: &str,
) -> Result<Value, MidtransError>
pub fn create_transaction_redirect_url( &self, parameters: &str, ) -> Result<Value, MidtransError>
Wrapper method that call create_transaction and directly return redirect_url
Trait Implementations§
Source§impl MidtransClient for Snap
impl MidtransClient for Snap
Source§impl Transactions for Snap
impl Transactions for Snap
Source§fn get_api_config(&self) -> &ApiConfig
fn get_api_config(&self) -> &ApiConfig
Getter for ApiConfig
Source§fn set_api_config(&mut self, api_config: ApiConfig)
fn set_api_config(&mut self, api_config: ApiConfig)
Setter for ApiConfig
fn status( &self, transaction_id: String, ) -> Result<HashMap<String, Value>, MidtransError>
fn statusb2b( &self, transaction_id: String, ) -> Result<HashMap<String, Value>, MidtransError>
fn approve( &self, transaction_id: String, ) -> Result<HashMap<String, Value>, MidtransError>
fn deny( &self, transaction_id: String, ) -> Result<HashMap<String, Value>, MidtransError>
fn cancel( &self, transaction_id: String, ) -> Result<HashMap<String, Value>, MidtransError>
fn expire( &self, transaction_id: String, ) -> Result<HashMap<String, Value>, MidtransError>
fn refund( &self, transaction_id: String, parameters: &str, ) -> Result<HashMap<String, Value>, MidtransError>
fn refund_direct( &self, transaction_id: String, parameters: &str, ) -> Result<HashMap<String, Value>, MidtransError>
fn notification_from_json( &self, notification: HashMap<String, Value>, ) -> Result<HashMap<String, Value>, MidtransError>
fn notification_from_str( &self, notification: &str, ) -> Result<HashMap<String, Value>, MidtransError>
Auto Trait Implementations§
impl !Freeze for Snap
impl !RefUnwindSafe for Snap
impl Send for Snap
impl Sync for Snap
impl Unpin for Snap
impl !UnwindSafe for Snap
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more