Skip to content

Commit

Permalink
💣
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Yelizariev committed Jul 12, 2018
1 parent 86bf188 commit e2c9b02
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
6 changes: 3 additions & 3 deletions wechat/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ Configuration

* ``wechat.app_id``
* ``wechat.app_secret``
* ``wechat.vendor_id``
* ``wechat.sandbox`` -- set to ``0`` to disable and any other value to
activate. It's disabled by default.
* ``wechat.mch_id`` -- *Vendor ID*
* ``wechat.sub_mch_id`` -- *Sub Vendor ID*
* ``wechat.sandbox`` -- set to ``0`` or delete to disable. Any other value to means that sandbox is activated.
16 changes: 14 additions & 2 deletions wechat/models/ir_config_parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,24 @@ def get_wechat_pay_object(self):
if sandbox:
_logger.info('Sandbox Mode is used for WeChat API')

print ('ARGS', (
self.get_param('wechat.app_id'),
self.get_param('wechat.app_secret'),
self.get_param('wechat.mch_id'),
sandbox,
self.get_param('wechat.sub_mch_id'),
# TODO rest args
# self.sub_mch_id = sub_mch_id
# self.mch_cert = mch_cert
# self.mch_key = mch_key
# self.timeout = timeout
))
return WeChatPay(
self.get_param('wechat.app_id'),
self.get_param('wechat.app_secret'),
self.get_param('wechat.vendor_id'),
self.get_param('wechat.mch_id'),
sandbox=sandbox,
sub_mch_id=self.get_param('wechat.vendor_id'), # TODO make separate param. Keep this only for testing
sub_mch_id=self.get_param('wechat.sub_mch_id'),
# TODO rest args
# self.sub_mch_id = sub_mch_id
# self.mch_cert = mch_cert
Expand Down
3 changes: 2 additions & 1 deletion wechat/models/wechat_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def create_qr(self, lines, total_fee, create_vals=None, **kwargs):
"""
debug = self.env['ir.config_parameter'].get_param('wechat.local_sandbox') == '1'
vals = {
'trade_type': 'NATIVE',
'line_ids': [(0, 0, data) for data in lines],
'debug': debug,
}
Expand Down Expand Up @@ -145,7 +146,7 @@ def create_qr(self, lines, total_fee, create_vals=None, **kwargs):
total_fee,
body,
total_fee,
self._notify_url,
self._notify_url(),
out_trade_no=order.id,
# TODO fee_type=record.currency_id.name
)
Expand Down

0 comments on commit e2c9b02

Please sign in to comment.