Ejemplo n.º 1
0
 /**
  * @return string
  */
 public function getPaymentSignature()
 {
     if (!$this->sum) {
         throw new EmptySumException();
     }
     return $this->auth->getSignatureValue('{ml}:{ss}:{ii}{:cr}:{pp}{:cp}', ['ml' => $this->auth->getMerchantLogin(), 'ss' => $this->getShopSum(), 'ii' => $this->id, 'cr' => $this->currency, 'pp' => $this->auth->getPaymentPassword(), 'cp' => $this->getCustomParamsString()]);
 }
Ejemplo n.º 2
0
 /**
  * Returns detailed information on the current status and payment details.
  *
  * Please bear in mind that the transaction is initiated not when the
  * user is redirected to the payment page, but later – once his payment
  * details are confirmed, i.e. you may well see no transaction, which
  * you believe should have been started already.
  *
  * Returns `null` if invoice is not found and `Payment::isThrowExceptions()` is `false`.
  *
  * @param null|int $invoiceId Invoice ID.
  *
  * @return Invoice|null
  * @throws InvoiceNotFoundException If invoice is not found.
  */
 public function getInvoice($invoiceId = null)
 {
     $signature = $this->auth->getSignatureHash('{ml}:{ii}:{vp}', ['ml' => $this->auth->getMerchantLogin(), 'ii' => $invoiceId, 'vp' => $this->auth->getValidationPassword()]);
     $response = $this->sendRequest($this->serviceBaseUrl . 'OpState', ['MerchantLogin' => $this->auth->getMerchantLogin(), 'InvoiceID' => $invoiceId, 'Signature' => $signature], $this->requestMethod);
     $sxe = simplexml_load_string($response);
     $this->parseError($sxe);
     return ['InvoiceId' => (int) $invoiceId, 'StateCode' => (int) $sxe->State->Code, 'RequestDate' => new \DateTime((string) $sxe->State->RequestDate), 'StateDate' => new \DateTime((string) $sxe->State->StateDate), 'PaymentMethod' => (string) $sxe->Info->IncCurrLabel, 'ClientSum' => (double) $sxe->Info->IncSum, 'ClientAccount' => (string) $sxe->Info->IncAccount, 'PaymentMethodCode' => (string) $sxe->Info->PaymentMethod->Code, 'PaymentMethodDescription' => (string) $sxe->Info->PaymentMethod->Description, 'Currency' => (string) $sxe->Info->OutCurrLabel, 'ShopSum' => (double) $sxe->Info->OutSum];
 }