Compare commits

1 Commits

Author SHA1 Message Date
3f58973c30 阶段更新 2023-09-05 10:49:03 +08:00
11 changed files with 92 additions and 23 deletions

View File

@@ -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

View File

@@ -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": [

View File

@@ -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' => '',//产品编码
@@ -11,11 +11,11 @@ return [
'uri' => [ 'uri' => [
'unicom' => [ 'unicom' => [
//下单 //下单
'order' => 'https://epay.10010.com/wappay3.0/httpservice/wapPayPageAction.do?reqcharset=UTF-8', 'order' => 'https://www.unicompayment.com/wappay3.0/httpservice/wapPayPageAction.do?reqcharset=UTF-8',
//查询 //查询
'query' => 'https://epay.10010.com/CashierWeb/query/order.htm?reqCharSet=UTF-8', 'query' => 'https://www.unicompayment.com/CashierWeb/query/order.htm?reqCharSet=UTF-8',
//单笔退款 //单笔退款
'refund' => 'https://epay.10010.com/CashierWeb/trade/singleRefund.htm?reqCharSet=UTF-8', 'refund' => 'https://www.unicompayment.com/CashierWeb/trade/singleRefund.htm?reqCharSet=UTF-8',
], ],
'ysd' => [ 'ysd' => [
'order' => env('APP_URL', 'https://card.ysd-bs.com'), 'order' => env('APP_URL', 'https://card.ysd-bs.com'),
@@ -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', ''),//沃钱包公钥
], ],
]; ];

View File

@@ -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('wo_unicom_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('wo_unicom_webs');
}
}

View File

@@ -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;
} }
@@ -197,7 +196,7 @@ class Init
ksort($params); ksort($params);
$signStr = $this->str2utf8(urldecode(http_build_query($params, '', '|'))); $signStr = $this->str2utf8(urldecode(http_build_query($params, '', '|')));
$signStr .= '|key='.$this->key;
return $signStr; return $signStr;
} }
@@ -207,7 +206,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 = '';

View File

@@ -21,7 +21,7 @@ class Order extends Init
$this->addData(); $this->addData();
$this->setSignData(); $this->setSignData();
return $this->getUnicomData(); return $this->getUnicomData('$');
} }
/** /**

View File

@@ -16,7 +16,7 @@ class Query extends Init
$this->setIsLower(false); $this->setIsLower(false);
$this->addData(); $this->addData();
$this->setSignData(); $this->setSignData();
$url = config('wounicomweb.uri.unicom.query'); $url = config('wounicom.uri.unicom.query');
$this->sendPost($this->params, $url); $this->sendPost($this->params, $url);
return $this->respond(); return $this->respond();
@@ -31,7 +31,7 @@ class Query extends Init
'orderNo' => $order->orderid, 'orderNo' => $order->orderid,
'orderDate' => $order->created_at->format('Ymd'), 'orderDate' => $order->created_at->format('Ymd'),
'charSet' => 'UTF-8', 'charSet' => 'UTF-8',
'signType' => config('wounicomweb.signType'), 'signType' => config('wounicom.signType'),
]; ];
$this->params = $data; $this->params = $data;

View File

@@ -18,7 +18,7 @@ class Refund extends Init
$this->reSetParams(); $this->reSetParams();
$this->setIsLower(false); $this->setIsLower(false);
$this->setSignData(); $this->setSignData();
$url = config('wounicomweb.uri.unicom.refund'); $url = config('wounicom.uri.unicom.refund');
$this->sendPost($this->params, $url); $this->sendPost($this->params, $url);
return $this->respond(); return $this->respond();

View File

@@ -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');
} }
} }

View File

@@ -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

View File

@@ -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;
@@ -95,6 +96,7 @@ class WoUnicomWeb
*/ */
public function callback($inputs) public function callback($inputs)
{ {
info($inputs);
if (empty($inputs)) { if (empty($inputs)) {
return '缺少必要参数'; return '缺少必要参数';
} }
@@ -126,7 +128,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()
@@ -142,6 +144,22 @@ 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 == ActivityMonthOrder::ORDER_UNPAY) {
$payment = Payment::where('orderable_type', get_class($order))
->where('orderable_id', $order->id)
->latest()
->first();
$payment->state = Payment::STATE_SUCCESS;
$payment->out_trade_no = $data['payfloodid'];
$payment->type = Payment::TYPT_UNICOM_WEB;
$payment->paid_at = Carbon::now();
$payment->save();
$order->paid();
}
break;
case 'unicom':
$order = ActivityUnicomOrder::where('orderid', $data['orderid'])->first();
if ($order && $order->state == 'UNPAY') { if ($order && $order->state == '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)
@@ -156,8 +174,8 @@ class WoUnicomWeb
$order->paid(); $order->paid();
} }
break; break;
case 'unicom': case 'month':
$order = ActivityUnicomOrder::where('orderid', $data['orderid'])->first(); $order = ActivityMonthOrder::where('orderid', $data['orderid'])->first();
if ($order && $order->state == 'UNPAY') { if ($order && $order->state == '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)