Compare commits
3 Commits
55e1cf6b7c
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 31b048a692 | |||
| 95e1f4a163 | |||
| 3f58973c30 |
10
README.md
10
README.md
@@ -1 +1,11 @@
|
|||||||
# 沃支付 WEB收银台支付接口文档
|
# 沃支付 WEB收银台支付接口文档
|
||||||
|
|
||||||
|
测试地址
|
||||||
|
支付:https://www.unicompayment.com/wappay3.0/httpservice/wapPayPageAction.do?reqcharset=UTF-8
|
||||||
|
单笔查询:https://www.unicompayment.com/CashierWeb/query/order.htm?reqCharSet=UTF-8
|
||||||
|
单笔订单退款:https://www.unicompayment.com/CashierWeb/trade/singleRefund.htm?reqCharSet=UTF-8
|
||||||
|
|
||||||
|
正式地址
|
||||||
|
支付:https://epay.10010.com/wappay3.0/httpservice/wapPayPageAction.do?reqcharset=UTF-8
|
||||||
|
单笔查询:https://epay.10010.com/CashierWeb/query/order.htm?reqCharSet=UTF-8
|
||||||
|
单笔订单退款:https://epay.10010.com/CashierWeb/trade/singleRefund.htm?reqCharSet=UTF-8
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xuanchen/wounicomweb",
|
"name": "xuanchen/wounicomweb",
|
||||||
"description": "沃钱包支付-WEB收银台支付接口文档",
|
"description": "沃钱包支付-驰玖",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"homepage": "https://git.yuzhankeji.cn/xuanchen/WoUnicomWeb.git",
|
"homepage": "https://git.yuzhankeji.cn/xuanchen/WoUnicomWeb.git",
|
||||||
"authors": [
|
"authors": [
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'merNo' => env('WO_UNICOM_MERNO', ''),//商户编号
|
'merNo' => env('WO_UNICOM_WEB_MERNO', ''),//商户编号
|
||||||
'storeName' => env('WO_UNICOM_STORENAME', ''),//商户名
|
'storeName' => env('WO_UNICOM_WEB_STORE_NAME', ''),//商户名
|
||||||
'key' => env('WO_UNICOM_KEY', ''),//商户密钥
|
'key' => env('WO_UNICOM_WEB_KEY', ''),//商户密钥
|
||||||
'signType' => 'RSA_SHA256',//签名方式
|
'signType' => 'RSA_SHA256',//签名方式
|
||||||
'woproductcode' => '',//产品编码
|
'woproductcode' => '',//产品编码
|
||||||
|
|
||||||
@@ -25,8 +25,8 @@ return [
|
|||||||
|
|
||||||
//证书地址
|
//证书地址
|
||||||
'certificate' => [
|
'certificate' => [
|
||||||
'private' => env('WO_YSD_KEY_PATH', ''),//本地私钥
|
'private' => env('WO_YSD_KEY_WEB_PATH', ''),//本地私钥
|
||||||
'public' => env('WO_YSD_CERT_PATH', ''),//本地公钥
|
'public' => env('WO_YSD_CERT_WEB_PATH', ''),//本地公钥
|
||||||
'unicom_public' => env('WO_CERT_PATH', ''),//沃钱包公钥
|
'unicom_public' => env('WO_CERT_WEB_PATH', ''),//沃钱包公钥
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateWoUnicomWebsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('wounicom_webs', function (Blueprint $table) {
|
||||||
|
$table->bigIncrements('id');
|
||||||
|
$table->string('orderId')->nullable()->comment('订单号');
|
||||||
|
$table->string('payFloodId')->nullable()->comment('交易流水号');
|
||||||
|
$table->string('payResult')->nullable()->comment('支付结果');
|
||||||
|
$table->string('payBalance')->nullable()->comment('支付金额');
|
||||||
|
$table->string('paymentBalanceDetail')->nullable()->comment('金额明细');
|
||||||
|
$table->string('respTime')->nullable()->comment('支付时间');
|
||||||
|
$table->json('source')->nullable();
|
||||||
|
$table->json('outsource')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('wounicom_webs');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -115,7 +115,6 @@ class Init
|
|||||||
{
|
{
|
||||||
$sign = $this->getSign();
|
$sign = $this->getSign();
|
||||||
$this->params['signMsg'] = $sign;
|
$this->params['signMsg'] = $sign;
|
||||||
|
|
||||||
return $this->params;
|
return $this->params;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,6 +161,7 @@ class Init
|
|||||||
public function getSign(): string
|
public function getSign(): string
|
||||||
{
|
{
|
||||||
$signStr = $this->getSignString();
|
$signStr = $this->getSignString();
|
||||||
|
|
||||||
$private_key = $this->getPrivate();
|
$private_key = $this->getPrivate();
|
||||||
$privKeyId = openssl_get_privatekey($private_key);
|
$privKeyId = openssl_get_privatekey($private_key);
|
||||||
|
|
||||||
@@ -197,7 +197,9 @@ class Init
|
|||||||
|
|
||||||
ksort($params);
|
ksort($params);
|
||||||
$signStr = $this->str2utf8(urldecode(http_build_query($params, '', '|')));
|
$signStr = $this->str2utf8(urldecode(http_build_query($params, '', '|')));
|
||||||
|
$this->signStr = $signStr;
|
||||||
|
|
||||||
|
// $signStr .= '|key='.$this->key;
|
||||||
return $signStr;
|
return $signStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,7 +209,7 @@ class Init
|
|||||||
* @Author: 玄尘
|
* @Author: 玄尘
|
||||||
* @Date : 2021/5/6 8:32
|
* @Date : 2021/5/6 8:32
|
||||||
*/
|
*/
|
||||||
public function getUnicomData($prefix = '$')
|
public function getUnicomData($prefix = '&')
|
||||||
{
|
{
|
||||||
$str = '';
|
$str = '';
|
||||||
|
|
||||||
@@ -320,8 +322,8 @@ class Init
|
|||||||
if ($response->getStatusCode() == 200) {
|
if ($response->getStatusCode() == 200) {
|
||||||
$body = $response->getBody();
|
$body = $response->getBody();
|
||||||
$content = str_replace(["\r\n", "\n", "\r", '/n', "\\n",], '&', $body->getContents());
|
$content = str_replace(["\r\n", "\n", "\r", '/n', "\\n",], '&', $body->getContents());
|
||||||
parse_str($content, $data);
|
|
||||||
|
|
||||||
|
parse_str($content, $data);
|
||||||
$this->data = $data;
|
$this->data = $data;
|
||||||
|
|
||||||
if (isset($data['queryResult']) && $data['queryResult'] != 'SUCCESS') {
|
if (isset($data['queryResult']) && $data['queryResult'] != 'SUCCESS') {
|
||||||
|
|||||||
@@ -20,8 +20,9 @@ class Order extends Init
|
|||||||
{
|
{
|
||||||
$this->addData();
|
$this->addData();
|
||||||
$this->setSignData();
|
$this->setSignData();
|
||||||
|
// dump($this);
|
||||||
return $this->getUnicomData();
|
// dump($this->params);
|
||||||
|
return $this->getUnicomData('$');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace XuanChen\WoUnicomWeb\Action;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Order 查询
|
* Class Order 查询
|
||||||
|
*
|
||||||
* @Author : 玄尘
|
* @Author : 玄尘
|
||||||
* @Date : 2021/4/30 9:34
|
* @Date : 2021/4/30 9:34
|
||||||
* @package XuanChen\Coupon\Action
|
* @package XuanChen\Coupon\Action
|
||||||
@@ -25,7 +26,6 @@ class Query extends Init
|
|||||||
public function addData()
|
public function addData()
|
||||||
{
|
{
|
||||||
$order = $this->params;
|
$order = $this->params;
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'merNo' => $this->merNo,
|
'merNo' => $this->merNo,
|
||||||
'orderNo' => $order->orderid,
|
'orderNo' => $order->orderid,
|
||||||
@@ -35,7 +35,6 @@ class Query extends Init
|
|||||||
];
|
];
|
||||||
|
|
||||||
$this->params = $data;
|
$this->params = $data;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ use Carbon\Carbon;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Order 退款
|
* Class Order 退款
|
||||||
|
*
|
||||||
* @Author : 玄尘
|
* @Author : 玄尘
|
||||||
* @Date : 2021/4/30 9:34
|
* @Date : 2021/4/30 9:34
|
||||||
* @package XuanChen\Coupon\Action
|
* @package XuanChen\Coupon\Action
|
||||||
@@ -29,15 +30,15 @@ class Refund extends Init
|
|||||||
$order = $this->params;
|
$order = $this->params;
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'refundReqJournl' => 'R' . date('YmdHis') . sprintf('%06d', rand(1, 999999999)),
|
'refundReqJournl' => 'R'.date('YmdHis').sprintf('%06d', rand(1, 999999999)),
|
||||||
'merNo' => $this->merNo,
|
'merNo' => $this->merNo,
|
||||||
'orderNo' => $order->orderid,
|
'orderNo' => $order->orderid,
|
||||||
'orderDate' => $order->created_at->format('Ymd'),
|
'orderDate' => $order->created_at->format('Ymd'),
|
||||||
'payJournl' => $order->payment->out_trade_no,
|
'payJournl' => $order->payment->out_trade_no,
|
||||||
'merReqTime' => Carbon::now()->format('YmdHis'),
|
'merReqTime' => Carbon::now()->format('YmdHis'),
|
||||||
'amount' => $order->payment->amount * 100,
|
'amount' => bcmul($order->payment->amount,100),
|
||||||
'reason' => '退款',
|
'reason' => '退款',
|
||||||
'signType' => 'RSA_SHA256',
|
'signType' => config('wounicomweb.signType'),
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->params = $data;
|
$this->params = $data;
|
||||||
|
|||||||
@@ -16,10 +16,11 @@ class ServiceProvider extends LaravelServiceProvider
|
|||||||
{
|
{
|
||||||
if ($this->app->runningInConsole()) {
|
if ($this->app->runningInConsole()) {
|
||||||
$this->publishes([__DIR__.'/../config/config.php' => config_path('wounicomweb.php')]);
|
$this->publishes([__DIR__.'/../config/config.php' => config_path('wounicomweb.php')]);
|
||||||
|
$this->loadMigrationsFrom(__DIR__.'/../database/migrations/');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->app->bind('xuanchen.wounicomweb', function ($app) {
|
$this->app->bind('xuanchen.wounicomweb', function ($app) {
|
||||||
return new WoUnicom();
|
return new WoUnicomWeb();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,7 +31,7 @@ class ServiceProvider extends LaravelServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
$this->mergeConfigFrom(__DIR__.'/../config/config.php', 'wounicom');
|
$this->mergeConfigFrom(__DIR__.'/../config/config.php', 'wounicomweb');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace XuanChen\WoUnicomWeb\Traits;
|
namespace XuanChen\WoUnicomWeb\Traits;
|
||||||
|
|
||||||
use XuanChen\WoUnicomWeb\Model\Wounicom as LogModel;
|
use XuanChen\WoUnicomWeb\Model\WounicomWeb as LogModel;
|
||||||
|
|
||||||
trait Log
|
trait Log
|
||||||
{
|
{
|
||||||
@@ -11,6 +11,7 @@ trait Log
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Notes: 输入日志
|
* Notes: 输入日志
|
||||||
|
*
|
||||||
* @Author: 玄尘
|
* @Author: 玄尘
|
||||||
* @Date : 2021/5/11 15:58
|
* @Date : 2021/5/11 15:58
|
||||||
* @param $data
|
* @param $data
|
||||||
@@ -33,6 +34,7 @@ trait Log
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Notes: 更新
|
* Notes: 更新
|
||||||
|
*
|
||||||
* @Author: 玄尘
|
* @Author: 玄尘
|
||||||
* @Date : 2021/7/23 11:03
|
* @Date : 2021/7/23 11:03
|
||||||
* @param $data
|
* @param $data
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace XuanChen\WoUnicomWeb;
|
namespace XuanChen\WoUnicomWeb;
|
||||||
|
|
||||||
use App\Helpers\Helper;
|
use App\Helpers\Helper;
|
||||||
|
use App\Models\ActivityMonthOrder;
|
||||||
use App\Models\ActivitySchoolOrder;
|
use App\Models\ActivitySchoolOrder;
|
||||||
use App\Models\ActivityPetroOrder;
|
use App\Models\ActivityPetroOrder;
|
||||||
use App\Models\ActivityUnicomOrder;
|
use App\Models\ActivityUnicomOrder;
|
||||||
@@ -126,7 +127,7 @@ class WoUnicomWeb
|
|||||||
break;
|
break;
|
||||||
case 'school':
|
case 'school':
|
||||||
$order = ActivitySchoolOrder::where('orderid', $data['orderid'])->first();
|
$order = ActivitySchoolOrder::where('orderid', $data['orderid'])->first();
|
||||||
if ($order && $order->state == 'UNPAY') {
|
if ($order && $order->state == ActivitySchoolOrder::ORDER_UNPAY) {
|
||||||
$payment = Payment::where('orderable_type', get_class($order))
|
$payment = Payment::where('orderable_type', get_class($order))
|
||||||
->where('orderable_id', $order->id)
|
->where('orderable_id', $order->id)
|
||||||
->latest()
|
->latest()
|
||||||
@@ -134,7 +135,7 @@ class WoUnicomWeb
|
|||||||
|
|
||||||
$payment->state = 'SUCCESS';
|
$payment->state = 'SUCCESS';
|
||||||
$payment->out_trade_no = $data['payfloodid'];
|
$payment->out_trade_no = $data['payfloodid'];
|
||||||
$payment->type = 'UNICOM';
|
$payment->type = Payment::TYPE_UNICOM_WEB;
|
||||||
$payment->paid_at = Carbon::now();
|
$payment->paid_at = Carbon::now();
|
||||||
$payment->save();
|
$payment->save();
|
||||||
$order->paid();
|
$order->paid();
|
||||||
@@ -142,15 +143,15 @@ class WoUnicomWeb
|
|||||||
break;
|
break;
|
||||||
case 'petro':
|
case 'petro':
|
||||||
$order = ActivityPetroOrder::where('orderid', $data['orderid'])->first();
|
$order = ActivityPetroOrder::where('orderid', $data['orderid'])->first();
|
||||||
if ($order && $order->state == 'UNPAY') {
|
if ($order && $order->state == ActivityMonthOrder::ORDER_UNPAY) {
|
||||||
$payment = Payment::where('orderable_type', get_class($order))
|
$payment = Payment::where('orderable_type', get_class($order))
|
||||||
->where('orderable_id', $order->id)
|
->where('orderable_id', $order->id)
|
||||||
->latest()
|
->latest()
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
$payment->state = 'SUCCESS';
|
$payment->state = Payment::STATE_SUCCESS;
|
||||||
$payment->out_trade_no = $data['payfloodid'];
|
$payment->out_trade_no = $data['payfloodid'];
|
||||||
$payment->type = 'UNICOM';
|
$payment->type = Payment::TYPE_UNICOM_WEB;
|
||||||
$payment->paid_at = Carbon::now();
|
$payment->paid_at = Carbon::now();
|
||||||
$payment->save();
|
$payment->save();
|
||||||
$order->paid();
|
$order->paid();
|
||||||
@@ -166,7 +167,23 @@ class WoUnicomWeb
|
|||||||
|
|
||||||
$payment->state = 'SUCCESS';
|
$payment->state = 'SUCCESS';
|
||||||
$payment->out_trade_no = $data['payfloodid'];
|
$payment->out_trade_no = $data['payfloodid'];
|
||||||
$payment->type = 'UNICOM';
|
$payment->type = Payment::TYPE_UNICOM_WEB;
|
||||||
|
$payment->paid_at = Carbon::now();
|
||||||
|
$payment->save();
|
||||||
|
$order->paid();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'month':
|
||||||
|
$order = ActivityMonthOrder::where('orderid', $data['orderid'])->first();
|
||||||
|
if ($order && $order->state == 'UNPAY') {
|
||||||
|
$payment = Payment::where('orderable_type', get_class($order))
|
||||||
|
->where('orderable_id', $order->id)
|
||||||
|
->latest()
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$payment->state = 'SUCCESS';
|
||||||
|
$payment->out_trade_no = $data['payfloodid'];
|
||||||
|
$payment->type = Payment::TYPE_UNICOM_WEB;
|
||||||
$payment->paid_at = Carbon::now();
|
$payment->paid_at = Carbon::now();
|
||||||
$payment->save();
|
$payment->save();
|
||||||
$order->paid();
|
$order->paid();
|
||||||
|
|||||||
Reference in New Issue
Block a user