/** * {@inheritDoc} * @see \Omnipay\Common\Message\AbstractRequest::send() * @throws \Omnipay\Common\Exception\InvalidRequestException - when the credit card information is missing * @throws \Omnipay\Common\Exception\InvalidCreditCardException - when the credit card information is invalid * @throws \Omnipay\Common\Exception\InvalidResponseException - when the API call fails or returns bad data * @throws \Omnipay\Econtext\Exception\InvalidCredentialsException - if invalid gateway credentials were used (fragile) * @return \Omnipay\Econtext\Message\CreateCardMerchantResponse */ public function send() { return parent::send(); }
/** * @param \SimpleXMLElement $xml * @throws \Omnipay\Econtext\Exception\InvalidCredentialsException - if invalid gateway credentials were used (fragile) * @return \Omnipay\Econtext\Message\PurchaseMerchantResponse */ protected function createResponseOrThrow(\SimpleXMLElement $xml) { //We want to detect if a duplicate-number (transactionReference) error happened. //However, we can't do that, as the error code is the same if we send a bad one //or a duplicate. //Since we self-generate the references in the same manner (and they should always be unique), //this should only happen in the other case - when the were asked to perform a charge //for a custom transactionReference, which turned out to be bad/duplicate. if ((string) $xml->infoCode === BaseMerchantResponse::INFO_CODE_BAD_ORDER_NUMBER) { throw new \Omnipay\Econtext\Exception\BadTransactionReferenceException(sprintf('Bad (possibly duplicate) transaction reference (original error: %s)', (string) $xml->info)); } return parent::createResponseOrThrow($xml); }