diff --git a/wechat/doc/index.rst b/wechat/doc/index.rst index 13a53b7ee4..a3aebe2f98 100644 --- a/wechat/doc/index.rst +++ b/wechat/doc/index.rst @@ -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. diff --git a/wechat/models/ir_config_parameter.py b/wechat/models/ir_config_parameter.py index 3cf0339fbf..476f35142d 100644 --- a/wechat/models/ir_config_parameter.py +++ b/wechat/models/ir_config_parameter.py @@ -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 diff --git a/wechat/models/wechat_order.py b/wechat/models/wechat_order.py index 34bd246c51..7c8edf4d7f 100644 --- a/wechat/models/wechat_order.py +++ b/wechat/models/wechat_order.py @@ -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, } @@ -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 )