|
@@ -9,6 +9,8 @@ |
|
@@ -9,6 +9,8 @@ |
|
9
|
|
9
|
|
|
10
|
namespace App\Helper;
|
10
|
namespace App\Helper;
|
|
11
|
|
11
|
|
|
|
|
12
|
+use App\Models\ExtentModule\ExtensionModuleValue;
|
|
|
|
13
|
+
|
|
12
|
class PayStripeApi
|
14
|
class PayStripeApi
|
|
13
|
{
|
15
|
{
|
|
14
|
private $secretKey;
|
16
|
private $secretKey;
|
|
@@ -169,13 +171,12 @@ class PayStripeApi |
|
@@ -169,13 +171,12 @@ class PayStripeApi |
|
169
|
switch ($eventType) {
|
171
|
switch ($eventType) {
|
|
170
|
case 'payment_intent.succeeded':
|
172
|
case 'payment_intent.succeeded':
|
|
171
|
// 处理支付成功逻辑
|
173
|
// 处理支付成功逻辑
|
|
172
|
- @file_put_contents(storage_path('logs/lyh_error.log'), var_export('success', true) . PHP_EOL, FILE_APPEND);
|
|
|
|
173
|
- @file_put_contents(storage_path('logs/lyh_error.log'), var_export($eventType, true) . PHP_EOL, FILE_APPEND);
|
|
|
|
174
|
- @file_put_contents(storage_path('logs/lyh_error.log'), var_export($eventData, true) . PHP_EOL, FILE_APPEND);
|
|
|
|
175
|
$paymentIntentId = $eventData['id'];
|
174
|
$paymentIntentId = $eventData['id'];
|
|
|
|
175
|
+ self::getExtensionInfo($paymentIntentId,$eventData);
|
|
176
|
break;
|
176
|
break;
|
|
177
|
case 'payment_intent.payment_failed':
|
177
|
case 'payment_intent.payment_failed':
|
|
178
|
// 处理支付失败逻辑
|
178
|
// 处理支付失败逻辑
|
|
|
|
179
|
+ @file_put_contents(storage_path('logs/lyh_error.log'), var_export($eventData, true) . PHP_EOL, FILE_APPEND);
|
|
179
|
$error = $eventData['last_payment_error'];
|
180
|
$error = $eventData['last_payment_error'];
|
|
180
|
break;
|
181
|
break;
|
|
181
|
case 'charge.refunded':
|
182
|
case 'charge.refunded':
|
|
@@ -192,6 +193,28 @@ class PayStripeApi |
|
@@ -192,6 +193,28 @@ class PayStripeApi |
|
192
|
}
|
193
|
}
|
|
193
|
|
194
|
|
|
194
|
/**
|
195
|
/**
|
|
|
|
196
|
+ * @remark :根据id获取当前数据详情
|
|
|
|
197
|
+ * @name :getExtensionInfo
|
|
|
|
198
|
+ * @author :lyh
|
|
|
|
199
|
+ * @method :post
|
|
|
|
200
|
+ * @time :2024/12/25 14:43
|
|
|
|
201
|
+ */
|
|
|
|
202
|
+ public static function getExtensionInfo($id,$eventData){
|
|
|
|
203
|
+ $extensionModel = new ExtensionModuleValue();
|
|
|
|
204
|
+ $info = $extensionModel->read(['value'=>$id]);
|
|
|
|
205
|
+ if($info === false){
|
|
|
|
206
|
+ @file_put_contents(storage_path('logs/lyh_3059_error.log'), var_export($id.':当前数据错误', true) . PHP_EOL, FILE_APPEND);
|
|
|
|
207
|
+ }
|
|
|
|
208
|
+ //组装数据保存
|
|
|
|
209
|
+ $data = [
|
|
|
|
210
|
+ ['uuid'=>$info['uuid'],'module_id'=>$info['module_id'],'field_id'=>6,'value'=>'success'],
|
|
|
|
211
|
+ ['uuid'=>$info['uuid'],'module_id'=>$info['module_id'],'field_id'=>7,'value'=>json_encode($eventData)],
|
|
|
|
212
|
+ ];
|
|
|
|
213
|
+ $moduleValueModel = new ExtensionModuleValue();
|
|
|
|
214
|
+ $moduleValueModel->insertAll($data);
|
|
|
|
215
|
+ }
|
|
|
|
216
|
+
|
|
|
|
217
|
+ /**
|
|
195
|
* @remark :验证签名
|
218
|
* @remark :验证签名
|
|
196
|
* @name :verifySignature
|
219
|
* @name :verifySignature
|
|
197
|
* @author :lyh
|
220
|
* @author :lyh
|