Skip to content

Commit

Permalink
更新部分接口参数
Browse files Browse the repository at this point in the history
  • Loading branch information
minibear2021 committed Jun 16, 2022
1 parent 90ab26f commit fc86064
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 43 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [1.2.28] - 2022-06-16

### Updated

- 商户开户意愿确认-提交申请单参数调整
- 特约商户进件-提交申请单参数调整

## [1.2.27] - 2022-06-09

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

微信支付接口 V3 版 python 库。

欢迎微信支付开发者扫码进 QQ 群(群号:973102221)讨论:
欢迎微信支付开发者扫码进 QQ 群(群号:973102221)讨论,欢迎提交代码,欢迎star、follow、fork

![image](qq.png)

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="1.2.27",
version="1.2.28",
author="minibear",
description="微信支付 API v3 Python SDK(python sdk for wechatpay v3)",
long_description=long_description,
Expand Down
46 changes: 28 additions & 18 deletions wechatpayv3/apply4subject.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from .type import RequestType


def apply4subject_submit(self, business_code, contact_info, subject_info, identification_info, channel_id=None, addition_info=None):
def apply4subject_submit(self, business_code, contact_info, subject_info, identification_info, channel_id=None, addition_info=None, ubo_info_list=[]):
"""(商户开户意愿)提交申请单
:param business_code: 业务申请编号,示例值:'APPLYMENT_00000000001'
:param contact_info: 联系人信息,示例值:{'name':'张三','id_card_number':'320311770706001','mobile':'13900000000'}
Expand All @@ -12,6 +12,7 @@ def apply4subject_submit(self, business_code, contact_info, subject_info, identi
:param identification_info: 法人身份信息,示例值:{'identification_type':'IDENTIFICATION_TYPE_IDCARD','identification_name':'张三','identification_number':'110220330044005500','identification_valid_date':'["1970-01-01","forever"]','identification_front_copy':'0P3ng6KTIW4-Q_l2FjKLZ...','identification_back_copy':'0P3ng6KTIW4-Q_l2FjKLZ...'}
:param channel_id: 渠道商户号,示例值:'20001111'
:param addition_info: 补充材料,示例值:{'confirm_mchid_list':['20001113']}
:param ubo_info_list: 最终受益人信息列表,示例值:[{'ubo_id_doc_type':'IDENTIFICATION_TYPE_IDCARD','ubo_id_doc_name':'张三','ubo_id_doc_number':'110220330044005500'}]
"""
params = {}
if business_code:
Expand All @@ -34,24 +35,33 @@ def apply4subject_submit(self, business_code, contact_info, subject_info, identi
params.update({'channel_id': channel_id})
if addition_info:
params.update({'addition_info': addition_info})
cipher_data = False
if params.get('contact_info').get('name'):
params['contact_info']['name'] = self._core.encrypt(params['contact_info']['name'])
cipher_data = True
if params.get('contact_info').get('mobile'):
params['contact_info']['mobile'] = self._core.encrypt(params['contact_info']['mobile'])
cipher_data = True
if params.get('contact_info').get('id_card_number'):
params['contact_info']['id_card_number'] = self._core.encrypt(params['contact_info']['id_card_number'])
cipher_data = True
if params.get('identification_info').get('identification_name'):
params['identification_info']['identification_name'] = self._core.encrypt(params['identification_info']['identification_name'])
cipher_data = True
if params.get('identification_info').get('identification_number'):
params['identification_info']['identification_number'] = self._core.encrypt(params['identification_info']['identification_number'])
cipher_data = True
if ubo_info_list:
params.update({'ubo_info_list': ubo_info_list})
contact_name = params.get('contact_info').get('name')
if contact_name:
params['contact_info']['name'] = self._core.encrypt(contact_name)
contact_mobile = params.get('contact_info').get('mobile')
if contact_mobile:
params['contact_info']['mobile'] = self._core.encrypt(contact_mobile)
contact_number =params.get('contact_info').get('id_card_number')
if contact_number:
params['contact_info']['id_card_number'] = self._core.encrypt(contact_number)
identification_name = params.get('identification_info').get('identification_name')
if identification_name:
params['identification_info']['identification_name'] = self._core.encrypt(identification_name)
identification_number = params.get('identification_info').get('identification_number')
if identification_number:
params['identification_info']['identification_number'] = self._core.encrypt(identification_number)
identification_address = params.get('identification_info').get('identification_address')
if identification_address:
params['identification_info']['identification_address'] = self._core.encrypt(identification_address)
if params.get('ubo_info_list'):
for ubo_info in params['ubo_info_list']:
ubo_info['ubo_id_doc_name'] = self._core.encrypt(ubo_info['ubo_id_doc_name'])
ubo_info['ubo_id_doc_number'] = self._core.encrypt(ubo_info['ubo_id_doc_number'])
ubo_info['ubo_id_doc_address'] = self._core.encrypt(ubo_info['ubo_id_doc_address'])
path = '/v3/apply4subject/applyment'
return self._core.request(path, method=RequestType.POST, data=params, cipher_data=cipher_data)
return self._core.request(path, method=RequestType.POST, data=params, cipher_data=True)


def apply4subject_cancel(self, business_code=None, applyment_id=None):
Expand Down
46 changes: 28 additions & 18 deletions wechatpayv3/applyment.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,33 +40,43 @@ def applyment_submit(self, business_code, contact_info, subject_info, business_i
raise Exception('bank_account_info is not assigned.')
if addition_info:
params.update({'addition_info': addition_info})
cipher_data = False
if params.get('contact_info').get('contact_name'):
params['contact_info']['contact_name'] = self._core.encrypt(params['contact_info']['contact_name'])
cipher_data = True
if params.get('contact_info').get('contact_id_number'):
params['contact_info']['contact_id_number'] = self._core.encrypt(params['contact_info']['contact_id_number'])
cipher_data = True
if params.get('contact_info').get('openid'):
params['contact_info']['openid'] = self._core.encrypt(params['contact_info']['openid'])
if params.get('contact_info').get('mobile_phone'):
params['contact_info']['mobile_phone'] = self._core.encrypt(params['contact_info']['mobile_phone'])
cipher_data = True
if params.get('contact_info').get('contact_email'):
params['contact_info']['contact_email'] = self._core.encrypt(params['contact_info']['contact_email'])
cipher_data = True
if params.get('bank_account_info').get('account_name'):
params['bank_account_info']['account_name'] = self._core.encrypt(params['bank_account_info']['account_name'])
cipher_data = True
if params.get('bank_account_info').get('account_number'):
params['bank_account_info']['account_number'] = self._core.encrypt(params['bank_account_info']['account_number'])
cipher_data = True
if params.get('subject_info').get('identity_info'):
id_card_info = params.get('subject_info').get('identity_info').get('id_card_info')
if id_card_info:
id_card_info['id_card_name'] = self._core.encrypt(id_card_info['id_card_name'])
id_card_info['id_card_number'] = self._core.encrypt(id_card_info['id_card_number'])
cipher_data = True
id_card_name = params.get('subject_info').get('identity_info').get('id_card_info', {}).get('id_card_name')
if id_card_name:
params['subject_info']['identity_info']['id_card_info']['id_card_name'] = self._core.encrypt(id_card_name)
id_card_number = params.get('subject_info').get('identity_info').get('id_card_info', {}).get('id_card_number')
if id_card_number:
params['subject_info']['identity_info']['id_card_info']['id_card_number'] = self._core.encrypt(id_card_number)
id_card_address = params.get('subject_info').get('identity_info').get('id_card_info', {}).get('id_card_address')
if id_card_address:
params['subject_info']['identity_info']['id_card_info']['id_card_address'] = self._core.encrypt(id_card_address)
id_doc_name = params.get('subject_info').get('identity_info').get('id_doc_info', {}).get('id_doc_name')
if id_doc_name:
params['subject_info']['identity_info']['id_doc_info']['id_doc_name'] = self._core.encrypt(id_doc_name)
id_doc_number = params.get('subject_info').get('identity_info').get('id_doc_info', {}).get('id_doc_number')
if id_doc_number:
params['subject_info']['identity_info']['id_doc_info']['id_doc_number'] = self._core.encrypt(id_doc_number)
id_doc_address = params.get('subject_info').get('identity_info').get('id_doc_info', {}).get('id_doc_address')
if id_doc_address:
params['subject_info']['identity_info']['id_doc_info']['id_doc_address'] = self._core.encrypt(id_doc_address)
if params.get('subject_info').get('ubo_info_list'):
for ubo_info in params['subject_info']['ubo_info_list']:
ubo_info['ubo_id_doc_name'] = self._core.encrypt(ubo_info['ubo_id_doc_name'])
ubo_info['ubo_id_doc_number'] = self._core.encrypt(ubo_info['ubo_id_doc_number'])
ubo_info['ubo_id_doc_address'] = self._core.encrypt(ubo_info['ubo_id_doc_address'])
params['bank_account_info']['account_name'] = self._core.encrypt(params['bank_account_info']['account_name'])
params['bank_account_info']['account_number'] = self._core.encrypt(params['bank_account_info']['account_number'])
path = '/v3/applyment4sub/applyment/'
return self._core.request(path, method=RequestType.POST, data=params, cipher_data=cipher_data)
return self._core.request(path, method=RequestType.POST, data=params, cipher_data=True)


def applyment_query(self, business_code=None, applyment_id=None):
Expand Down
4 changes: 2 additions & 2 deletions wechatpayv3/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ def request(self, path, method=RequestType.GET, data=None, skip_verify=False, si
elif method == RequestType.PATCH:
response = requests.patch(url=self._gate_way + path, json=data, headers=headers, proxies=self._proxy)
elif method == RequestType.PUT:
response = requests.put(url=self._gate_way + path, json=data, headers=headers, proxies=self._proxy)
response = requests.put(url=self._gate_way + path, json=data, headers=headers, proxies=self._proxy)
elif method == RequestType.DELETE:
response = requests.delete(url=self._gate_way+path, headers=headers, proxies=self._proxy)
response = requests.delete(url=self._gate_way + path, headers=headers, proxies=self._proxy)
else:
raise Exception('wechatpayv3 does no support this request type.')
if self._logger:
Expand Down
2 changes: 1 addition & 1 deletion wechatpayv3/payscore.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ def payscore_refund(self, transaction_id, out_refund_no, amount, reason=None,
:param goods_detail: 退款商品,示例值:{'merchant_goods_id':'1217752501201407033233368018', 'wechatpay_goods_id':'1001', 'goods_name':'iPhone6s 16G', 'unit_price':528800, 'refund_amount':528800, 'refund_quantity':1}
:param notify_url: 通知地址,示例值:'https://www.weixin.qq.com/wxpay/pay.php'
"""
return refund(self,out_refund_no=out_refund_no, amount=amount, transaction_id=transaction_id, reason=reason,
return refund(self, out_refund_no=out_refund_no, amount=amount, transaction_id=transaction_id, reason=reason,
funds_account=funds_account, goods_detail=goods_detail, notify_url=notify_url)


Expand Down
2 changes: 1 addition & 1 deletion wechatpayv3/smartguide.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def guides_query(self, store_id, userid=None, mobile=None, work_id=None, limit=N
raise Exception('store_id is not assigned.')
path = '/v3/smartguide/guides?store_id=%s' % store_id
if userid:
path = '%s&userid=%s' % (path, userid)
path = '%s&userid=%s' % (path, userid)
cipher_data = False
if mobile:
path = '%s&mobile=%s' % (path, self._core.encrypt(mobile))
Expand Down
2 changes: 1 addition & 1 deletion wechatpayv3/transfer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

from .type import RequestType, WeChatPayType
from .type import RequestType


def transfer_batch(self, out_batch_no, batch_name, batch_remark, total_amount, total_num, transfer_detail_list=[], appid=None):
Expand Down

0 comments on commit fc86064

Please sign in to comment.