feat: 配置支付参数

master
Rmiku 4 weeks ago
parent 1531ad9f01
commit 4f5667bba2
  1. 18
      app/Dictionary/Order/Type.php
  2. 4
      app/Http/Logics/Notify/NotifyLogic.php
  3. 12
      app/Http/Logics/Outpatient/PaymentLogic.php
  4. 6
      app/Http/Logics/Registration/RegisterLogic.php
  5. 57
      config/payment.php
  6. 10
      config/unify.php

@ -41,4 +41,22 @@ enum Type: int
self::INPATIENT_PREPAID_CARD_REFUND => '住院预交金退费'
};
}
/**
* 支付平台订单类型
* @return string
*/
public function unifyOrderType(): string
{
return match ($this) {
self::TODAY_REGISTRATION => 'A',
self::APPOINTMENT_REGISTRATION => 'F',
self::OUTPATIENT_PAYMENT => 'B',
self::INPATIENT_RECHARGE => 'E',
self::OUTPATIENT_PREPAID_CARD_RECHARGE,
self::INPATIENT_PREPAID_CARD_RECHARGE,
self::OUTPATIENT_PREPAID_CARD_REFUND,
self::INPATIENT_PREPAID_CARD_REFUND => 'H'
};
}
}

@ -249,7 +249,7 @@ class NotifyLogic
{
try {
$refund = new RefundOrder($order_id, $refund_order_id, (string)($refund_fee / 100), '确认挂号失败,自动冲正,错误消息:'. $refund_reason);
$response = Unify::common(config('unify'))->order->setMockHandler([new RefundOrderHandler(true)])->refund($refund);
$response = Unify::common(config('unify'))->order->refund($refund);
$this->info('退号退费结果', $response);
if ($response['status'] === 200 || $response['success'] === true) {
@ -337,7 +337,7 @@ class NotifyLogic
{
try {
$query_order = new QueryOrder($order_id);
$response = Unify::common(config('unify'))->order->setMockHandler([new QueryOrderHandler(true)])->query($query_order);
$response = Unify::common(config('unify'))->order->query($query_order);
$this->info('支付平台查询结果', $response);
if ($response['status'] === 200 && $response['success'] === true) {

@ -199,27 +199,27 @@ class PaymentLogic
* 申请支付
* @param Type $order_type
* @param string $order_id
* @param float $reg_fee
* @param float $total_fee
* @param string $patient_id
* @param string $patient_name
* @return array
* @throws GeneralException
*/
protected function applyPayment(Type $order_type, string $order_id, float $reg_fee, string $patient_id, string $patient_name): array
protected function applyPayment(Type $order_type, string $order_id, float $total_fee, string $patient_id, string $patient_name): array
{
try {
$order_obj = new CreateOrder(
$order_type->label(),
$order_id,
(string) $reg_fee,
'1',
(string) $total_fee,
'tag001',
$patient_id. '|'. $patient_name,
'A',
$order_type->unifyOrderType(),
$this->open_id,
url('/Api/Notify', [], true)
);
$response = Unify::pay(config('unify'))->mini->setMockHandler([new CreateOrderHandler(true)])->jsapi($order_obj);
$response = Unify::pay(config('unify'))->mini->jsapi($order_obj);
$this->info('jsapi 支付参数', $response);
if (!$response['success'] || empty($response['response'])) {

@ -295,14 +295,14 @@ class RegisterLogic
$order_type->label(),
$order_id,
(string) $reg_fee,
'1',
'tag001',
$patient_id. '|'. $patient_name,
'A',
$order_type->unifyOrderType(),
$this->open_id,
url('/Api/Notify', [], true)
);
$response = Unify::pay(config('unify'))->mini->setMockHandler([new CreateOrderHandler(true)])->jsapi($order_obj);
$response = Unify::pay(config('unify'))->mini->jsapi($order_obj);
$this->info('jsapi 支付参数', $response);
if (!$response['success'] && empty($response['response'])) {

@ -1,57 +0,0 @@
<?php
return [
// 所有支付超时时间 单位 秒
'overtime' => 120,
// 微信
'wechat' => [
// 公众号 APPID
'app_id' => '',
// 小程序 APPID
'miniapp_id' => '',
// APP 引用的 APPID
'appid' => '',
// 子商户 APP APPID
'sub_appid' => '',
// 微信支付分配的微信商户号
'mch_id' => '',
// 子商户商户号
'sub_mch_id' => '',
// 微信支付异步通知地址
'notify_url' => '',
// 微信支付签名秘钥
'key' => 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB',
// 客户端证书路径,退款、红包等需要用到。请填写绝对路径,linux 请确保权限问题。pem 格式。
'cert_client' => base_path('pem'. DIRECTORY_SEPARATOR. 'apiclient_cert.pem'),
// 客户端秘钥路径,退款、红包等需要用到。请填写绝对路径,linux 请确保权限问题。pem 格式。
'cert_key' => base_path('pem'. DIRECTORY_SEPARATOR. 'apiclient_key.pem'),
// optional 服务商模式
'mode' => 'service',
// optional,默认 warning;日志路径为:sys_get_temp_dir().'/logs/yansongda.pay.log'
'log' => [ // optional
'file' => storage_path('/logs/wechat.log'),
'level' => 'info', // 建议生产环境等级调整为 info,开发环境为 debug
'type' => 'daily', // optional, 可选 daily, daily 时将按时间自动划分文件.
],
// http, 请求option配置 更多配置项请参考 Guzzle 文档
'http' => [
'verify' => false,
'timeout' => 20, // 超时时间 20s
'connect_timeout' => 5.0, // 连接时间 5s
],
],
];

@ -16,9 +16,9 @@ return [
| apiSecret: 应用秘钥
|
*/
'domain' => 'http://fangding.picp.vip:5025',
'domain' => 'http://fangding.picp.vip:7878/',
'apiSecret' => '123456',
'apiSecret' => '16f62721-c156-4514-8743-bd969bed32af',
/*
|--------------------------------------------------------------------------
@ -36,11 +36,11 @@ return [
'channels' => [
'default' => [
'merchantId' => 'QY2Y20230301',
'secret' => 'af4d32227ed4d63e1bb8726ebd0b6110',
'merchantId' => 'ZHXZEY20250124',
'secret' => '94aaadd840a3b97c6bbee4f440b986ce',
'channelId' => 'FD001',
'operatorId' => [
'wx001',
'MN001',
],
]

Loading…
Cancel
Save