コード例 #1
0
ファイル: Yeepay.class.php プロジェクト: Cubbon/pigcms
 public function refund()
 {
     if ($this->pay_config["pay_yeepay_merchantaccount"] || $this->pay_config["pay_yeepay_merchantprivatekey"] || $this->pay_config["pay_yeepay_merchantpublickey"] || $this->pay_config["pay_yeepay_yeepaypublickey"] || $this->pay_config["pay_yeepay_productcatalog"]) {
         return array("error" => 1, "msg" => "易宝支付缺少配置信息!请联系管理员处理或选择其他支付方式。");
     }
     import("@.ORG.pay.Yeepay.yeepayMPay");
     $yeepay = new yeepayMPay($this->pay_config["pay_yeepay_merchantaccount"], $this->pay_config["pay_yeepay_merchantpublickey"], $this->pay_config["pay_yeepay_merchantprivatekey"], $this->pay_config["pay_yeepay_yeepaypublickey"]);
     $refund_param = array();
     try {
         $refundResult = $yeepay->refund(floatval($this->pay_money * 100), $this->order_info["order_type"] . "_" . $this->order_info["order_id"], $this->order_info["third_id"]);
         $refund_param["refund_id"] = $refundResult["yborderid"];
         $refund_param["refund_time"] = $refundResult["timestamp"];
         return array("error" => 0, "type" => "ok", "msg" => "退款申请成功!5到10个工作日款项会自动流入您支付时使用的银行卡内。", "refund_param" => $refund_param);
     } catch (yeepayMPayException $e) {
         $refund_param["err_msg"] = "退款时发生错误!<br/>错误提示:" . $e->GetMessage() . "<br/>错误代码:" . $e->Getcode();
         $refund_param["refund_time"] = time();
         return array("error" => 1, "type" => "fail", "msg" => "退款申请失败!如果重试多次还是失败请联系系统管理员。", "refund_param" => $refund_param);
     }
 }