Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

关于小程序退款报appid参数长度不够的bug #43

Closed
yelv123 opened this issue Dec 18, 2017 · 3 comments
Closed

关于小程序退款报appid参数长度不够的bug #43

yelv123 opened this issue Dec 18, 2017 · 3 comments

Comments

@yelv123
Copy link

yelv123 commented Dec 18, 2017

问题描述

使用这个包时,对小程序的小程序的订单退款时会报appid参数长度不够,不管设置成appid 还是 miniapp_id

代码

protected function getResult($end_point, $cert = false)
{
$this->config['sign'] = $this->getSign($this->config);

    if ($cert) {
        $data = $this->fromXml($this->post(
            $end_point,
            $this->toXml($this->config),
            [
                'cert'    => $this->user_config->get('cert_client', ''),
                'ssl_key' => $this->user_config->get('cert_key', ''),
            ]
        ));
    } else {
        $data = $this->fromXml($this->post($end_point, $this->toXml($this->config)));
    }

    if (!isset($data['return_code']) || $data['return_code'] !== 'SUCCESS' || $data['result_code'] !== 'SUCCESS') {
        $error = 'getResult error:'.$data['return_msg'];
        $error .= isset($data['err_code_des']) ? ' - '.$data['err_code_des'] : '';
    }

    if (!isset($error) && $this->getSign($data) !== $data['sign']) {
        $error = 'getResult error: return data sign error';
    }

    if (isset($error)) {
        throw new GatewayException(
            $error,
            20000,
            $data);
    }

    return $data;
}

报错详情

getResult error:appid参数长度有误

参考解决办法

wechat.php 文件的够着函数接收 小程序的appid

$this->config = [
'appid' =>empty($this->user_config->get('app_id', ''))?$this->user_config->get('miniapp_id', ''):$this->user_config->get('app_id', ''),
'mch_id' => $this->user_config->get('mch_id', ''),
'nonce_str' => $this->createNonceStr(),
'sign_type' => 'MD5',
'notify_url' => $this->user_config->get('notify_url', ''),
'trade_type' => $this->getTradeType(),
];

@yansongda
Copy link
Owner

晚些时候将修复。

感谢您的支持!

@yansongda yansongda changed the title 关于小程序退款宝appid参数长度不够的bug 关于小程序退款报appid参数长度不够的bug Dec 18, 2017
@yansongda
Copy link
Owner

如果您线上环境 php>=7.0 ,您可使用 v2.0.0-beta 版本。最新的版本已经修复。

v1.x 版本将在晚些时候修复

感谢您的支持!

yansongda added a commit that referenced this issue Dec 26, 2017
@yansongda
Copy link
Owner

v1.x 版本已修复。

如果需要退款小程序的订单,请在 $config_biz 中传入"miniapp" => true。可参考 v2.x 版本的使用方法。

感谢您的支持!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants