Struct alipay_rs::Client[][src]

pub struct Client { /* fields omitted */ }

Implementations

app_id: 可在支付宝控制台 -> 我的应用 中查看
private_key: 支付宝开放平台开发助手生成的应用私钥
app_cert_sn: 在应用的 开发设置 -> 开发信息 -> 接口加签方式 中获取
alipay_root_cert_sn: 同上

app_id: 可在支付宝控制台 -> 我的应用 中查看
private_key_path: 支付宝开放平台开发助手生成的应用私钥文件
app_cert_sn: 在应用的 开发设置 -> 开发信息 -> 接口加签方式 中获取
alipay_root_cert_sn: 同上

设置公共参数

值为None会被过滤掉

如果参数已存在,那么会覆盖原先的参数值

Example:

#[derive(AlipayParam)]
struct PublicParams {
    app_id: String,
    method: Option<String>,
    charset: String,
    sign_type: String,
    sign: Option<String>,
    timestamp: Option<String>,
    version: String,
    biz_content: Option<String>,
}
    let public_params = PublicParams {
        app_id: "2021002182623971".to_owned(),
        method: None,
        charset: "utf-8".to_owned(),
        sign_type: "RSA2".to_owned(),
        sign: None,
        timestamp: None,
        version: "1.0".to_owned(),
        biz_content: None,
    };
    client.set_public_params(public_params);

异步请求

支付宝的官方接口都可以使用此函数访问

Example:

   let client = alipay_rs::Client::new(
        "2021002182623971",
        "MIIEoQIBAAKCAQEArcZcqObeVuMgKNZI6RrJf9gEP5Al4ju9C37dm4iMsfZ9GdR7xP8m24KAJH8mko3+ZNsa3HeEFTQeXtOfhx+tQmlWVG+lj04aVWRzCA5UjFeDrMkFIRTf0x/gR/aBq2W9JS8yR1taQ+OKrNFn9OTeNZMv0nUUgypF7adAse9T6pKBRVGe+3N4yCOUg8GsjrcVv7u0pUxAcU4Erytxo9BMBNVeFNsA/fNujUT08lUDo6i4AH37yEZgQSbL4Hh+rUpKL/9EXoLpOZPR0NOEnxE1fuRRnkYS4dSkgPlww3+V7MoFVx65TDvakpchzJOKGa/QCEhxkHuI4nLjm9PgRAls3QIDAQABAoH/MN+ZL+e+oLFAWjvqRaVDBrG6gCYKgZZLlPAZY6UD7QlmJd2c8crRIuuRHrKkJpPI+JSm+Vq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A8J+A7Q2s9klGi29e3vej5XZCp3BVyVPfAVgXkBYlMTc1rXr0FUVKGMjnm6d4A==",
        Some("appCertPublicKey_2021002182623971.crt"),
        Some("alipayRootCert.crt")
    );
    let data:serde_json::Value = client
        .post("alipay.fund.trans.uni.transfer", transfer)
        .await.unwrap();

pub async fn no_param_post<S: Into<String>, R: DeserializeOwned>(
    self,
    method: S
) -> AlipayResult<R>

没有参数的异步请求

pub fn sync_post<S: Into<String>, T: Serialize, R: DeserializeOwned>(
    self,
    method: S,
    biz_content: T
) -> AlipayResult<R>

同步请求

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.