支付mock笔记(二)

修改alipay源码(以修改php文件为例,app端)

  • 修改xxxxcom/ThinkPHP/Extend/Vendor/SdkAlipay/alipay_notify.class.php 文件

    1
    2
    3
    4
    5
    6
    7
    8
    9
    function verifyNotify()
    注释(//$isSign = $this->getSignVeryfy($_POST, $_POST["sign"]);)
    添加 $isSign = true;
    注释( //if (! empty($_POST["notify_id"])) {$responseTxt = $this->getResponse($_POST["notify_id"]);})
    function verifyReturn()
    注释(//$isSign = $this->getSignVeryfy($_REQUEST, $_REQUEST["sign"]);)
    添加 $isSign = true;
    注释( //if (! empty($_POST["notify_id"])) {$responseTxt = $this->getResponse($_POST["notify_id"]);})
  • 修改xxxxcom/Gate/handler/AliPayApp/PayHandler.class.php

    1
    2
    3
    4
    5
    function verifyReturn()
    //判断验证是否通过和合法
    注释 $is_from_alipay = file_get_contents("https://mapi.alipay.com/gateway.do?service=notify_verify&partner=" . $config['partner'] . "&notify_id=" . $_POST['notif
    y_id']);
    添加 $is_from_alipay = 'true';
1
2
com/Conf/config.php add 'GATEWAY_USER_AGENT'=> 'wushi',
rm -rf /xxxcom/Runtime/*
  • 配置host
    192.168.149.34 mapi.alipay.com

    修改银联支付源码(以修改php文件为例,pc端)

  • 修改xxxxcom/ThinkPHP/Extend/Vendor/UnionPayApp/sdk/BackReceive.php

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    /*
    if($result['code'] != self::RESULT_OK) {
    return self::returnM(self::RESULT_ERROR, null, $cTrace, $result['trace'], $result['errMsg']);
    }
    if(self::isRespCodeSuccess($response['respCode']) == false) {
    return self::returnM(self::RESULT_ERROR, null, $cTrace, null, '回调支付状态为不成功');
    }
    */
    注释加密校验
  • 修改xxxxcom/Conf/debug.php
    将所有回调url的IP/端口改成“http://192.168.143.171:8139”

  • 配置host
    192.168.149.34 gateway.95516.com

修改银联支付源码(app端涉及文件)

/Conf/escrow.php:

  • https://gateway.95516.com/gateway/api/appTransReq.do (URL请求订单)
  • vim ThinkPHP/Extend/Vendor/UnionPayApp/sdk/UnionPayAppBase.php (银联支付基于rpc请求)
  • vim ThinkPHP/Extend/Vendor/UnionPayApp/sdk/AppConsume.php (下发订单到银联支付)

修改微信支付源码(以修改php文件为例,pc端)

  • 修改xxxxcom/Gate/handler/WeixinPay/PayHandler.class.php

    1
    2
    注释加密校验, line 194
    if($notify->checkSign() == false) {
  • 服务端配置host
    192.168.149.34 api.mch.weixin.qq.com

    • 或者修改xxxxcom/ThinkPHP/Extend/Vendor/WxPay/UnifiedOrderPub.php
      1
      2
      $this->url = 'https://api.mch.weixin.qq.com/pay/unifiedorder';
      to $this->url = 'https://192.168.149.34/pay/unifiedorder';
  • 修改页面xxxxcom/Apps/User/View/Pay/pc_wxpay.html

    1
    2
    3
    4
    5
    修改生成QRjs:
    function createQrCode(code_url) {
    $(".code").html('<br><br><br><br><br><br><a href='+ code_url +' target="_blank" style="background: none repeat scroll 0 0 #ff464e;color: #fff;font-family: &quot
    ;微软雅黑&quot;,&quot;宋体&quot;;font-size: 20px;text-align: center;width: 180px;height: 50px;line-height: 50px;border-radius: 3px;">Weixin Pay</a>');
    }

修改一网通支付源码(以修改php文件为例,app端)

  • 修改xxxxcom/Gate/handler/CmbOneNet/PayHandler.class.php
    1
    2
    3
    4
    verifyReturn
    注释加密校验
    //$isVerify = $obj->verifyPaNotify($notifyStr);
    $isVerify = true;

or:
修改xxxxcom/ThinkPHP/Extend/Vendor/CmbOneNet/CmbOneNet.php

1
2
3
verifyPaNotify
//return $isSuccess === true;
return true;

  • xxxxcom/Conf/config.php add ‘GATEWAY_USER_AGENT’=> ‘wushi’,
    rm -rf /xxxxcom/Runtime/*

  • 配置host
    192.168.149.34 netpay.cmbchina.com