Пример #1
0
 public function checkReceivedAmount(Payment $payment, $amount)
 {
     $price = $payment->getOrder()->getPrice();
     $currency = $payment->getCurrency()->getId();
     if ($price - $amount > 0.001) {
         $this->paymentFailed($payment, Translate::noop("The paid amount for payment %s is too low; expected %s %s, received %s %s."), [$payment->getFullCode(), $price, $currency, $amount, $currency]);
     }
 }
Пример #2
0
 public function onPaymentFinished(PaymentEvent $event)
 {
     $payment = $event->getPayment();
     $order = $payment->getOrder();
     $logMessage = $order->getStatus() === $order::STATUS_FINISHED_PAID ? Translate::noop("Payment %s received. Order %s set to finished and paid.") : Translate::noop("Payment %s received. Order %s set to finished, but unpaid.");
     $context = [$payment->getFullCode(), $order->getId()];
     $this->logger->log(LogLevel::INFO, "agit.payment", vsprintf(Translate::tl($logMessage), $context));
     $this->addOrderMessage($order, OrderMessage::TYPE_INFO, $logMessage, $context);
 }