fzlee/alipay

return_url, notify_url 应当允许不设置

elonzh opened this issue · 3 comments

Environment
OS version: Ubuntu 20.04.2 LTS
Python version: 3.8.8
Alipay version: 3.0.1

To reproduce
Code snippets:

order_string = alipay.api_alipay_trade_page_pay(
    out_trade_no="20161112",
    total_amount=0.01,
    subject=subject,
)

报错:

	...
    order_string = self.sdk.api_alipay_trade_page_pay(**kwargs)
  File "__init__.py", line 265, in api_alipay_trade_page_pay
    return self.sign_data(data)
  File "__init__.py", line 173, in sign_data
    signed_string = "&".join("{}={}".format(k, quote_plus(v)) for k, v in unquoted_items)
  File "__init__.py", line 173, in <genexpr>
    signed_string = "&".join("{}={}".format(k, quote_plus(v)) for k, v in unquoted_items)
  File "urllib/parse.py", line 866, in quote_plus
    string = quote(string, safe + space, encoding, errors)
  File "urllib/parse.py", line 850, in quote
    return quote_from_bytes(string, safe)
  File "urllib/parse.py", line 875, in quote_from_bytes
    raise TypeError("quote_from_bytes() expected bytes")

如果设置为空字符串则会导致参数校验不通过。但是 return_url, notify_url 在支付宝是可选参数,比如我们业务就并不想设置 return_url

**Expected behavior **

return_url, notify_url 应当允许不设置且不报错。

fzlee commented

tag 3.0.3 已经修复了这个问题, 可以帮忙测试一下吗

fzlee commented

代码还未发布, 你可以将3.0.3拉到本地直接替换site-packages 里面的内容

fzlee commented

3.0.3 已经发布