diff --git a/composer.json b/composer.json index 8ad28a8..271baa4 100755 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ }, "require": { "guzzle/plugin-cookie": "~3.7", - "omnipay/common": "~2.3" + "omnipay/common": "*" }, "require-dev": { "omnipay/tests": "~2.0" diff --git a/src/Omnipay/WorldPayXML/Gateway.php b/src/Omnipay/WorldPayXML/Gateway.php index 62e7d2b..2d9af3e 100755 --- a/src/Omnipay/WorldPayXML/Gateway.php +++ b/src/Omnipay/WorldPayXML/Gateway.php @@ -7,7 +7,8 @@ /** * WorldPay XML Class * - * @link http://www.worldpay.com/support/bg/xml/kb/dxml_inv.pdf + * @link http://support.worldpay.com/support/kb/bg/pdf/bgxmldirect.pdf + * http://support.worldpay.com/support/kb/gg/pdf/omoi.pdf */ class Gateway extends AbstractGateway { @@ -30,12 +31,12 @@ public function getName() */ public function getDefaultParameters() { - return array( + return [ 'installation' => '', - 'merchant' => '', - 'password' => '', - 'testMode' => false, - ); + 'merchant' => '', + 'password' => '', + 'testMode' => false, + ]; } /** @@ -59,7 +60,7 @@ public function getAcceptHeader() */ public function setAcceptHeader($value) { - return $this->setParameter('acceptHeader', $value); + $this->setParameter('acceptHeader', $value); } /** @@ -79,7 +80,7 @@ public function getInstallation() * @param string $value Installation value * * @access public - * @return void + * @return $this */ public function setInstallation($value) { @@ -103,7 +104,7 @@ public function getMerchant() * @param string $value Merchant value * * @access public - * @return void + * @return $this */ public function setMerchant($value) { @@ -127,7 +128,7 @@ public function getPaResponse() * @param string $value Pa response value * * @access public - * @return void + * @return $this */ public function setPaResponse($value) { @@ -151,7 +152,7 @@ public function getPassword() * @param string $value Password value * * @access public - * @return void + * @return $this */ public function setPassword($value) { @@ -175,7 +176,7 @@ public function getRedirectCookie() * @param string $value Redirect cookie value * * @access public - * @return void + * @return $this */ public function setRedirectCookie($value) { @@ -199,7 +200,7 @@ public function getRedirectEcho() * @param string $value Redirect echo value * * @access public - * @return void + * @return $this */ public function setRedirectEcho($value) { @@ -223,7 +224,7 @@ public function getSession() * @param string $value Session value * * @access public - * @return void + * @return $this */ public function setSession($value) { @@ -247,7 +248,7 @@ public function getUserAgentHeader() * @param string $value User agent header value * * @access public - * @return void + * @return $this */ public function setUserAgentHeader($value) { @@ -271,7 +272,7 @@ public function getUserIP() * @param string $value User ip value * * @access public - * @return void + * @return $this */ public function setUserIP($value) { @@ -286,11 +287,115 @@ public function setUserIP($value) * @access public * @return \Omnipay\WorldPayXML\Message\PurchaseRequest */ - public function purchase(array $parameters = array()) + public function purchase(array $parameters = []) { return $this->createRequest( '\Omnipay\WorldPayXML\Message\PurchaseRequest', $parameters ); } + + /** + * Refund + * + * @param array $parameters Parameters + * + * @access public + * @return \Omnipay\WorldPayXML\Message\RefundRequest + */ + public function refund(array $parameters = []) + { + return $this->createRequest('\Omnipay\WorldPayXML\Message\RefundRequest', $parameters); + } + + /** + * Cancel + * + * @param array $parameters Parameters + * + * @access public + * @return \Omnipay\WorldPayXML\Message\CancelRequest + */ + public function cancel(array $parameters = []) + { + return $this->createRequest('Omnipay\WorldPayXML\Message\CancelRequest', $parameters); + } + + /** + * Authorise + * + * @param array $parameters Parameters + * + * @access public + * @return \Omnipay\WorldPayXML\Message\AuthorisationRequest + */ + public function authorise(array $parameters = []) + { + return $this->createRequest('Omnipay\WorldPayXML\Message\AuthorisationRequest', $parameters); + } + + /** + * Backoffice Code + * + * @param array $parameters Parameters + * + * @access public + * @return \Omnipay\WorldPayXML\Message\BackOfficeCodeRequest + */ + public function backOfficeCode(array $parameters = []) + { + return $this->createRequest('Omnipay\WorldPayXML\Message\BackOfficeCodeRequest', $parameters); + } + + /** + * Capture + * + * @param array $parameters Parameters + * + * @access public + * @return \Omnipay\WorldPayXML\Message\CaptureRequest + */ + public function capture(array $parameters = []) + { + return $this->createRequest('Omnipay\WorldPayXML\Message\CaptureRequest', $parameters); + } + + /** + * Inquiry + * + * @param array $parameters Parameters + * + * @access public + * @return \Omnipay\WorldPayXML\Message\InquiryRequest + */ + public function inquiry(array $parameters = []) + { + return $this->createRequest('Omnipay\WorldPayXML\Message\InquiryRequest', $parameters); + } + + /** + * Increase Authorisation + * + * @param array $parameters Parameters + * + * @access public + * @return \Omnipay\WorldPayXML\Message\IncreaseAuthorisationRequest + */ + public function increaseAuthorisation(array $parameters = []) + { + return $this->createRequest('Omnipay\WorldPayXML\Message\IncreaseAuthorisationRequest', $parameters); + } + + /** + * Void + * + * @param array $parameters Parameters + * + * @access public + * @return \Omnipay\WorldPayXML\Message\VoidRequest + */ + public function void(array $parameters = []) + { + return $this->createRequest('Omnipay\WorldPayXML\Message\VoidRequest', $parameters); + } } diff --git a/src/Omnipay/WorldPayXML/Message/AbstractRequest.php b/src/Omnipay/WorldPayXML/Message/AbstractRequest.php new file mode 100644 index 0000000..f2d0cd1 --- /dev/null +++ b/src/Omnipay/WorldPayXML/Message/AbstractRequest.php @@ -0,0 +1,351 @@ +getParameter('merchant'); + } + + /** + * Set merchant + * + * @param string $value Merchant + * + * @access public + * @return void + */ + public function setMerchant($value) + { + $this->setParameter('merchant', $value); + } + + /** + * Get password + * + * @access public + * @return string + */ + public function getPassword() + { + return $this->getParameter('password'); + } + + /** + * Set password + * + * @param string $value Password + * + * @access public + * @return void + */ + public function setPassword($value) + { + $this->setParameter('password', $value); + } + + /** + * Get redirect cookie + * + * @access public + * @return string + */ + public function getRedirectCookie() + { + return $this->getParameter('redirect_cookie'); + } + + /** + * Set redirect cookie + * + * @param string $value Password + * + * @access public + * @return void + */ + public function setRedirectCookie($value) + { + $this->setParameter('redirect_cookie', $value); + } + + /** + * Set up the base SimpleXMLElelment for the request with items common to all requests. + * + * @return \SimpleXMLElement + */ + protected function getBase() + { + $data = new \SimpleXMLElement(''); + $data->addAttribute('version', self::VERSION); + $data->addAttribute('merchantCode', $this->getMerchant()); + + return $data; + } + + /** + * Get installation + * + * @access public + * @return string + */ + public function getInstallation() + { + return $this->getParameter('installation'); + } + + /** + * Set installation + * + * @param string $value Installation + * + * @access public + * @return void + */ + public function setInstallation($value) + { + $this->setParameter('installation', $value); + } + + /** + * Send data + * + * @param \SimpleXMLElement $data Data + * + * @access public + * @return \Omnipay\Common\Message\ResponseInterface + */ + public function sendData($data) + { + $implementation = new \DOMImplementation(); + + $dtd = $implementation->createDocumentType( + 'paymentService', + '-//WorldPay//DTD WorldPay PaymentService v1//EN', + 'http://dtd.worldpay.com/paymentService_v1.dtd' + ); + + $document = $implementation->createDocument(null, '', $dtd); + $document->encoding = 'utf-8'; + + $node = $document->importNode(dom_import_simplexml($data), true); + $document->appendChild($node); + + $authorisation = base64_encode( + $this->getMerchant() . ':' . $this->getPassword() + ); + + $headers = [ + 'Authorization' => 'Basic ' . $authorisation, + 'Content-Type' => 'text/xml; charset=utf-8', + ]; + + $cookieJar = new ArrayCookieJar(); + + $redirectCookie = $this->getRedirectCookie(); + + if (!empty($redirectCookie)) { + $url = parse_url($this->getEndpoint()); + + $cookieJar->add( + new Cookie( + [ + 'domain' => $url['host'], + 'name' => 'machine', + 'path' => '/', + 'value' => $redirectCookie, + ] + ) + ); + } + + $this->cookiePlugin = new CookiePlugin($cookieJar); + + $this->httpClient->addSubscriber($this->cookiePlugin); + + $xml = $document->saveXML(); + + $this->notify( + [ + 'request' => preg_replace( + '#\([0-9]{3,4})\<\/cvc\>#', + '***', + preg_replace( + '#\([0-9]{10,})\<\/cardNumber\>#', + '**** **** **** ****', + $xml + ) + ), + ] + ); + + $httpResponse = $this->httpClient + ->post($this->getEndpoint(), $headers, $xml) + ->send(); + + $this->notify(['response' => (string)$httpResponse->getBody()]); + + return $this->response = Response::make( + $this, + $httpResponse->getBody() + ); + } + + /** + * Get endpoint + * + * Returns endpoint depending on test mode + * + * @access protected + * @return string + */ + protected function getEndpoint() + { + if ($this->getTestMode()) { + return self::EP_HOST_TEST . self::EP_PATH; + } + + return self::EP_HOST_LIVE . self::EP_PATH; + } + + /** + * Attach an observer. + * + * @param Observer $observer + */ + public function attach(Observer $observer) + { + $this->observers[] = $observer; + } + + /** + * Detach an attached observer. + * + * @param Observer $observer + */ + public function detach(Observer $observer) + { + $this->observers = array_filter( + $this->observers, + function ($a) use ($observer) { + return (!($a === $observer)); + } + ); + } + + /** + * Notify all observers. + * + * @param $data + */ + public function notify($data) + { + foreach ($this->observers as $observer) { + $observer->update($this, $data); + } + } + + /** + * Return a value to indicate the transaction type. + * @return integer + */ + abstract public function getTransactionType(); +} diff --git a/src/Omnipay/WorldPayXML/Message/AuthorisationRequest.php b/src/Omnipay/WorldPayXML/Message/AuthorisationRequest.php new file mode 100644 index 0000000..39138aa --- /dev/null +++ b/src/Omnipay/WorldPayXML/Message/AuthorisationRequest.php @@ -0,0 +1,59 @@ +setParameter('authorisation', $value); + } + + /** + * Get the authorisation code. + * + * @return string + */ + public function getAuthorisation() + { + return $this->getParameter('authorisation'); + } + + /** + * Get the data for the request. + * + * @return \SimpleXMLElement + */ + public function getData() + { + $data = $this->getBase(); + $authorise = $data->modify->orderModification->addChild('authorise'); + $authorise->addAttribute('authorisationCode', $this->getAuthorisation()); + + return $data; + } + + /** + * Return a value to indicate the transaction type. + * @return integer + */ + public function getTransactionType() + { + return static::AUTHORISATION_CODE_REQUEST; + } +} diff --git a/src/Omnipay/WorldPayXML/Message/BackOfficeCodeRequest.php b/src/Omnipay/WorldPayXML/Message/BackOfficeCodeRequest.php new file mode 100644 index 0000000..dfe5600 --- /dev/null +++ b/src/Omnipay/WorldPayXML/Message/BackOfficeCodeRequest.php @@ -0,0 +1,58 @@ +setParameter('backOfficeCode', $value); + } + + /** + * Get the backoffice code + * + * @return string + */ + public function getBackOfficeCode() + { + return $this->getParameter('backOfficeCode'); + } + + /** + * Get the data for the request. + * + * @return \SimpleXMLElement + */ + public function getData() + { + $data = $this->getBase(); + $addBackOfficeCode = $data->modify->orderModification->addChild('addBackOfficeCode'); + $addBackOfficeCode->addAttribute('backOfficeCode', $this->getBackOfficeCode()); + + return $data; + } + + /** + * Return a value to indicate the transaction type. + * @return integer + */ + public function getTransactionType() + { + return static::BACK_OFFICE_CODE_REQUEST; + } +} diff --git a/src/Omnipay/WorldPayXML/Message/CancelRequest.php b/src/Omnipay/WorldPayXML/Message/CancelRequest.php new file mode 100644 index 0000000..49eaf1f --- /dev/null +++ b/src/Omnipay/WorldPayXML/Message/CancelRequest.php @@ -0,0 +1,37 @@ +getBase(); + $data->modify->orderModification->addChild('cancel'); + return $data; + } + + /** + * Return a value to indicate the transaction type. + * + * @return integer + */ + public function getTransactionType() + { + return static::CANCEL_REQUEST; + } +} diff --git a/src/Omnipay/WorldPayXML/Message/CaptureRequest.php b/src/Omnipay/WorldPayXML/Message/CaptureRequest.php new file mode 100644 index 0000000..a80624f --- /dev/null +++ b/src/Omnipay/WorldPayXML/Message/CaptureRequest.php @@ -0,0 +1,40 @@ +getBase(); + $capture = $data->modify->orderModification->addChild('capture'); + $amount = $capture->addChild('amount'); + $amount->addAttribute('value', $this->getAmountInteger()); + $amount->addAttribute('currencyCode', $this->getCurrency()); + $amount->addAttribute('exponent', $this->getCurrencyDecimalPlaces()); + $amount->addAttribute('debitCreditIndicator', $this->getDebitCreditIndicator()); + + return $data; + } + + /** + * Return a value to indicate the transaction type. + * @return integer + */ + public function getTransactionType() + { + return static::CAPTURE_REQUEST; + } +} \ No newline at end of file diff --git a/src/Omnipay/WorldPayXML/Message/IncreaseAuthorisationRequest.php b/src/Omnipay/WorldPayXML/Message/IncreaseAuthorisationRequest.php new file mode 100644 index 0000000..8ad956c --- /dev/null +++ b/src/Omnipay/WorldPayXML/Message/IncreaseAuthorisationRequest.php @@ -0,0 +1,38 @@ +getBase(); + $authorise = $data->modify->orderModification->addChild('increaseAuthorisation'); + $amount = $authorise->addChild('amount'); + $amount->addAttribute('value', $this->getAmountInteger()); + $amount->addAttribute('currencyCode', $this->getCurrency()); + $amount->addAttribute('exponent', $this->getCurrencyDecimalPlaces()); + + return $data; + } + + /** + * Return a value to indicate the transaction type. + * @return integer + */ + public function getTransactionType() + { + return static::INCREASE_AUTHORISATION_REQUEST; + } +} diff --git a/src/Omnipay/WorldPayXML/Message/InquiryRequest.php b/src/Omnipay/WorldPayXML/Message/InquiryRequest.php new file mode 100644 index 0000000..aebc401 --- /dev/null +++ b/src/Omnipay/WorldPayXML/Message/InquiryRequest.php @@ -0,0 +1,37 @@ +getBase(); + $inquiry = $data->addChild('inquiry'); + $orderInquiry = $inquiry->addChild('orderInquiry'); + $orderInquiry->addAttribute('orderCode', $this->getTransactionId()); + + return $data; + } + + /** + * Return a value to indicate the transaction type. + * + * @return integer + */ + public function getTransactionType() + { + return static::INQUIRY_REQUEST; + } +} diff --git a/src/Omnipay/WorldPayXML/Message/ModifyRequest.php b/src/Omnipay/WorldPayXML/Message/ModifyRequest.php new file mode 100644 index 0000000..ad2b806 --- /dev/null +++ b/src/Omnipay/WorldPayXML/Message/ModifyRequest.php @@ -0,0 +1,52 @@ +setParameter('debitCreditIndicator', $value); + } + + /** + * Get the debit/credit parameter. + * + * @return string + */ + public function getDebitCreditIndicator() + { + return $this->getParameter('debitCreditIndicator'); + } + + /** + * Extends the base XML from the Abstract request class method to include common elements for all modififcation + * requests. + * + * @return \SimpleXMLElement + */ + protected function getBase() + { + $data = parent::getBase(); + $modify = $data->addChild('modify'); + $orderModification = $modify->addChild('orderModification'); + $orderModification->addAttribute('orderCode', $this->getTransactionId()); + + return $data; + } +} diff --git a/src/Omnipay/WorldPayXML/Message/ModifyResponse.php b/src/Omnipay/WorldPayXML/Message/ModifyResponse.php new file mode 100644 index 0000000..3dcaa55 --- /dev/null +++ b/src/Omnipay/WorldPayXML/Message/ModifyResponse.php @@ -0,0 +1,82 @@ +request = $request; + + $this->data = $data; + } + + /** + * Get is successful + * + * @access public + * @return boolean + */ + public function isSuccessful() + { + if (isset($this->data->ok)) { + return true; + } + + return false; + } + + /** + * Get the message from the response. + * + * @return string + */ + public function getMessage() + { + if ($this->isSuccessful()) { + return 'SUCCESS'; + } + + return (string)$this->data->error; + } + + /** + * Get transaction reference + * + * @access public + * @return string + */ + public function getTransactionReference() + { + if ($this->data->ok instanceof \SimpleXMLElement) { + foreach ($this->data->ok->children() as $child) { + if ($child instanceof \SimpleXMLElement) { + $attributes = $child->attributes(); + + if (isset($attributes['orderCode'])) { + return $attributes['orderCode']; + } + } + } + } + + return null; + } +} diff --git a/src/Omnipay/WorldPayXML/Message/Observer.php b/src/Omnipay/WorldPayXML/Message/Observer.php new file mode 100644 index 0000000..866d558 --- /dev/null +++ b/src/Omnipay/WorldPayXML/Message/Observer.php @@ -0,0 +1,23 @@ +cookiePlugin; } - /** - * Get installation - * - * @access public - * @return string - */ - public function getInstallation() - { - return $this->getParameter('installation'); - } - - /** - * Set installation - * - * @param string $value Installation - * - * @access public - * @return void - */ - public function setInstallation($value) - { - return $this->setParameter('installation', $value); - } - - /** - * Get merchant - * - * @access public - * @return string - */ - public function getMerchant() - { - return $this->getParameter('merchant'); - } - - /** - * Set merchant - * - * @param string $value Merchant - * - * @access public - * @return void - */ - public function setMerchant($value) - { - return $this->setParameter('merchant', $value); - } - /** * Get pa response * @@ -134,54 +77,6 @@ public function setPaResponse($value) return $this->setParameter('pa_response', $value); } - /** - * Get password - * - * @access public - * @return string - */ - public function getPassword() - { - return $this->getParameter('password'); - } - - /** - * Set password - * - * @param string $value Password - * - * @access public - * @return void - */ - public function setPassword($value) - { - return $this->setParameter('password', $value); - } - - /** - * Get redirect cookie - * - * @access public - * @return string - */ - public function getRedirectCookie() - { - return $this->getParameter('redirect_cookie'); - } - - /** - * Set redirect cookie - * - * @param string $value Password - * - * @access public - * @return void - */ - public function setRedirectCookie($value) - { - return $this->setParameter('redirect_cookie', $value); - } - /** * Get redirect echo * @@ -289,13 +184,14 @@ public function getData() $this->validate('amount', 'card'); $this->getCard()->validate(); - $data = new \SimpleXMLElement(''); - $data->addAttribute('version', self::VERSION); - $data->addAttribute('merchantCode', $this->getMerchant()); + $data = $this->getBase(); $order = $data->addChild('submit')->addChild('order'); $order->addAttribute('orderCode', $this->getTransactionId()); - $order->addAttribute('installationId', $this->getInstallation()); + $installationId = $this->getInstallation(); + if (!empty($installationId)) { + $order->addAttribute('installationId', $installationId); + } $order->addChild('description', $this->getDescription()); @@ -306,18 +202,18 @@ public function getData() $payment = $order->addChild('paymentDetails'); - $codes = array( - CreditCard::BRAND_AMEX => 'AMEX-SSL', - CreditCard::BRAND_DANKORT => 'DANKORT-SSL', + $codes = [ + CreditCard::BRAND_AMEX => 'AMEX-SSL', + CreditCard::BRAND_DANKORT => 'DANKORT-SSL', CreditCard::BRAND_DINERS_CLUB => 'DINERS-SSL', - CreditCard::BRAND_DISCOVER => 'DISCOVER-SSL', - CreditCard::BRAND_JCB => 'JCB-SSL', - CreditCard::BRAND_LASER => 'LASER-SSL', - CreditCard::BRAND_MAESTRO => 'MAESTRO-SSL', - CreditCard::BRAND_MASTERCARD => 'ECMC-SSL', - CreditCard::BRAND_SWITCH => 'MAESTRO-SSL', - CreditCard::BRAND_VISA => 'VISA-SSL' - ); + CreditCard::BRAND_DISCOVER => 'DISCOVER-SSL', + CreditCard::BRAND_JCB => 'JCB-SSL', + CreditCard::BRAND_LASER => 'LASER-SSL', + CreditCard::BRAND_MAESTRO => 'MAESTRO-SSL', + CreditCard::BRAND_MASTERCARD => 'ECMC-SSL', + CreditCard::BRAND_SWITCH => 'MAESTRO-SSL', + CreditCard::BRAND_VISA => 'VISA-SSL', + ]; $card = $payment->addChild($codes[$this->getCard()->getBrand()]); $card->addChild('cardNumber', $this->getCard()->getNumber()); @@ -329,8 +225,8 @@ public function getData() $card->addChild('cardHolderName', $this->getCard()->getName()); if ( - $this->getCard()->getBrand() == CreditCard::BRAND_MAESTRO - || $this->getCard()->getBrand() == CreditCard::BRAND_SWITCH + $this->getCard()->getBrand() == CreditCard::BRAND_MAESTRO + || $this->getCard()->getBrand() == CreditCard::BRAND_SWITCH ) { $start = $card->addChild('startDate')->addChild('date'); $start->addAttribute('month', $this->getCard()->getStartDate('m')); @@ -346,9 +242,14 @@ public function getData() $address->addChild('postalCode', $this->getCard()->getPostcode()); $address->addChild('countryCode', $this->getCard()->getCountry()); - $session = $payment->addChild('session'); - $session->addAttribute('shopperIPAddress', $this->getClientIP()); - $session->addAttribute('id', $this->getSession()); + $clientIp = $this->getClientIP(); + $sessionId = $this->getSession(); + + if (!empty($clientIp) && !empty($sessionId)) { + $session = $payment->addChild('session'); + $session->addAttribute('shopperIPAddress', $clientIp); + $session->addAttribute('id', $sessionId); + } $paResponse = $this->getPaResponse(); @@ -368,6 +269,16 @@ public function getData() ); } + $shippingAddress = $order->addChild('shippingAddress'); + $address = $shippingAddress->addChild('address'); + $address->addChild('firstName', $this->getCard()->getShippingFirstName()); + $address->addChild('lastName', $this->getCard()->getShippingLastName()); + $address->addChild('street', $this->getCard()->getShippingAddress1()); + $address->addChild('postalCode', $this->getCard()->getShippingPostcode()); + $address->addChild('city', $this->getCard()->getShippingCity()); + $address->addChild('countryCode', $this->getCard()->getShippingCountry()); + $address->addChild('telephoneNumber', $this->getCard()->getshippingPhone()); + $browser = $shopper->addChild('browser'); $browser->addChild('acceptHeader', $this->getAcceptHeader()); $browser->addChild('userAgentHeader', $this->getUserAgentHeader()); @@ -382,87 +293,11 @@ public function getData() } /** - * Send data - * - * @param \SimpleXMLElement $data Data - * - * @access public - * @return RedirectResponse + * Return a value to indicate the transaction type. + * @return integer */ - public function sendData($data) + public function getTransactionType() { - $implementation = new \DOMImplementation(); - - $dtd = $implementation->createDocumentType( - 'paymentService', - '-//WorldPay//DTD WorldPay PaymentService v1//EN', - 'http://dtd.worldpay.com/paymentService_v1.dtd' - ); - - $document = $implementation->createDocument(null, '', $dtd); - $document->encoding = 'utf-8'; - - $node = $document->importNode(dom_import_simplexml($data), true); - $document->appendChild($node); - - $authorisation = base64_encode( - $this->getMerchant() . ':' . $this->getPassword() - ); - - $headers = array( - 'Authorization' => 'Basic ' . $authorisation, - 'Content-Type' => 'text/xml; charset=utf-8' - ); - - $cookieJar = new ArrayCookieJar(); - - $redirectCookie = $this->getRedirectCookie(); - - if (!empty($redirectCookie)) { - $url = parse_url($this->getEndpoint()); - - $cookieJar->add( - new Cookie( - array( - 'domain' => $url['host'], - 'name' => 'machine', - 'path' => '/', - 'value' => $redirectCookie - ) - ) - ); - } - - $this->cookiePlugin = new CookiePlugin($cookieJar); - - $this->httpClient->addSubscriber($this->cookiePlugin); - - $xml = $document->saveXML(); - - $httpResponse = $this->httpClient - ->post($this->getEndpoint(), $headers, $xml) - ->send(); - - return $this->response = new RedirectResponse( - $this, - $httpResponse->getBody() - ); - } - - /** - * Get endpoint - * - * Returns endpoint depending on test mode - * - * @access protected - * @return string - */ - protected function getEndpoint() - { - if ($this->getTestMode()) { - return self::EP_HOST_TEST . self::EP_PATH; - } - - return self::EP_HOST_LIVE . self::EP_PATH; + return static::PAYMENT_REQUEST; } } diff --git a/src/Omnipay/WorldPayXML/Message/RedirectResponse.php b/src/Omnipay/WorldPayXML/Message/RedirectResponse.php index 2d98c38..26aaba5 100755 --- a/src/Omnipay/WorldPayXML/Message/RedirectResponse.php +++ b/src/Omnipay/WorldPayXML/Message/RedirectResponse.php @@ -1,5 +1,7 @@ $this->data->requestInfo->request3DSecure->paRequest, - 'TermUrl' => $this->request->getTermUrl() - ); + return [ + 'PaReq' => $this->data->requestInfo->request3DSecure->paRequest, + 'TermUrl' => $this->request->getTermUrl(), + ]; } /** diff --git a/src/Omnipay/WorldPayXML/Message/RefundRequest.php b/src/Omnipay/WorldPayXML/Message/RefundRequest.php new file mode 100644 index 0000000..900a51a --- /dev/null +++ b/src/Omnipay/WorldPayXML/Message/RefundRequest.php @@ -0,0 +1,36 @@ +getBase(); + $refund = $data->modify->orderModification->addChild('refund'); + $amount = $refund->addChild('amount'); + $amount->addAttribute('value', $this->getAmountInteger()); + $amount->addAttribute('currencyCode', $this->getCurrency()); + $amount->addAttribute('exponent', $this->getCurrencyDecimalPlaces()); + $amount->addAttribute('debitCreditIndicator', $this->getDebitCreditIndicator()); + + return $data; + } + + /** + * Return a value to indicate the transaction type. + * + * @return integer + */ + public function getTransactionType() + { + return static::REFUND_REQUEST; + } +} diff --git a/src/Omnipay/WorldPayXML/Message/Response.php b/src/Omnipay/WorldPayXML/Message/Response.php index 0cfb834..e6b3ca0 100755 --- a/src/Omnipay/WorldPayXML/Message/Response.php +++ b/src/Omnipay/WorldPayXML/Message/Response.php @@ -1,5 +1,7 @@ loadXML($data); + + if ($request instanceof \Omnipay\WorldPayXML\Message\ModifyRequest && + !($request instanceof \Omnipay\WorldPayXML\Message\IncreaseAuthorisationRequest) + ) { + $xmlData = simplexml_import_dom( + $responseDom->documentElement->firstChild + ); + + return new ModifyResponse( + $request, + $xmlData + ); + } else { + $xmlData = simplexml_import_dom( + $responseDom->documentElement->firstChild->firstChild + ); + } + + if ($xmlData->requestInfo) { + return new RedirectResponse($request, $xmlData); + } else { + return new Response($request, $xmlData); + } + } + /** * Constructor * @@ -22,18 +66,13 @@ class Response extends AbstractResponse */ public function __construct(RequestInterface $request, $data) { - $this->request = $request; - if (empty($data)) { throw new InvalidResponseException(); } - $responseDom = new DOMDocument; - $responseDom->loadXML($data); + $this->request = $request; - $this->data = simplexml_import_dom( - $responseDom->documentElement->firstChild->firstChild - ); + $this->data = $data; } /** @@ -44,13 +83,13 @@ public function __construct(RequestInterface $request, $data) */ public function getMessage() { - $codes = array( - 0 => 'AUTHORISED', - 2 => 'REFERRED', - 3 => 'INVALID ACCEPTOR', - 4 => 'HOLD CARD', - 5 => 'REFUSED', - 8 => 'APPROVE AFTER IDENTIFICATION', + $codes = [ + 0 => 'AUTHORISED', + 2 => 'REFERRED', + 3 => 'INVALID ACCEPTOR', + 4 => 'HOLD CARD', + 5 => 'REFUSED', + 8 => 'APPROVE AFTER IDENTIFICATION', 12 => 'INVALID TRANSACTION', 13 => 'INVALID AMOUNT', 14 => 'INVALID ACCOUNT', @@ -89,8 +128,8 @@ public function getMessage() 91 => 'CREDITCARD ISSUER TEMPORARILY NOT REACHABLE', 92 => 'CREDITCARD TYPE NOT PROCESSED BY ACQUIRER', 94 => 'DUPLICATE REQUEST ERROR', - 97 => 'SECURITY BREACH' - ); + 97 => 'SECURITY BREACH', + ]; $message = 'PENDING'; @@ -123,11 +162,15 @@ public function getMessage() */ public function getTransactionReference() { - $attributes = $this->data->attributes(); + if ($this->data instanceof \SimpleXMLElement) { + $attributes = $this->data->attributes(); - if (isset($attributes['orderCode'])) { - return $attributes['orderCode']; + if (isset($attributes['orderCode'])) { + return (string)$attributes['orderCode']; + } } + + return null; } /** diff --git a/src/Omnipay/WorldPayXML/Message/VoidRequest.php b/src/Omnipay/WorldPayXML/Message/VoidRequest.php new file mode 100644 index 0000000..1b08c05 --- /dev/null +++ b/src/Omnipay/WorldPayXML/Message/VoidRequest.php @@ -0,0 +1,35 @@ +getBase(); + $data->modify->orderModification->addChild('cancelOrRefund'); + + return $data; + } + + /** + * Return a value to indicate the transaction type. + * @return integer + */ + public function getTransactionType() + { + return static::VOID_REQUEST; + } +} diff --git a/tests/Omnipay/WorldPayXML/GatewayTest.php b/tests/Omnipay/WorldPayXML/GatewayTest.php index 95980f1..7234c74 100755 --- a/tests/Omnipay/WorldPayXML/GatewayTest.php +++ b/tests/Omnipay/WorldPayXML/GatewayTest.php @@ -7,6 +7,12 @@ class GatewayTest extends GatewayTestCase { + /** + * The WorldPayXML gateway + * @var \Omnipay\WorldPayXML\Gateway + */ + public $gateway; + public function setUp() { parent::setUp(); @@ -15,8 +21,32 @@ public function setUp() $this->getHttpClient(), $this->getHttpRequest() ); + } + + public function testGetName() + { + $this->assertEquals('WorldPayXML', $this->gateway->getName()); + } + + public function testGetShortName() + { + $this->assertEquals('WorldPayXML', $this->gateway->getShortName()); + } - $this->options = array( + public function testGetDefaultParameters() + { + $defaultParameters = $this->gateway->getDefaultParameters(); + + $this->assertInternalType('array', $defaultParameters); + $this->assertArrayHasKey('installation', $defaultParameters); + $this->assertArrayHasKey('merchant', $defaultParameters); + $this->assertArrayHasKey('password', $defaultParameters); + $this->assertArrayHasKey('testMode', $defaultParameters); + } + + public function testPurchaseSuccess() + { + $options = array( 'amount' => '10.00', 'card' => new CreditCard( array( @@ -30,13 +60,10 @@ public function setUp() ), 'transactionId' => 'T0211010', ); - } - public function testPurchaseSuccess() - { $this->setMockHttpResponse('PurchaseSuccess.txt'); - $response = $this->gateway->purchase($this->options)->send(); + $response = $this->gateway->purchase($options)->send(); $this->assertTrue($response->isSuccessful()); $this->assertEquals('T0211010', $response->getTransactionReference()); @@ -44,11 +71,210 @@ public function testPurchaseSuccess() public function testPurchaseError() { + $options = array( + 'amount' => '10.00', + 'card' => new CreditCard( + array( + 'firstName' => 'Example', + 'lastName' => 'User', + 'number' => '4111111111111111', + 'expiryMonth' => '12', + 'expiryYear' => '2016', + 'cvv' => '123', + ) + ), + 'transactionId' => 'T0211010', + ); + $this->setMockHttpResponse('PurchaseFailure.txt'); - $response = $this->gateway->purchase($this->options)->send(); + $response = $this->gateway->purchase($options)->send(); $this->assertFalse($response->isSuccessful()); $this->assertSame('CARD EXPIRED', $response->getMessage()); } + + public function testAuthorisationSuccess() + { + $this->setMockHttpResponse('AuthorisationSuccess.txt'); + + $options = [ + 'orderCode' => 'T0211010', + 'authorisationCode' => 'abc123', + ]; + + $response = $this->gateway->authorise($options)->send(); + + $this->assertTrue($response->isSuccessful()); + $this->assertEquals('T0211010', $response->getTransactionReference()); + } + + public function testBackOfficeCodeSuccess() + { + $this->setMockHttpResponse('BackOfficeCodeSuccess.txt'); + + $options = [ + 'orderCode' => 'T0211010', + 'backOfficeCode' => 'abc123', + ]; + + $response = $this->gateway->backOfficeCode($options)->send(); + + $this->assertTrue($response->isSuccessful()); + $this->assertEquals('T0211010', $response->getTransactionReference()); + } + + public function testCancelSuccess() + { + $this->setMockHttpResponse('CancelSuccess.txt'); + + $options = [ + 'orderCode' => 'T0211010', + ]; + + $response = $this->gateway->cancel($options)->send(); + + $this->assertTrue($response->isSuccessful()); + $this->assertEquals('T0211010', $response->getTransactionReference()); + } + + public function testCaptureSuccess() + { + $this->setMockHttpResponse('CaptureSuccess.txt'); + + $options = [ + 'orderCode' => 'T0211010', + 'amount' => 12.34, + 'currencyCode' => 'EUR', + 'debitCreditIndicator' => 'credit', + ]; + + $response = $this->gateway->capture($options)->send(); + + $this->assertTrue($response->isSuccessful()); + $this->assertEquals('T0211010', $response->getTransactionReference()); + } + + public function testCaptureFailure() + { + $this->setMockHttpResponse('CaptureFailure.txt'); + + $options = [ + 'orderCode' => 'T0211010', + 'amount' => 12.34, + 'currencyCode' => 'EUR', + 'debitCreditIndicator' => 'credit', + ]; + + $response = $this->gateway->capture($options)->send(); + + $this->assertFalse($response->isSuccessful()); + } + + public function testIncreasAuthorisationSuccess() + { + $this->setMockHttpResponse('IncreaseAuthorisationSuccess.txt'); + + $options = [ + 'orderCode' => 'T0211010', + 'amount' => 12.34, + 'currencyCode' => 'EUR', + 'debitCreditIndicator' => 'credit', + ]; + + $response = $this->gateway->increaseAuthorisation($options)->send(); + + $this->assertTrue($response->isSuccessful()); + $this->assertEquals('T0211010', $response->getTransactionReference()); + } + + public function testIncreaseAuthorisationFailure() + { + $this->setMockHttpResponse('IncreaseAuthorisationFailure.txt'); + + $options = [ + 'orderCode' => 'T0211010', + 'amount' => 12.34, + 'currencyCode' => 'EUR', + 'debitCreditIndicator' => 'credit', + ]; + + $response = $this->gateway->increaseAuthorisation($options)->send(); + + $this->assertFalse($response->isSuccessful()); + } + + public function testInquirySuccess() + { + $this->setMockHttpResponse('InquirySuccess.txt'); + + $options = [ + 'orderCode' => 'T0211010', + ]; + + $response = $this->gateway->inquiry($options)->send(); + + $this->assertTrue($response->isSuccessful()); + $this->assertEquals('T0211010', $response->getTransactionReference()); + } + + public function testInquiryFailure() + { + $this->setMockHttpResponse('InquiryFailure.txt'); + + $options = [ + 'orderCode' => 'T0211010', + ]; + + $response = $this->gateway->inquiry($options)->send(); + + $this->assertFalse($response->isSuccessful()); + } + + public function testRefundSuccess() + { + $this->setMockHttpResponse('RefundSuccess.txt'); + + $options = [ + 'orderCode' => 'T0211010', + 'amount' => 12.34, + 'amountCurrencyCode' => 'GBP', + 'debitOrCredit' => 'credit', + ]; + + $response = $this->gateway->void($options)->send(); + + $this->assertTrue($response->isSuccessful()); + $this->assertEquals('T0211010', $response->getTransactionReference()); + } + + public function testRefundFailure() + { + $this->setMockHttpResponse('RefundFailure.txt'); + + $options = [ + 'orderCode' => 'T0211010', + 'amount' => 12.34, + 'amountCurrencyCode' => 'GBP', + 'debitOrCredit' => 'xxxxx', + ]; + + $response = $this->gateway->void($options)->send(); + + $this->assertFalse($response->isSuccessful()); + } + + public function testVoidSuccess() + { + $this->setMockHttpResponse('VoidSuccess.txt'); + + $options = [ + 'orderCode' => 'T0211010', + ]; + + $response = $this->gateway->void($options)->send(); + + $this->assertTrue($response->isSuccessful()); + $this->assertEquals('T0211010', $response->getTransactionReference()); + } } diff --git a/tests/Omnipay/WorldPayXML/Message/ResponseTest.php b/tests/Omnipay/WorldPayXML/Message/ResponseTest.php index 3e98db8..cab8d98 100755 --- a/tests/Omnipay/WorldPayXML/Message/ResponseTest.php +++ b/tests/Omnipay/WorldPayXML/Message/ResponseTest.php @@ -3,21 +3,186 @@ namespace Omnipay\WorldPayXML\Message; use Omnipay\Tests\TestCase; +use Mockery; class ResponseTest extends TestCase { /** - * @expectedException Omnipay\Common\Exception\InvalidResponseException + * @expectedException \Omnipay\Common\Exception\InvalidResponseException */ public function testConstructEmpty() { - $response = new Response($this->getMockRequest(), ''); + $response = Response::make($this->getMockRequest(), ''); + } + + public function testAuthorisationSuccess() + { + $authorisationRequest = Mockery::mock('Omnipay\WorldPayXML\Message\AuthorisationRequest'); + $httpResponse = $this->getMockHttpResponse('AuthorisationSuccess.txt'); + $response = Response::make( + $authorisationRequest, + $httpResponse->getBody() + ); + + $this->assertTrue($response->isSuccessful()); + $this->assertEquals('T0211010', $response->getTransactionReference()); + $this->assertEquals('SUCCESS', $response->getMessage()); + } + + public function testBackOfficeCodeSuccess() + { + $backOfficeCodeRequest = Mockery::mock('Omnipay\WorldPayXML\Message\BackOfficeCodeRequest'); + $httpResponse = $this->getMockHttpResponse('BackOfficeCodeSuccess.txt'); + $response = Response::make( + $backOfficeCodeRequest, + $httpResponse->getBody() + ); + + $this->assertTrue($response->isSuccessful()); + $this->assertEquals('T0211010', $response->getTransactionReference()); + $this->assertEquals('SUCCESS', $response->getMessage()); + } + + public function testCancelSuccess() + { + $cancelRequest = Mockery::mock('Omnipay\WorldPayXML\Message\CancelRequest'); + $httpResponse = $this->getMockHttpResponse('CancelSuccess.txt'); + $response = Response::make( + $cancelRequest, + $httpResponse->getBody() + ); + + $this->assertTrue($response->isSuccessful()); + $this->assertEquals('T0211010', $response->getTransactionReference()); + $this->assertEquals('SUCCESS', $response->getMessage()); + } + + public function testCaptureSuccess() + { + $captureRequest = Mockery::mock('Omnipay\WorldPayXML\Message\CaptureRequest'); + $httpResponse = $this->getMockHttpResponse('CaptureSuccess.txt'); + $response = Response::make( + $captureRequest, + $httpResponse->getBody() + ); + + $this->assertTrue($response->isSuccessful()); + $this->assertEquals('T0211010', $response->getTransactionReference()); + $this->assertEquals('SUCCESS', $response->getMessage()); + } + + public function testCaptureFailure() + { + $captureRequest = Mockery::mock('Omnipay\WorldPayXML\Message\CaptureRequest'); + $httpResponse = $this->getMockHttpResponse('CaptureFailure.txt'); + $response = Response::make( + $captureRequest, + $httpResponse->getBody() + ); + + $this->assertFalse($response->isSuccessful()); + $this->assertEquals('Attribute "debitCreditIndicator" with value "xxxx" must have a value from the list "debit credit ".', $response->getMessage()); + } + + public function testInquirySuccess() + { + $inquiryRequest = Mockery::mock('Omnipay\WorldPayXML\Message\InquiryRequest'); + $httpResponse = $this->getMockHttpResponse('InquirySuccess.txt'); + $response = Response::make( + $inquiryRequest, + $httpResponse->getBody() + ); + + $this->assertTrue($response->isSuccessful()); + $this->assertEquals('T0211010', $response->getTransactionReference()); + $this->assertEquals('AUTHORISED', $response->getMessage()); + } + + public function testInquiryFailure() + { + $inquiryRequest = Mockery::mock('Omnipay\WorldPayXML\Message\InquiryRequest'); + $httpResponse = $this->getMockHttpResponse('InquiryFailure.txt'); + $response = Response::make( + $inquiryRequest, + $httpResponse->getBody() + ); + + $this->assertFalse($response->isSuccessful()); + } + + public function testRefundSuccess() + { + $refundRequest = Mockery::mock('Omnipay\WorldPayXML\Message\RefundRequest'); + $httpResponse = $this->getMockHttpResponse('RefundSuccess.txt'); + $response = Response::make( + $refundRequest, + $httpResponse->getBody() + ); + + $this->assertTrue($response->isSuccessful()); + $this->assertEquals('T0211010', $response->getTransactionReference()); + $this->assertEquals('SUCCESS', $response->getMessage()); + } + + public function testRefundFailure() + { + $refundRequest = Mockery::mock('Omnipay\WorldPayXML\Message\RefundRequest'); + $httpResponse = $this->getMockHttpResponse('RefundFailure.txt'); + $response = Response::make( + $refundRequest, + $httpResponse->getBody() + ); + + $this->assertFalse($response->isSuccessful()); + $this->assertEquals('Attribute "debitCreditIndicator" with value "xxxx" must have a value from the list "debit credit ".', $response->getMessage()); + } + + public function testVoidSuccess() + { + $voidRequest = Mockery::mock('Omnipay\WorldPayXML\Message\VoidRequest'); + $httpResponse = $this->getMockHttpResponse('RefundSuccess.txt'); + $response = Response::make( + $voidRequest, + $httpResponse->getBody() + ); + + $this->assertTrue($response->isSuccessful()); + $this->assertEquals('T0211010', $response->getTransactionReference()); + $this->assertEquals('SUCCESS', $response->getMessage()); + } + + public function testIncreaseAuthorisationSuccess() + { + $increaseAuthorisationRequest = Mockery::mock('Omnipay\WorldPayXML\Message\IncreaseAuthorisationRequest'); + $httpResponse = $this->getMockHttpResponse('IncreaseAuthorisationSuccess.txt'); + $response = Response::make( + $increaseAuthorisationRequest, + $httpResponse->getBody() + ); + + $this->assertTrue($response->isSuccessful()); + $this->assertEquals('T0211010', $response->getTransactionReference()); + $this->assertEquals('AUTHORISED', $response->getMessage()); + } + + public function testIncreaseAuthorisationFail() + { + $increaseAuthorisationRequest = Mockery::mock('Omnipay\WorldPayXML\Message\IncreaseAuthorisationRequest'); + $httpResponse = $this->getMockHttpResponse('IncreaseAuthorisationFailure.txt'); + $response = Response::make( + $increaseAuthorisationRequest, + $httpResponse->getBody() + ); + + $this->assertFalse($response->isSuccessful()); + $this->assertEquals('T0211010', $response->getTransactionReference()); + $this->assertEquals('ERROR: Could not find order', $response->getMessage()); } public function testPurchaseSuccess() { $httpResponse = $this->getMockHttpResponse('PurchaseSuccess.txt'); - $response = new Response( + $response = Response::make( $this->getMockRequest(), $httpResponse->getBody() ); @@ -31,7 +196,7 @@ public function testPurchaseSuccess() public function testPurchaseFailure() { $httpResponse = $this->getMockHttpResponse('PurchaseFailure.txt'); - $response = new Response( + $response = Response::make( $this->getMockRequest(), $httpResponse->getBody() ); @@ -41,4 +206,18 @@ public function testPurchaseFailure() $this->assertEquals('T0211234', $response->getTransactionReference()); $this->assertSame('CARD EXPIRED', $response->getMessage()); } + + public function testPurchaseReferral() + { + $httpResponse = $this->getMockHttpResponse('PurchaseReferral.txt'); + $response = Response::make( + $this->getMockRequest(), + $httpResponse->getBody() + ); + + $this->assertFalse($response->isSuccessful()); + $this->assertTrue($response->isRedirect()); + $this->assertEquals('T0211010', $response->getTransactionReference()); + $this->assertEquals('PENDING', $response->getMessage()); + } } diff --git a/tests/Omnipay/WorldPayXML/Mock/AuthorisationSuccess.txt b/tests/Omnipay/WorldPayXML/Mock/AuthorisationSuccess.txt new file mode 100755 index 0000000..4700538 --- /dev/null +++ b/tests/Omnipay/WorldPayXML/Mock/AuthorisationSuccess.txt @@ -0,0 +1,11 @@ +HTTP/1.1 200 OK +Connection: close +Server: VPS-3.033.00 +Date: Sat, 23 Feb 2013 05:17:32 GMT +Content-type: text/xml +Content-length: 758 + + + + \ No newline at end of file diff --git a/tests/Omnipay/WorldPayXML/Mock/BackOfficeCodeSuccess.txt b/tests/Omnipay/WorldPayXML/Mock/BackOfficeCodeSuccess.txt new file mode 100755 index 0000000..9e09012 --- /dev/null +++ b/tests/Omnipay/WorldPayXML/Mock/BackOfficeCodeSuccess.txt @@ -0,0 +1,11 @@ +HTTP/1.1 200 OK +Connection: close +Server: VPS-3.033.00 +Date: Sat, 23 Feb 2013 05:17:32 GMT +Content-type: text/xml +Content-length: 758 + + + + \ No newline at end of file diff --git a/tests/Omnipay/WorldPayXML/Mock/CancelSuccess.txt b/tests/Omnipay/WorldPayXML/Mock/CancelSuccess.txt new file mode 100755 index 0000000..1553ebd --- /dev/null +++ b/tests/Omnipay/WorldPayXML/Mock/CancelSuccess.txt @@ -0,0 +1,11 @@ +HTTP/1.1 200 OK +Connection: close +Server: VPS-3.033.00 +Date: Sat, 23 Feb 2013 05:17:32 GMT +Content-type: text/xml +Content-length: 758 + + + + \ No newline at end of file diff --git a/tests/Omnipay/WorldPayXML/Mock/CaptureFailure.txt b/tests/Omnipay/WorldPayXML/Mock/CaptureFailure.txt new file mode 100644 index 0000000..fc58e4b --- /dev/null +++ b/tests/Omnipay/WorldPayXML/Mock/CaptureFailure.txt @@ -0,0 +1,11 @@ +HTTP/1.1 200 OK +Connection: close +Server: VPS-3.033.00 +Date: Sat, 23 Feb 2013 05:17:32 GMT +Content-type: text/xml +Content-length: 758 + + + + diff --git a/tests/Omnipay/WorldPayXML/Mock/CaptureSuccess.txt b/tests/Omnipay/WorldPayXML/Mock/CaptureSuccess.txt new file mode 100755 index 0000000..f28f1bd --- /dev/null +++ b/tests/Omnipay/WorldPayXML/Mock/CaptureSuccess.txt @@ -0,0 +1,11 @@ +HTTP/1.1 200 OK +Connection: close +Server: VPS-3.033.00 +Date: Sat, 23 Feb 2013 05:17:32 GMT +Content-type: text/xml +Content-length: 758 + + + + \ No newline at end of file diff --git a/tests/Omnipay/WorldPayXML/Mock/IncreaseAuthorisationFailure.txt b/tests/Omnipay/WorldPayXML/Mock/IncreaseAuthorisationFailure.txt new file mode 100755 index 0000000..691d7ea --- /dev/null +++ b/tests/Omnipay/WorldPayXML/Mock/IncreaseAuthorisationFailure.txt @@ -0,0 +1,11 @@ +HTTP/1.1 200 OK +Connection: close +Server: VPS-3.033.00 +Date: Sat, 23 Feb 2013 05:17:32 GMT +Content-type: text/xml +Content-length: 649 + + + + diff --git a/tests/Omnipay/WorldPayXML/Mock/IncreaseAuthorisationSuccess.txt b/tests/Omnipay/WorldPayXML/Mock/IncreaseAuthorisationSuccess.txt new file mode 100755 index 0000000..86b0c18 --- /dev/null +++ b/tests/Omnipay/WorldPayXML/Mock/IncreaseAuthorisationSuccess.txt @@ -0,0 +1,11 @@ +HTTP/1.1 200 OK +Connection: close +Server: VPS-3.033.00 +Date: Sat, 23 Feb 2013 05:17:32 GMT +Content-type: text/xml +Content-length: 758 + + + +VISA-SSL AUTHORISED 4444********1111 \ No newline at end of file diff --git a/tests/Omnipay/WorldPayXML/Mock/InquiryFailure.txt b/tests/Omnipay/WorldPayXML/Mock/InquiryFailure.txt new file mode 100755 index 0000000..042e856 --- /dev/null +++ b/tests/Omnipay/WorldPayXML/Mock/InquiryFailure.txt @@ -0,0 +1,11 @@ +HTTP/1.1 200 OK +Connection: close +Server: VPS-3.033.00 +Date: Sat, 23 Feb 2013 05:17:32 GMT +Content-type: text/xml +Content-length: 649 + + + + \ No newline at end of file diff --git a/tests/Omnipay/WorldPayXML/Mock/InquirySuccess.txt b/tests/Omnipay/WorldPayXML/Mock/InquirySuccess.txt new file mode 100755 index 0000000..dd4e7af --- /dev/null +++ b/tests/Omnipay/WorldPayXML/Mock/InquirySuccess.txt @@ -0,0 +1,11 @@ +HTTP/1.1 200 OK +Connection: close +Server: VPS-3.033.00 +Date: Sat, 23 Feb 2013 05:17:32 GMT +Content-type: text/xml +Content-length: 758 + + + +VISA-SSL AUTHORISED 4444********1111 \ No newline at end of file diff --git a/tests/Omnipay/WorldPayXML/Mock/PurchaseReferral.txt b/tests/Omnipay/WorldPayXML/Mock/PurchaseReferral.txt new file mode 100644 index 0000000..62124c1 --- /dev/null +++ b/tests/Omnipay/WorldPayXML/Mock/PurchaseReferral.txt @@ -0,0 +1,11 @@ +HTTP/1.1 200 OK +Connection: close +Server: VPS-3.033.00 +Date: Sat, 23 Feb 2013 05:17:32 GMT +Content-type: text/xml +Content-length: 758 + + + +eJxVUm1vgjAQ/ivEzxu1UBDNWYMj2UzGZjb3AxpolERebMtw+/W7Koi79MPdc69P72B1Lo/Ot1S6qKvlhLrTibPisDsoKZNPmbVKckil1mIvnSLHCMbmHr6IhUE04bCNP+SJQ1+BYwHXAzKYmKqyg6gMB5Gd1ps3TkcB0mNQSrVJ7l1WHse4qx8aoXVXq5xTz2dBOIuA3CCoRCn5rq6P2giDvZ1XkwO5oJDVbWXUD4+8EMhgQKuO/GBMsyCk6zrXjLluVpdArB/IyGDbWk1jvXOR8/Q3nqbJ12+6i710H9/LEoiNgFwYyb0pDag3ZQ6dLShbMAbkgoMo7SD8eb11qPfgI94j0NhG8dWwVJHmHQK4FCWrbKAzWCDPTV1JjMAF3HTIpc74u8qlchJUVdFYhjiExYGMpJ5e7JIygz8dzoJ5yOZYn/kRC3y7qYvD9ijw72hIr02sAcSmkv4SSH8tqP27oj+BIsbE111068086332802 \ No newline at end of file diff --git a/tests/Omnipay/WorldPayXML/Mock/RefundFailure.txt b/tests/Omnipay/WorldPayXML/Mock/RefundFailure.txt new file mode 100755 index 0000000..fc58e4b --- /dev/null +++ b/tests/Omnipay/WorldPayXML/Mock/RefundFailure.txt @@ -0,0 +1,11 @@ +HTTP/1.1 200 OK +Connection: close +Server: VPS-3.033.00 +Date: Sat, 23 Feb 2013 05:17:32 GMT +Content-type: text/xml +Content-length: 758 + + + + diff --git a/tests/Omnipay/WorldPayXML/Mock/RefundSuccess.txt b/tests/Omnipay/WorldPayXML/Mock/RefundSuccess.txt new file mode 100755 index 0000000..cf7b07b --- /dev/null +++ b/tests/Omnipay/WorldPayXML/Mock/RefundSuccess.txt @@ -0,0 +1,11 @@ +HTTP/1.1 200 OK +Connection: close +Server: VPS-3.033.00 +Date: Sat, 23 Feb 2013 05:17:32 GMT +Content-type: text/xml +Content-length: 758 + + + + \ No newline at end of file diff --git a/tests/Omnipay/WorldPayXML/Mock/VoidSuccess.txt b/tests/Omnipay/WorldPayXML/Mock/VoidSuccess.txt new file mode 100755 index 0000000..63a845b --- /dev/null +++ b/tests/Omnipay/WorldPayXML/Mock/VoidSuccess.txt @@ -0,0 +1,11 @@ +HTTP/1.1 200 OK +Connection: close +Server: VPS-3.033.00 +Date: Sat, 23 Feb 2013 05:17:32 GMT +Content-type: text/xml +Content-length: 758 + + + + \ No newline at end of file