我已经成功实施了 Payone 支付网关(Creditcard、Sofort、Paydirect 和 Paypal)。成功付款后,我收到了 txaction 响应(指定并付款),一切都很好。但有时在客户使用付款后我没有收到 Payone 的回复Paypal
(我检查了大约 60 笔成功的交易。但其中 2 或 3 笔交易没有得到回复,并且客户的金额已从他们的帐户中扣除)。
成功交易后,payone 将数据发布到此路线
/* Response from payone */
Route::post('/payment/response', 'PaymentController@response')->name('payment.response');
我认为 laravel 请求没有从 url 捕获数据。或使用此方法有问题Schema::hasColumn
。
任何帮助将不胜感激。
支付控制器.php
public function response(Request $request)
{
// Here I created to store all request in to table but data is not storing.
/* Testing purpose begin */
$payment = new Payment;
foreach($_POST as $key => $value) {
if(Schema::hasColumn($payment->getTable(), $key)){
if(is_array($value)) {
$payment->{$key} = $value[1];
} else {
$payment->{$key} = $value;
}
}
}
$payment->save();
/* Testing purpose end */
if ($_POST["key"] == hash("md5", env('KEY'))) {
echo "TSOK"; // If key is valid, TSOK notification is for PAYONE
$user = Userlist::where('is_delete', 0)
->where('usrActive', '1')
->where('userid', $_POST["userid"])
->first();
if($user && $_POST["clearingtype"] && $_POST["txaction"]) {
$bookings = Booking::select('_id', 'old_booking_id', 'status', 'payment_status')
->where('user', new \MongoDB\BSON\ObjectID($user->_id))
->whereIn('status', ['5', '8', '10', '11']) //5=>Waiting for payment, 8=>Cart, 10=> Temporary (This status is using in edit booking section), 11=> On processing
->where('is_delete', 0)
->where('txid', $_POST["txid"])
->where('userid', $_POST["userid"])
->get();
if($bookings) {
if ($_POST["txaction"] == "appointed") {
update booking status and sent email
}
else if ($_POST["txaction"] == "paid") {
update paid status
}
else {
update failed status
}
}
}
}
}
laravel 日志
[2018-09-11 09:04:14] production.ERROR: Method [error] does not exist on [App\Http\Controllers\PaymentController]. {"userId":"5afa790212236cc4660ed509","exception":"[object] (BadMethodCallException(code: 0): Method [error] does not exist on [App\\Http\\Controllers\\PaymentController]. at /var/www/vhosts/cabin-holiday.frontend/vendor/laravel/framework/src/Illuminate/Routing/Controller.php:68)