Skip to content

Commit

Permalink
修正拼写错误
Browse files Browse the repository at this point in the history
  • Loading branch information
minibear2021 committed Apr 15, 2021
1 parent bd9c1fa commit 0e9c0bc
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 25 deletions.
47 changes: 29 additions & 18 deletions examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@

from wechatpayv3 import WeChatPay, WeChatPayType

wxpay = WeChatPay(wechatpay_type=WeChatPayType.MINIPROG,
mchid=MCHID,
mch_parivate_key=MCH_PRIVATE_KEY,
mch_key_serial_no=MCH_KEY_SERIAL_NO,
wechat_certificate=WECHAT_CERTIFICATE,
appid=APPID,
notify_url=NOTIFY_URL)
wxpay = WeChatPay(
wechatpay_type=WeChatPayType.MINIPROG,
mchid=MCHID,
mch_parivate_key=MCH_PRIVATE_KEY,
mch_key_serial_no=MCH_KEY_SERIAL_NO,
wechat_certificate=WECHAT_CERTIFICATE,
appid=APPID,
notify_url=NOTIFY_URL)


def certificate():
Expand All @@ -18,10 +19,11 @@ def certificate():


def pay():
code, message = wxpay.pay(description='demo-description',
out_trade_no='demo-trade-no',
amount={'total': 100},
payer={'openid': 'demo-openid'})
code, message = wxpay.pay(
description='demo-description',
out_trade_no='demo-trade-no',
amount={'total': 100},
payer={'openid': 'demo-openid'})
print('code: %s, message: %s' % (code, message))


Expand All @@ -36,9 +38,10 @@ def close():


def refund():
code, message = wxpay.refund(transaction_id='demo-transation-id',
out_refund_no='demo-out-refund-no',
amount={'refund': 100, 'total': 100, 'currency': 'CNY'})
code, message = wxpay.refund(
transaction_id='demo-transation-id',
out_refund_no='demo-out-refund-no',
amount={'refund': 100, 'total': 100, 'currency': 'CNY'})
print('code: %s, message: %s' % (code, message))


Expand All @@ -64,8 +67,15 @@ def download_bill():


def combine_pay():
code, message = wxpay.combine_pay(combine_out_trade_no='demo_out_trade_no', sub_orders=[{'mchid': '1900000109', 'attach': '深圳分店', 'amount': {
'total_amount': 100, 'currency': 'CNY'}, 'out_trade_no': '20150806125346', 'description': '腾讯充值中心-QQ会员充值', 'settle_info': {'profit_sharing': False, 'subsidy_amount': 10}}])
code, message = wxpay.combine_pay(
combine_out_trade_no='demo_out_trade_no',
sub_orders=[{'mchid': '1900000109',
'attach': '深圳分店',
'amount': {'total_amount': 100, 'currency': 'CNY'},
'out_trade_no': '20150806125346',
'description': '腾讯充值中心-QQ会员充值',
'settle_info': {'profit_sharing': False, 'subsidy_amount': 10}}],
combine_payer_info={'openid':'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o'})
print('code: %s, message: %s' % (code, message))


Expand All @@ -76,8 +86,9 @@ def combine_query():


def combine_close():
code, message = wxpay.combine_close(combine_out_trade_no='demo_out_trade_no', sub_orders=[
{'mchid': '1900000109', 'out_trade_no': '20150806125346'}])
code, message = wxpay.combine_close(
combine_out_trade_no='demo_out_trade_no',
sub_orders=[{'mchid': '1900000109', 'out_trade_no': '20150806125346'}])
print('code: %s, message: %s' % (code, message))


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name="wechatpayv3",
version="0.46",
version="0.47",
author="minibear",
description="微信支付接口V3版python库",
long_description=long_description,
Expand Down
6 changes: 2 additions & 4 deletions wechatpayv3/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ def close(self, out_trade_no):
if not out_trade_no:
raise Exception('out_trade_no is not assigned.')
path = '/v3/pay/transactions/out-trade-no/%s/close' % out_trade_no
params = {}
params['mchid'] = self._mchid
params['out_trade_no'] = out_trade_no
params = {'mchid': self._mchid}
return self._core.post(path, data=params)

def query(self, transaction_id=None, out_trade_no=None):
Expand Down Expand Up @@ -158,7 +156,7 @@ def refund(self,
else:
raise Exception('amount is not assigned.')
if transaction_id:
params.update({'transation_id': transaction_id})
params.update({'transaction_id': transaction_id})
if out_trade_no:
params.update({'out_trade_no': out_trade_no})
if reason:
Expand Down
4 changes: 2 additions & 2 deletions wechatpayv3/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def get(self, path):
return -1, '{"message": "微信支付平台证书序号不一致"}'
if not verify_response(timestamp, nonce, body, signature, self._wechat_certificate):
return -1, '{"message": "应答签名验证失败"}'
return response.status_code, response.content
return response.status_code, response.text

def post(self, path, data=None):
headers = {}
Expand All @@ -56,4 +56,4 @@ def post(self, path, data=None):
return -1, '{"message": "微信支付平台证书序号不一致"}'
if not verify_response(timestamp, nonce, body, signature, self._wechat_certificate):
return -1, '{"message": "应答签名验证失败"}'
return response.status_code, response.content
return response.status_code, response.text

0 comments on commit 0e9c0bc

Please sign in to comment.