pub trait PayMode {
// Required methods
fn login(&self, code: &str) -> Result<JsonValue, String>;
fn jsapi(
&mut self,
sub_mchid: &str,
out_trade_no: &str,
description: &str,
total_fee: f64,
notify_url: &str,
sp_openid: &str,
) -> Result<JsonValue, String>;
fn pay_query(
&mut self,
out_trade_no: &str,
sub_mchid: &str,
) -> Result<JsonValue, String>;
fn pay_notify(
&mut self,
nonce: &str,
ciphertext: &str,
associated_data: &str,
) -> Result<JsonValue, String>;
fn refund(
&mut self,
sub_mchid: &str,
out_trade_no: &str,
transaction_id: &str,
out_refund_no: &str,
amount: f64,
total: f64,
currency: &str,
) -> Result<JsonValue, String>;
fn refund_notify(
&mut self,
nonce: &str,
ciphertext: &str,
associated_data: &str,
) -> Result<JsonValue, String>;
fn refund_query(
&mut self,
out_refund_no: &str,
sub_mchid: &str,
) -> Result<JsonValue, String>;
}Required Methods§
fn login(&self, code: &str) -> Result<JsonValue, String>
Sourcefn jsapi(
&mut self,
sub_mchid: &str,
out_trade_no: &str,
description: &str,
total_fee: f64,
notify_url: &str,
sp_openid: &str,
) -> Result<JsonValue, String>
fn jsapi( &mut self, sub_mchid: &str, out_trade_no: &str, description: &str, total_fee: f64, notify_url: &str, sp_openid: &str, ) -> Result<JsonValue, String>
JSAPI 支付
- out_trade_no 商户订单号
- sub_mchid 子商户号
- description 商品名称
- total_fee 支付金额
- notify_url 通知地址
- sp_openid 支付客户ID
Sourcefn pay_query(
&mut self,
out_trade_no: &str,
sub_mchid: &str,
) -> Result<JsonValue, String>
fn pay_query( &mut self, out_trade_no: &str, sub_mchid: &str, ) -> Result<JsonValue, String>
订单查询
- out_trade_no 商户订单号
- sub_mchid 子商户号
Sourcefn pay_notify(
&mut self,
nonce: &str,
ciphertext: &str,
associated_data: &str,
) -> Result<JsonValue, String>
fn pay_notify( &mut self, nonce: &str, ciphertext: &str, associated_data: &str, ) -> Result<JsonValue, String>
支付成功通知
Sourcefn refund(
&mut self,
sub_mchid: &str,
out_trade_no: &str,
transaction_id: &str,
out_refund_no: &str,
amount: f64,
total: f64,
currency: &str,
) -> Result<JsonValue, String>
fn refund( &mut self, sub_mchid: &str, out_trade_no: &str, transaction_id: &str, out_refund_no: &str, amount: f64, total: f64, currency: &str, ) -> Result<JsonValue, String>
订单退款