2 Commits
1.0.0 ... 1.0.2

Author SHA1 Message Date
31b048a692 调整变量名 2023-09-08 08:04:40 +08:00
95e1f4a163 调整支付 2023-09-06 11:22:06 +08:00
8 changed files with 26 additions and 23 deletions

View File

@@ -11,11 +11,11 @@ return [
'uri' => [
'unicom' => [
//下单
'order' => 'https://www.unicompayment.com/wappay3.0/httpservice/wapPayPageAction.do?reqcharset=UTF-8',
'order' => 'https://epay.10010.com/wappay3.0/httpservice/wapPayPageAction.do?reqcharset=UTF-8',
//查询
'query' => 'https://www.unicompayment.com/CashierWeb/query/order.htm?reqCharSet=UTF-8',
'query' => 'https://epay.10010.com/CashierWeb/query/order.htm?reqCharSet=UTF-8',
//单笔退款
'refund' => 'https://www.unicompayment.com/CashierWeb/trade/singleRefund.htm?reqCharSet=UTF-8',
'refund' => 'https://epay.10010.com/CashierWeb/trade/singleRefund.htm?reqCharSet=UTF-8',
],
'ysd' => [
'order' => env('APP_URL', 'https://card.ysd-bs.com'),

View File

@@ -13,7 +13,7 @@ class CreateWoUnicomWebsTable extends Migration
*/
public function up()
{
Schema::create('wo_unicom_webs', function (Blueprint $table) {
Schema::create('wounicom_webs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('orderId')->nullable()->comment('订单号');
$table->string('payFloodId')->nullable()->comment('交易流水号');
@@ -34,6 +34,6 @@ class CreateWoUnicomWebsTable extends Migration
*/
public function down()
{
Schema::dropIfExists('wo_unicom_webs');
Schema::dropIfExists('wounicom_webs');
}
}

View File

@@ -161,6 +161,7 @@ class Init
public function getSign(): string
{
$signStr = $this->getSignString();
$private_key = $this->getPrivate();
$privKeyId = openssl_get_privatekey($private_key);
@@ -196,7 +197,9 @@ class Init
ksort($params);
$signStr = $this->str2utf8(urldecode(http_build_query($params, '', '|')));
$signStr .= '|key='.$this->key;
$this->signStr = $signStr;
// $signStr .= '|key='.$this->key;
return $signStr;
}
@@ -319,8 +322,8 @@ class Init
if ($response->getStatusCode() == 200) {
$body = $response->getBody();
$content = str_replace(["\r\n", "\n", "\r", '/n', "\\n",], '&', $body->getContents());
parse_str($content, $data);
parse_str($content, $data);
$this->data = $data;
if (isset($data['queryResult']) && $data['queryResult'] != 'SUCCESS') {

View File

@@ -20,7 +20,8 @@ class Order extends Init
{
$this->addData();
$this->setSignData();
// dump($this);
// dump($this->params);
return $this->getUnicomData('$');
}

View File

@@ -4,6 +4,7 @@ namespace XuanChen\WoUnicomWeb\Action;
/**
* Class Order 查询
*
* @Author : 玄尘
* @Date : 2021/4/30 9:34
* @package XuanChen\Coupon\Action
@@ -16,7 +17,7 @@ class Query extends Init
$this->setIsLower(false);
$this->addData();
$this->setSignData();
$url = config('wounicom.uri.unicom.query');
$url = config('wounicomweb.uri.unicom.query');
$this->sendPost($this->params, $url);
return $this->respond();
@@ -25,17 +26,15 @@ class Query extends Init
public function addData()
{
$order = $this->params;
$data = [
'merNo' => $this->merNo,
'orderNo' => $order->orderid,
'orderDate' => $order->created_at->format('Ymd'),
'charSet' => 'UTF-8',
'signType' => config('wounicom.signType'),
'signType' => config('wounicomweb.signType'),
];
$this->params = $data;
}
}

View File

@@ -6,6 +6,7 @@ use Carbon\Carbon;
/**
* Class Order 退款
*
* @Author : 玄尘
* @Date : 2021/4/30 9:34
* @package XuanChen\Coupon\Action
@@ -18,7 +19,7 @@ class Refund extends Init
$this->reSetParams();
$this->setIsLower(false);
$this->setSignData();
$url = config('wounicom.uri.unicom.refund');
$url = config('wounicomweb.uri.unicom.refund');
$this->sendPost($this->params, $url);
return $this->respond();
@@ -29,15 +30,15 @@ class Refund extends Init
$order = $this->params;
$data = [
'refundReqJournl' => 'R' . date('YmdHis') . sprintf('%06d', rand(1, 999999999)),
'refundReqJournl' => 'R'.date('YmdHis').sprintf('%06d', rand(1, 999999999)),
'merNo' => $this->merNo,
'orderNo' => $order->orderid,
'orderDate' => $order->created_at->format('Ymd'),
'payJournl' => $order->payment->out_trade_no,
'merReqTime' => Carbon::now()->format('YmdHis'),
'amount' => $order->payment->amount * 100,
'amount' => bcmul($order->payment->amount,100),
'reason' => '退款',
'signType' => 'RSA_SHA256',
'signType' => config('wounicomweb.signType'),
];
$this->params = $data;

View File

@@ -96,7 +96,6 @@ class WoUnicomWeb
*/
public function callback($inputs)
{
info($inputs);
if (empty($inputs)) {
return '缺少必要参数';
}
@@ -136,7 +135,7 @@ class WoUnicomWeb
$payment->state = 'SUCCESS';
$payment->out_trade_no = $data['payfloodid'];
$payment->type = 'UNICOM';
$payment->type = Payment::TYPE_UNICOM_WEB;
$payment->paid_at = Carbon::now();
$payment->save();
$order->paid();
@@ -152,7 +151,7 @@ class WoUnicomWeb
$payment->state = Payment::STATE_SUCCESS;
$payment->out_trade_no = $data['payfloodid'];
$payment->type = Payment::TYPT_UNICOM_WEB;
$payment->type = Payment::TYPE_UNICOM_WEB;
$payment->paid_at = Carbon::now();
$payment->save();
$order->paid();
@@ -168,7 +167,7 @@ class WoUnicomWeb
$payment->state = 'SUCCESS';
$payment->out_trade_no = $data['payfloodid'];
$payment->type = 'UNICOM';
$payment->type = Payment::TYPE_UNICOM_WEB;
$payment->paid_at = Carbon::now();
$payment->save();
$order->paid();
@@ -184,7 +183,7 @@ class WoUnicomWeb
$payment->state = 'SUCCESS';
$payment->out_trade_no = $data['payfloodid'];
$payment->type = 'UNICOM';
$payment->type = Payment::TYPE_UNICOM_WEB;
$payment->paid_at = Carbon::now();
$payment->save();
$order->paid();