private function isNotPaidOrder($customerId, $orderId) { $orders = PaymentCloud::getCustomersPaidOrders($customerId); if (!in_array($orderId, $orders)) { return true; } return false; }
/** * процессинг по запросу fail * помечает заказ ожидающую транзакцию как не успешную */ private function processPayFail() { $params = $this->parameters(); $pay = PaymentCloud::whereCustomerId($params['customer_id'])->whereOrderId($params['order_id'])->wherePaymentId($params['payment_id'])->whereWaiting(1)->first(); if ($pay) { $pay->failed = 1; $pay->request = $params['request']; $pay->save(); } return Redirect::to('/account')->withErrors(['payment' => trans('main.Order payment is failed')]); }
private function isOrderPayWaiting($id) { $api = new Api(); // проверим, что заказ не находится в процессинге оплаты $cloud = PaymentCloud::getInProcessing($id); if ($cloud) { Reporter::payInitOrderLocked($id, $api->id(), $cloud->waiting, $cloud->exported); // если заказ ожидает коллбэка от шлюза if ($cloud->waiting == 1) { $m = trans('main.order starting payment'); return Response::json(['data' => ['repeatText' => trans('main.order continue payment')], 'errors' => [$m], 'message' => $m], 409); } $m = trans('main.order waiting payment'); return Response::json(['errors' => [$m], 'message' => $m], 423); } return true; }
public function initExistsPaid() { $this->existsPaid = PaymentCloud::whereCustomerId($this->agbis_id)->payed()->exists(); return $this->existsPaid; }
/** * подтверждение от Агента, что транзакция была обработана * по всем транзакциям, которые прежде были выгружены с этим guid * * @param string $guid */ private function processAgentCommit($guid) { // флаг запуска именно этого процесса $doCommit = Input::get('SavePay', null); if (null === $doCommit) { return; } Log::debug('agent commit payment request process', ['guid' => $guid]); $qnt = PaymentCloud::whereGuid($guid)->count(); Log::debug('search transactions for commit', ['qnt' => $qnt]); if (0 == $qnt) { Log::debug('response error', []); Response::json(['error' => 1])->send(); die; } PaymentCloud::whereGuid($guid)->update(['exported' => 1, 'exported_at' => DB::raw('NOW()')]); $xml = new GenerateAgentXML(); $xml->addEl('Error', 0); $xml->output(); Log::debug('response commit xml', []); die; }