get() публичный Метод

public get ( string $name, mixed $default = null ) : mixed
$name string
$default mixed
Результат mixed
Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function getOrderReference(TransactionInterface $transaction)
 {
     return $transaction->get('reference');
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function isRequestValid(TransactionInterface $transaction)
 {
     return $transaction->get('check') === $this->generateUrlCheck($transaction->getOrder());
 }
Пример #3
0
 /**
  * @param TransactionInterface $transaction
  *
  * @throws \RuntimeException
  *
  * @return array
  */
 private function getResponseData(TransactionInterface $transaction)
 {
     $cmd = sprintf('cd %s && %s pathfile=%s message=%s ', $this->getOption('base_folder'), $this->getOption('response_command'), $this->getOption('pathfile'), $this->encodeString($transaction->get('DATA')));
     $this->logger->debug(sprintf('Response Command : %s', $cmd));
     $process = new Process($cmd);
     $process->run();
     if (!$process->isSuccessful()) {
         throw new \RuntimeException(sprintf('Error %d when executing Scellius command: "%s".', $process->getExitCode(), trim($process->getErrorOutput())));
     }
     //Sortie de la fonction : !code!error!v1!v2!v3!...!v29
     //  - code = 0  : la fonction retourne les données de la transaction dans les variables v1, v2, ...
     //              : Ces variables sont décrites dans le GUIDE DU PROGRAMMEUR
     //  - code = -1 : La fonction retourne un message d'erreur dans la variable error
     $data = explode('!', $process->getOutput());
     if (count($data) != 33) {
         throw new \RuntimeException('Invalid data count');
     }
     return array('code' => $data[1], 'error' => $data[2], 'merchant_id' => $data[3], 'merchant_country' => $data[4], 'amount' => $data[5], 'transaction_id' => $data[6], 'payment_means' => $data[7], 'transmission_date' => $data[8], 'payment_time' => $data[9], 'payment_date' => $data[10], 'response_code' => $data[11], 'payment_certificate' => $data[12], 'authorisation_id' => $data[13], 'currency_code' => $data[14], 'card_number' => $data[15], 'cvv_flag' => $data[16], 'cvv_response_code' => $data[17], 'bank_response_code' => $data[18], 'complementary_code' => $data[19], 'complementary_info' => $data[20], 'return_context' => $data[21], 'caddie' => $data[22], 'receipt_complement' => $data[23], 'merchant_language' => $data[24], 'language' => $data[25], 'customer_id' => $data[26], 'order_id' => $data[27], 'customer_email' => $data[28], 'customer_ip_address' => $data[29], 'capture_day' => $data[30], 'capture_mode' => $data[31], 'data' => $data[32]);
 }
Пример #4
0
 /**
  * return the order reference from the transaction object
  *
  * @param  TransactionInterface $transaction
  * @return string
  */
 public function getOrderReference(TransactionInterface $transaction)
 {
     $order = $transaction->get('order', null);
     if ($this->getLogger()) {
         $this->getLogger()->notice(sprintf("[BasePaypalPayment::loadOrder] order=%s", $order));
     }
     return $order;
 }
Пример #5
0
 /**
  * {@inheritdoc}
  */
 public function handleError(TransactionInterface $transaction)
 {
     $order = $transaction->getOrder();
     switch ($transaction->getStatusCode()) {
         case TransactionInterface::STATUS_ORDER_UNKNOWN:
             if ($this->getLogger()) {
                 $this->getLogger()->emergency('[Paypal:handlerError] ERROR_ORDER_UNKNOWN');
             }
             break;
         case TransactionInterface::STATUS_ERROR_VALIDATION:
             if ($this->getLogger()) {
                 $this->getLogger()->emergency(sprintf('[Paypal:handlerError] STATUS_ERROR_VALIDATION - Order %s - Paypal reject the postback validation', $order->getReference()));
             }
             break;
         case TransactionInterface::STATUS_CANCELLED:
             // cancelled
             $order->setStatus(OrderInterface::STATUS_CANCELLED);
             if ($this->getLogger()) {
                 $this->getLogger()->emergency(sprintf('[Paypal:handlerError] STATUS_CANCELLED - Order %s - The Order has been cancelled, see callback dump for more information', $order->getReference()));
             }
             break;
         case TransactionInterface::STATUS_PENDING:
             // pending
             $order->setStatus(OrderInterface::STATUS_PENDING);
             if ($this->getLogger()) {
                 $reasons = self::getPendingReasonsList();
                 $this->getLogger()->emergency(sprintf('[Paypal:handlerError] STATUS_PENDING - Order %s - reason code : %s - reason : %s', $order->getReference(), $reasons[$transaction->get('pending_reason')], $transaction->get('pending_reason')));
             }
             break;
         default:
             if ($this->getLogger()) {
                 $this->getLogger()->emergency(sprintf('[Paypal:handlerError] STATUS_PENDING - uncaught error'));
             }
     }
     $transaction->setState(TransactionInterface::STATE_KO);
     if ($order->getStatus() === null) {
         $order->setStatus(OrderInterface::STATUS_CANCELLED);
     }
     if ($transaction->getStatusCode() == null) {
         $transaction->setStatusCode(TransactionInterface::STATUS_UNKNOWN);
     }
 }