diff --git a/CRM/Core/Payment/OmnipayMultiProcessor.php b/CRM/Core/Payment/OmnipayMultiProcessor.php
index 95f940b10..3aa1c9978 100644
--- a/CRM/Core/Payment/OmnipayMultiProcessor.php
+++ b/CRM/Core/Payment/OmnipayMultiProcessor.php
@@ -125,7 +125,7 @@ function doDirectPayment(&$params, $component = 'contribute') {
$this->gateway = Omnipay::create(str_replace('omnipay_', '', $this->_paymentProcessor['payment_processor_type']));
$this->setProcessorFields();
$this->setTransactionID(CRM_Utils_Array::value('contributionID', $params));
- $this->storeReturnUrls($params['qfKey']);
+ $this->storeReturnUrls($params['qfKey'], CRM_Utils_Array::value('participantID', $params), CRM_Utils_Array::value('eventID', $params));
$this->saveBillingAddressIfRequired($params);
try {
@@ -545,12 +545,21 @@ public function processPaymentNotification($params) {
$this->handleError('error', $this->transaction_id . $e->getMessage(), 'ipn_completion', 9000, 'An error may have occurred. Please check your receipt is correct');
}
}
+ $_REQUEST = $originalRequest;
+ CRM_Utils_System::redirect($this->getStoredUrl('success'));
}
elseif ($this->transaction_id) {
civicrm_api3('contribution', 'create', array('id' => $this->transaction_id, 'contribution_status_id' => 'Failed'));
}
+ $userMessage = $response->getMessage();
+ if (method_exists($response, 'getInvalidFields') && ($invalidFields = $response->getInvalidFields()) != array()) {
+ $userMessage = ts('Invalid data entered in fields ' . implode(', ', $invalidFields));
+ }
+
+ $this->handleError('error', $this->transaction_id . ' ' . $response->getMessage(), 'processor_error', 9002, $userMessage);
+
$_REQUEST = $originalRequest;
- CRM_Utils_System::redirect($this->getStoredUrl('success'));
+ CRM_Utils_System::redirect($this->getStoredUrl('fail'));
}
/**
diff --git a/CRM/Core/Payment/PaymentExtended.php b/CRM/Core/Payment/PaymentExtended.php
index 5ffdf0ec6..90d58852a 100644
--- a/CRM/Core/Payment/PaymentExtended.php
+++ b/CRM/Core/Payment/PaymentExtended.php
@@ -92,7 +92,28 @@ protected function getReturnSuccessUrl($qfKey) {
),
TRUE, NULL, FALSE
);
+ }
+ /**
+ * @param $key
+ * @param null $participantID
+ * @param null $eventID
+ * @return string
+ */
+ protected function getReturnFailUrl($key, $participantID = NULL, $eventID = NULL) {
+ $test = $this->_is_test ? '&action=preview' : '';
+ if ($this->_component == "event") {
+ return CRM_Utils_System::url('civicrm/event/register',
+ "reset=1&cc=fail&participantId={$participantID}&id={$eventID}{$test}&qfKey={$key}",
+ FALSE, NULL, FALSE
+ );
+ }
+ else {
+ return CRM_Utils_System::url('civicrm/contribute/transact',
+ "_qf_Main_display=1&cancel=1&qfKey={$key}{$test}",
+ FALSE, NULL, FALSE
+ );
+ }
}
/**
@@ -142,9 +163,12 @@ protected function getGoBackUrl($qfKey) {
/**
* Store the URL for browser redirection in the session for use upon return
* @param $qfKey
+ * @param null $participantID
+ * @param null $eventID
*/
- protected function storeReturnUrls($qfKey) {
+ protected function storeReturnUrls($qfKey, $participantID = NULL, $eventID = NULL) {
CRM_Core_Session::singleton()->set("ipn_success_url_{$this->transaction_id}", $this->getReturnSuccessUrl($qfKey));
+ CRM_Core_Session::singleton()->set("ipn_fail_url_{$this->transaction_id}", $this->getReturnFailUrl($qfKey, $participantID, $eventID));
}
/**
diff --git a/composer.lock b/composer.lock
index ade34cafb..0ff96af7a 100644
--- a/composer.lock
+++ b/composer.lock
@@ -66,7 +66,7 @@
"source": {
"type": "git",
"url": "https://github.com/eileenmcnaughton/omnipay-cybersource.git",
- "reference": "159121d4e1d03ef9d1bc8cc7456ff3c3aebca5b7"
+ "reference": "1507d67f189c40e879686984941ebaaa3b51ecf7"
},
"require": {
"omnipay/common": "~2.0"
@@ -100,7 +100,7 @@
"payment",
"purchase"
],
- "time": "2014-10-29 08:42:24"
+ "time": "2014-12-23 23:43:51"
},
{
"name": "fuzion/omnipay-paybox",
@@ -2182,12 +2182,12 @@
"source": {
"type": "git",
"url": "https://github.com/symfony/HttpFoundation.git",
- "reference": "a16860109680ad9aa016744b6b8fda489b637163"
+ "reference": "75aa9d57bb6377fa89ad40014105ae9bdee28999"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/a16860109680ad9aa016744b6b8fda489b637163",
- "reference": "a16860109680ad9aa016744b6b8fda489b637163",
+ "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/75aa9d57bb6377fa89ad40014105ae9bdee28999",
+ "reference": "75aa9d57bb6377fa89ad40014105ae9bdee28999",
"shasum": ""
},
"require": {
@@ -2226,7 +2226,7 @@
],
"description": "Symfony HttpFoundation Component",
"homepage": "http://symfony.com",
- "time": "2014-12-22 16:45:18"
+ "time": "2014-12-23 17:36:18"
}
],
"packages-dev": [
diff --git a/vendor/autoload.php b/vendor/autoload.php
index 958778180..b88a732e3 100644
--- a/vendor/autoload.php
+++ b/vendor/autoload.php
@@ -4,4 +4,4 @@
require_once __DIR__ . '/composer' . '/autoload_real.php';
-return ComposerAutoloaderInitd7ce6b0ecc411238e36cfba3cfd63906::getLoader();
+return ComposerAutoloaderInit2f446acaf1c72b6d037f252974f9891f::getLoader();
diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php
index 0c61504d4..77f31313a 100644
--- a/vendor/composer/autoload_real.php
+++ b/vendor/composer/autoload_real.php
@@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
-class ComposerAutoloaderInitd7ce6b0ecc411238e36cfba3cfd63906
+class ComposerAutoloaderInit2f446acaf1c72b6d037f252974f9891f
{
private static $loader;
@@ -19,9 +19,9 @@ public static function getLoader()
return self::$loader;
}
- spl_autoload_register(array('ComposerAutoloaderInitd7ce6b0ecc411238e36cfba3cfd63906', 'loadClassLoader'), true, true);
+ spl_autoload_register(array('ComposerAutoloaderInit2f446acaf1c72b6d037f252974f9891f', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
- spl_autoload_unregister(array('ComposerAutoloaderInitd7ce6b0ecc411238e36cfba3cfd63906', 'loadClassLoader'));
+ spl_autoload_unregister(array('ComposerAutoloaderInit2f446acaf1c72b6d037f252974f9891f', 'loadClassLoader'));
$includePaths = require __DIR__ . '/include_paths.php';
array_push($includePaths, get_include_path());
@@ -48,7 +48,7 @@ public static function getLoader()
}
}
-function composerRequired7ce6b0ecc411238e36cfba3cfd63906($file)
+function composerRequire2f446acaf1c72b6d037f252974f9891f($file)
{
require $file;
}
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
index 5b4843fb4..7eec77276 100644
--- a/vendor/composer/installed.json
+++ b/vendor/composer/installed.json
@@ -2201,50 +2201,6 @@
"purchase"
]
},
- {
- "name": "dioscouri/omnipay-cybersource",
- "version": "dev-master",
- "version_normalized": "9999999-dev",
- "source": {
- "type": "git",
- "url": "https://github.com/eileenmcnaughton/omnipay-cybersource.git",
- "reference": "159121d4e1d03ef9d1bc8cc7456ff3c3aebca5b7"
- },
- "require": {
- "omnipay/common": "~2.0"
- },
- "require-dev": {
- "omnipay/tests": "~2.0"
- },
- "time": "2014-10-29 08:42:24",
- "type": "library",
- "installation-source": "source",
- "autoload": {
- "psr-4": {
- "Omnipay\\Cybersource\\": "src/"
- }
- },
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Rafael Diaz-Tushman",
- "email": "rdiaztushman@dioscouri.com"
- }
- ],
- "description": "Cybersource support for Omnipay payment processing library",
- "homepage": "https://github.com/dioscouri/omnipay-cybersource",
- "keywords": [
- "cybersource",
- "gateway",
- "merchant",
- "omnipay",
- "pay",
- "payment",
- "purchase"
- ]
- },
{
"name": "omnipay/common",
"version": "2.3.2",
@@ -2733,61 +2689,6 @@
"standards"
]
},
- {
- "name": "symfony/http-foundation",
- "version": "2.7.x-dev",
- "version_normalized": "2.7.9999999.9999999-dev",
- "target-dir": "Symfony/Component/HttpFoundation",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/HttpFoundation.git",
- "reference": "a16860109680ad9aa016744b6b8fda489b637163"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/a16860109680ad9aa016744b6b8fda489b637163",
- "reference": "a16860109680ad9aa016744b6b8fda489b637163",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "require-dev": {
- "symfony/expression-language": "~2.4"
- },
- "time": "2014-12-22 16:45:18",
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.7-dev"
- }
- },
- "installation-source": "source",
- "autoload": {
- "psr-0": {
- "Symfony\\Component\\HttpFoundation\\": ""
- },
- "classmap": [
- "Symfony/Component/HttpFoundation/Resources/stubs"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Symfony Community",
- "homepage": "http://symfony.com/contributors"
- },
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- }
- ],
- "description": "Symfony HttpFoundation Component",
- "homepage": "http://symfony.com"
- },
{
"name": "symfony/yaml",
"version": "2.7.x-dev",
@@ -2988,5 +2889,104 @@
"payment",
"purchase"
]
+ },
+ {
+ "name": "dioscouri/omnipay-cybersource",
+ "version": "dev-master",
+ "version_normalized": "9999999-dev",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/eileenmcnaughton/omnipay-cybersource.git",
+ "reference": "1507d67f189c40e879686984941ebaaa3b51ecf7"
+ },
+ "require": {
+ "omnipay/common": "~2.0"
+ },
+ "require-dev": {
+ "omnipay/tests": "~2.0"
+ },
+ "time": "2014-12-23 23:43:51",
+ "type": "library",
+ "installation-source": "source",
+ "autoload": {
+ "psr-4": {
+ "Omnipay\\Cybersource\\": "src/"
+ }
+ },
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Rafael Diaz-Tushman",
+ "email": "rdiaztushman@dioscouri.com"
+ }
+ ],
+ "description": "Cybersource support for Omnipay payment processing library",
+ "homepage": "https://github.com/dioscouri/omnipay-cybersource",
+ "keywords": [
+ "cybersource",
+ "gateway",
+ "merchant",
+ "omnipay",
+ "pay",
+ "payment",
+ "purchase"
+ ]
+ },
+ {
+ "name": "symfony/http-foundation",
+ "version": "2.7.x-dev",
+ "version_normalized": "2.7.9999999.9999999-dev",
+ "target-dir": "Symfony/Component/HttpFoundation",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/HttpFoundation.git",
+ "reference": "75aa9d57bb6377fa89ad40014105ae9bdee28999"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/75aa9d57bb6377fa89ad40014105ae9bdee28999",
+ "reference": "75aa9d57bb6377fa89ad40014105ae9bdee28999",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "symfony/expression-language": "~2.4"
+ },
+ "time": "2014-12-23 17:36:18",
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.7-dev"
+ }
+ },
+ "installation-source": "source",
+ "autoload": {
+ "psr-0": {
+ "Symfony\\Component\\HttpFoundation\\": ""
+ },
+ "classmap": [
+ "Symfony/Component/HttpFoundation/Resources/stubs"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Symfony Community",
+ "homepage": "http://symfony.com/contributors"
+ },
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ }
+ ],
+ "description": "Symfony HttpFoundation Component",
+ "homepage": "http://symfony.com"
}
]
diff --git a/vendor/dioscouri/omnipay-cybersource/README.md b/vendor/dioscouri/omnipay-cybersource/README.md
index 78bd39a87..da3dafd0f 100644
--- a/vendor/dioscouri/omnipay-cybersource/README.md
+++ b/vendor/dioscouri/omnipay-cybersource/README.md
@@ -1,2 +1,50 @@
-omnipay-cybersource
-===================
+# Omnipay: Cybersource
+
+**Cybersource driver for the Omnipay PHP payment processing library**
+
+[![Build Status](https://travis-ci.org/eileenmcnaughton/omnipay-cybersource.png?branch=master)](https://travis-ci.org/eileenmcnaughton/omnipay-cybersource)
+[![Latest Stable Version](https://poser.pugx.org/eileenmcnaughton/omnipay-cybersource/version.png)](https://packagist.org/eileenmcnaughton/omnipay-cybersource/)
+[![Total Downloads](https://poser.pugx.org/eileenmcnaughton/omnipay-cybersource/d/total.png)](https://packagist.org/eileenmcnaughton/omnipay-cybersource/)
+
+[Omnipay](https://github.com/thephpleague/omnipay) is a framework agnostic, multi-gateway payment
+processing library for PHP 5.3+. This package implements 2Checkout support for Omnipay.
+
+## Installation
+
+Omnipay is installed via [Composer](http://getcomposer.org/). To install, simply add it
+to your `composer.json` file:
+
+```json
+{
+ "require": {
+ "dioscouri/omnipay-cybersource": "~2.0"
+ }
+}
+```
+
+And run composer to update your dependencies:
+
+ $ curl -s http://getcomposer.org/installer | php
+ $ php composer.phar update
+
+## Basic Usage
+
+The following gateways are provided by this package:
+
+* Cybersource
+
+For general usage instructions, please see the main [Omnipay](https://github.com/thephpleague/omnipay)
+repository.
+
+## Support
+
+If you are having general issues with Omnipay, we suggest posting on
+[Stack Overflow](http://stackoverflow.com/). Be sure to add the
+[omnipay tag](http://stackoverflow.com/questions/tagged/omnipay) so it can be easily found.
+
+If you want to keep up to date with release announcements, discuss ideas for the project,
+or ask more detailed questions, there is also a [mailing list](https://groups.google.com/forum/#!forum/omnipay) which
+you can subscribe to.
+
+If you believe you have found a bug, please report it using the [GitHub issue tracker](https://github.com/eileenmcnaughton/omnipay-cybersource/issues),
+or better yet, fork the library and submit a pull request.
diff --git a/vendor/dioscouri/omnipay-cybersource/src/Gateway.php b/vendor/dioscouri/omnipay-cybersource/src/Gateway.php
index 869acf249..a34466678 100644
--- a/vendor/dioscouri/omnipay-cybersource/src/Gateway.php
+++ b/vendor/dioscouri/omnipay-cybersource/src/Gateway.php
@@ -8,7 +8,8 @@
/**
* CyberSource Secure Acceptance Silent Order POST Gateway
*
- * @link http://apps.cybersource.com/library/documentation/dev_guides/Secure_Acceptance_SOP/html/wwhelp/wwhimpl/js/html/wwhelp.htm
+ * @link http:
+ * //apps.cybersource.com/library/documentation/dev_guides/Secure_Acceptance_SOP/html/wwhelp/wwhimpl/js/html/wwhelp.htm
*/
class Gateway extends AbstractGateway
{
@@ -140,8 +141,7 @@ public function setTransactionType($value)
public function generateSignature($data)
{
$data_to_sign = array();
- foreach ($data as $key => $value)
- {
+ foreach ($data as $key => $value) {
$data_to_sign[] = $key . "=" . $value;
}
$pairs = implode(',', $data_to_sign);
diff --git a/vendor/dioscouri/omnipay-cybersource/src/Message/AbstractRequest.php b/vendor/dioscouri/omnipay-cybersource/src/Message/AbstractRequest.php
index fda474c5e..4c7156d6f 100644
--- a/vendor/dioscouri/omnipay-cybersource/src/Message/AbstractRequest.php
+++ b/vendor/dioscouri/omnipay-cybersource/src/Message/AbstractRequest.php
@@ -12,7 +12,7 @@ abstract class AbstractRequest extends \Omnipay\Common\Message\AbstractRequest
protected $liveEndpoint = 'https://secureacceptance.cybersource.com/silent';
protected $testEndpoint = 'https://testsecureacceptance.cybersource.com/silent';
protected $endpoint = '';
- protected $isUsOrCanada = FALSE;
+ protected $isUsOrCanada = false;
public function sendData($data)
{
@@ -105,7 +105,7 @@ public function getCardType()
{
$types = $this->getCardTypes();
$brand = $this->getCard()->getBrand();
- return empty($types[$brand]) ? NULL : $types[$brand];
+ return empty($types[$brand]) ? null : $types[$brand];
}
/**
@@ -119,16 +119,15 @@ public function getCardType()
public function generateSignature($data, $fields, $secret_key)
{
$data_to_sign = array();
- foreach ($fields as $field)
- {
+ foreach ($fields as $field) {
$data_to_sign[] = $field . "=" . $data[$field];
}
$pairs = implode(',', $data_to_sign);
- return base64_encode(hash_hmac('sha256', $pairs, $secret_key, TRUE));
+ return base64_encode(hash_hmac('sha256', $pairs, $secret_key, true));
}
- function supportsDeleteCard()
+ public function supportsDeleteCard()
{
- return FALSE;
+ return false;
}
}
diff --git a/vendor/dioscouri/omnipay-cybersource/src/Message/AuthorizeRequest.php b/vendor/dioscouri/omnipay-cybersource/src/Message/AuthorizeRequest.php
index 0723a614f..e9a561f6b 100644
--- a/vendor/dioscouri/omnipay-cybersource/src/Message/AuthorizeRequest.php
+++ b/vendor/dioscouri/omnipay-cybersource/src/Message/AuthorizeRequest.php
@@ -18,7 +18,8 @@ public function getData()
$data['signed_field_names'] = implode(',', array_keys($data)) . ',signed_field_names';
$data['signature'] = $this->signData($data);
- // this is in progress - at this stage let's just pass the cc fields through but really we need to return a form for them to enter it
+ // this is in progress - at this stage let's just pass the
+ // cc fields through but really we need to return a form for them to enter it
$data['card_type'] = $this->getCardType();
$data['card_number'] = $this->getCard()->getNumber();
$data['card_expiry_date'] = $this->getCard()->getExpiryDate('m-Y');
@@ -39,7 +40,8 @@ public function buildDataToSign($data)
return implode(",", $dataToSign);
}
- public function getRequiredFields() {
+ public function getRequiredFields()
+ {
$extraFields = $this->getIsUsOrCanada() ? $this->getRequiredFieldsUsAndCanada() : array();
return array_merge(array(
'amount',
@@ -53,7 +55,8 @@ public function getRequiredFields() {
), $extraFields);
}
- public function getRequiredFieldsUsAndCanada() {
+ public function getRequiredFieldsUsAndCanada()
+ {
return array(
'postcode',
'billingState',
diff --git a/vendor/dioscouri/omnipay-cybersource/src/Message/CompleteAuthorizeRequest.php b/vendor/dioscouri/omnipay-cybersource/src/Message/CompleteAuthorizeRequest.php
index 68e94a9ef..fa0b9ccd8 100644
--- a/vendor/dioscouri/omnipay-cybersource/src/Message/CompleteAuthorizeRequest.php
+++ b/vendor/dioscouri/omnipay-cybersource/src/Message/CompleteAuthorizeRequest.php
@@ -2,7 +2,7 @@
namespace Omnipay\Cybersource\Message;
/**
- *
+ *
* @author Rafael Diaz-Tushman
*
*/
@@ -12,7 +12,7 @@ class CompleteAuthorizeRequest extends AbstractRequest
public function getData()
{
$data = $this->httpRequest->request->all();
-
+
return $data;
}
diff --git a/vendor/dioscouri/omnipay-cybersource/src/Message/CompleteAuthorizeResponse.php b/vendor/dioscouri/omnipay-cybersource/src/Message/CompleteAuthorizeResponse.php
index 91fa9be04..464853405 100644
--- a/vendor/dioscouri/omnipay-cybersource/src/Message/CompleteAuthorizeResponse.php
+++ b/vendor/dioscouri/omnipay-cybersource/src/Message/CompleteAuthorizeResponse.php
@@ -4,7 +4,7 @@
use Omnipay\Common\Message\AbstractResponse;
/**
- *
+ *
* @author Rafael Diaz-Tushman
*
*/
@@ -20,38 +20,37 @@ public function getTransactionReference()
{
return isset($this->data['transaction_id']) ? $this->data['transaction_id'] : null;
}
-
+
public function getMerchantTransactionReference()
{
return isset($this->data['req_reference_number']) ? $this->data['req_reference_number'] : null;
- }
+ }
public function getMessage()
{
return isset($this->data['message']) ? $this->data['message'] : null;
}
-
- public function validateSignature( $secret_key )
+
+ public function validateSignature($secret_key)
{
- $signed_field_names_string = isset($this->data['signed_field_names']) ? $this->data['signed_field_names'] : null;
+ $signed_field_names_string = isset($this->data['signed_field_names'])
+ ? $this->data['signed_field_names'] : null;
$signed_field_names = explode(",", $signed_field_names_string);
-
+
$signed_data = array();
- foreach ($signed_field_names as $field)
- {
+ foreach ($signed_field_names as $field) {
$signed_data[] = $field . "=" . $this->data[$field];
}
-
+
$our_signature = base64_encode(hash_hmac('sha256', implode(",", $signed_data), $secret_key, true));
-
- if ($our_signature != $this->data['signature'])
- {
+
+ if ($our_signature != $this->data['signature']) {
return false;
}
-
+
return true;
}
-
+
public function getCVNCode()
{
return isset($this->data['auth_cv_result']) ? $this->data['auth_cv_result'] : null;
@@ -70,12 +69,11 @@ public function getReasonCode()
public function getInvalidFields()
{
$array = array();
-
- if (!empty($this->data['invalid_fields']))
- {
+
+ if (!empty($this->data['invalid_fields'])) {
$array = explode(",", $this->data['invalid_fields']);
}
-
+
return $array;
- }
+ }
}
diff --git a/vendor/dioscouri/omnipay-cybersource/src/Message/CompletePurchaseRequest.php b/vendor/dioscouri/omnipay-cybersource/src/Message/CompletePurchaseRequest.php
index 36032856a..0aee9df85 100644
--- a/vendor/dioscouri/omnipay-cybersource/src/Message/CompletePurchaseRequest.php
+++ b/vendor/dioscouri/omnipay-cybersource/src/Message/CompletePurchaseRequest.php
@@ -1,6 +1,7 @@
httpRequest->request->all();
- if ($this->generateSignature($data, explode(',', $data['signed_field_names']), $this->getSecretKey()) != $data['signature']) {
- throw new InvalidRequestException('signature mismatch');
+ public function getData()
+ {
+ $data = $this->httpRequest->request->all();
+ if ($this->generateSignature(
+ $data,
+ explode(',', $data['signed_field_names']),
+ $this->getSecretKey()
+ )
+ != $data['signature']) {
+ throw new InvalidRequestException('signature mismatch');
+ }
+ return $data;
+ }
+
+ public function sendData($data)
+ {
+ return $this->response = new CompletePurchaseResponse($this, $data);
}
- return $data;
- }
- public function sendData($data)
- {
- return $this->response = new CompletePurchaseResponse($this, $data);
- }
}
diff --git a/vendor/dioscouri/omnipay-cybersource/src/Message/CompletePurchaseResponse.php b/vendor/dioscouri/omnipay-cybersource/src/Message/CompletePurchaseResponse.php
index a5a077dad..ce6659fdc 100644
--- a/vendor/dioscouri/omnipay-cybersource/src/Message/CompletePurchaseResponse.php
+++ b/vendor/dioscouri/omnipay-cybersource/src/Message/CompletePurchaseResponse.php
@@ -7,20 +7,20 @@
/**
* New Complete Purchase response
*/
-class CompletePurchaseResponse extends AbstractResponse
+class CompletePurchaseResponse extends CompleteAuthorizeResponse
{
- public function isSuccessful()
- {
- return isset($this->data['decision']) && 'ACCEPT' === $this->data['decision'];
- }
+ public function isSuccessful()
+ {
+ return isset($this->data['decision']) && 'ACCEPT' === $this->data['decision'];
+ }
- public function getTransactionReference()
- {
- return isset($this->data['req_reference_number']) ? $this->data['req_reference_number'] : null;
- }
+ public function getTransactionReference()
+ {
+ return isset($this->data['req_reference_number']) ? $this->data['req_reference_number'] : null;
+ }
- public function getMessage()
- {
- return isset($this->data['message']) ? $this->data['message'] : null;
- }
+ public function getMessage()
+ {
+ return isset($this->data['message']) ? $this->data['message'] : null;
+ }
}
diff --git a/vendor/dioscouri/omnipay-cybersource/src/Message/PurchaseRequest.php b/vendor/dioscouri/omnipay-cybersource/src/Message/PurchaseRequest.php
index 62e5573a4..d7807ca58 100644
--- a/vendor/dioscouri/omnipay-cybersource/src/Message/PurchaseRequest.php
+++ b/vendor/dioscouri/omnipay-cybersource/src/Message/PurchaseRequest.php
@@ -7,8 +7,8 @@
*/
class PurchaseRequest extends AuthorizeRequest
{
- public function getTransactionType()
- {
- return 'sale';
- }
+ public function getTransactionType()
+ {
+ return 'sale';
+ }
}
diff --git a/vendor/dioscouri/omnipay-cybersource/src/Message/Response.php b/vendor/dioscouri/omnipay-cybersource/src/Message/Response.php
index 93d1d2813..36812a918 100644
--- a/vendor/dioscouri/omnipay-cybersource/src/Message/Response.php
+++ b/vendor/dioscouri/omnipay-cybersource/src/Message/Response.php
@@ -6,7 +6,6 @@
use Omnipay\Common\Message\RequestInterface;
use Omnipay\Common\Message\RedirectResponseInterface;
-
/**
* Stripe Response
*/
@@ -21,17 +20,17 @@ public function __construct(RequestInterface $request, $data, $redirectUrl)
public function isSuccessful()
{
- return FALSE;
+ return false;
}
public function isRedirect()
{
- return TRUE;
+ return true;
}
public function isTransparentRedirect()
{
- return TRUE;
+ return true;
}
public function getRedirectUrl()
@@ -49,15 +48,16 @@ public function getRedirectData()
return $this->getData();
}
- public function getRedirectResponseHiddenFields() {
- $hiddenFields = '';
- foreach ($this->getRedirectData() as $key => $value) {
- $hiddenFields .= sprintf(
- '',
- htmlentities($key, ENT_QUOTES, 'UTF-8', false),
- htmlentities($value, ENT_QUOTES, 'UTF-8', false)
- )."\n";
- }
- return $hiddenFields;
+ public function getRedirectResponseHiddenFields()
+ {
+ $hiddenFields = '';
+ foreach ($this->getRedirectData() as $key => $value) {
+ $hiddenFields .= sprintf(
+ '',
+ htmlentities($key, ENT_QUOTES, 'UTF-8', false),
+ htmlentities($value, ENT_QUOTES, 'UTF-8', false)
+ ) . "\n";
+ }
+ return $hiddenFields;
}
}
diff --git a/vendor/dioscouri/omnipay-cybersource/tests/AbstractRequestTest.php b/vendor/dioscouri/omnipay-cybersource/tests/AbstractRequestTest.php
index 498bf234f..70ede3fde 100644
--- a/vendor/dioscouri/omnipay-cybersource/tests/AbstractRequestTest.php
+++ b/vendor/dioscouri/omnipay-cybersource/tests/AbstractRequestTest.php
@@ -49,6 +49,7 @@ public function testGetCardType()
}
public function testGetData() {
+ $this->request->setSecretKey('key');
$this->request->getData();
}
}
diff --git a/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/LegacyPdoSessionHandler.php b/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/LegacyPdoSessionHandler.php
new file mode 100644
index 000000000..fff83315a
--- /dev/null
+++ b/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/LegacyPdoSessionHandler.php
@@ -0,0 +1,268 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
+
+/**
+ * Session handler using a PDO connection to read and write data.
+ *
+ * Session data is a binary string that can contain non-printable characters like the null byte.
+ * For this reason this handler base64 encodes the data to be able to save it in a character column.
+ *
+ * This version of the PdoSessionHandler does NOT implement locking. So concurrent requests to the
+ * same session can result in data loss due to race conditions.
+ *
+ * @author Fabien Potencier
+ * @author Michael Williams
+ * @author Tobias Schultze
+ *
+ * @deprecated Deprecated since version 2.6, to be removed in 3.0. Use
+ * {@link PdoSessionHandler} instead.
+ */
+class LegacyPdoSessionHandler implements \SessionHandlerInterface
+{
+ /**
+ * @var \PDO PDO instance
+ */
+ private $pdo;
+
+ /**
+ * @var string Table name
+ */
+ private $table;
+
+ /**
+ * @var string Column for session id
+ */
+ private $idCol;
+
+ /**
+ * @var string Column for session data
+ */
+ private $dataCol;
+
+ /**
+ * @var string Column for timestamp
+ */
+ private $timeCol;
+
+ /**
+ * Constructor.
+ *
+ * List of available options:
+ * * db_table: The name of the table [required]
+ * * db_id_col: The column where to store the session id [default: sess_id]
+ * * db_data_col: The column where to store the session data [default: sess_data]
+ * * db_time_col: The column where to store the timestamp [default: sess_time]
+ *
+ * @param \PDO $pdo A \PDO instance
+ * @param array $dbOptions An associative array of DB options
+ *
+ * @throws \InvalidArgumentException When "db_table" option is not provided
+ */
+ public function __construct(\PDO $pdo, array $dbOptions = array())
+ {
+ if (!array_key_exists('db_table', $dbOptions)) {
+ throw new \InvalidArgumentException('You must provide the "db_table" option for a PdoSessionStorage.');
+ }
+ if (\PDO::ERRMODE_EXCEPTION !== $pdo->getAttribute(\PDO::ATTR_ERRMODE)) {
+ throw new \InvalidArgumentException(sprintf('"%s" requires PDO error mode attribute be set to throw Exceptions (i.e. $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION))', __CLASS__));
+ }
+ $this->pdo = $pdo;
+ $dbOptions = array_merge(array(
+ 'db_id_col' => 'sess_id',
+ 'db_data_col' => 'sess_data',
+ 'db_time_col' => 'sess_time',
+ ), $dbOptions);
+
+ $this->table = $dbOptions['db_table'];
+ $this->idCol = $dbOptions['db_id_col'];
+ $this->dataCol = $dbOptions['db_data_col'];
+ $this->timeCol = $dbOptions['db_time_col'];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function open($savePath, $sessionName)
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function close()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function destroy($sessionId)
+ {
+ // delete the record associated with this id
+ $sql = "DELETE FROM $this->table WHERE $this->idCol = :id";
+
+ try {
+ $stmt = $this->pdo->prepare($sql);
+ $stmt->bindParam(':id', $sessionId, \PDO::PARAM_STR);
+ $stmt->execute();
+ } catch (\PDOException $e) {
+ throw new \RuntimeException(sprintf('PDOException was thrown when trying to delete a session: %s', $e->getMessage()), 0, $e);
+ }
+
+ return true;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function gc($maxlifetime)
+ {
+ // delete the session records that have expired
+ $sql = "DELETE FROM $this->table WHERE $this->timeCol < :time";
+
+ try {
+ $stmt = $this->pdo->prepare($sql);
+ $stmt->bindValue(':time', time() - $maxlifetime, \PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (\PDOException $e) {
+ throw new \RuntimeException(sprintf('PDOException was thrown when trying to delete expired sessions: %s', $e->getMessage()), 0, $e);
+ }
+
+ return true;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function read($sessionId)
+ {
+ $sql = "SELECT $this->dataCol FROM $this->table WHERE $this->idCol = :id";
+
+ try {
+ $stmt = $this->pdo->prepare($sql);
+ $stmt->bindParam(':id', $sessionId, \PDO::PARAM_STR);
+ $stmt->execute();
+
+ // We use fetchAll instead of fetchColumn to make sure the DB cursor gets closed
+ $sessionRows = $stmt->fetchAll(\PDO::FETCH_NUM);
+
+ if ($sessionRows) {
+ return base64_decode($sessionRows[0][0]);
+ }
+
+ return '';
+ } catch (\PDOException $e) {
+ throw new \RuntimeException(sprintf('PDOException was thrown when trying to read the session data: %s', $e->getMessage()), 0, $e);
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function write($sessionId, $data)
+ {
+ $encoded = base64_encode($data);
+
+ try {
+ // We use a single MERGE SQL query when supported by the database.
+ $mergeSql = $this->getMergeSql();
+
+ if (null !== $mergeSql) {
+ $mergeStmt = $this->pdo->prepare($mergeSql);
+ $mergeStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR);
+ $mergeStmt->bindParam(':data', $encoded, \PDO::PARAM_STR);
+ $mergeStmt->bindValue(':time', time(), \PDO::PARAM_INT);
+ $mergeStmt->execute();
+
+ return true;
+ }
+
+ $updateStmt = $this->pdo->prepare(
+ "UPDATE $this->table SET $this->dataCol = :data, $this->timeCol = :time WHERE $this->idCol = :id"
+ );
+ $updateStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR);
+ $updateStmt->bindParam(':data', $encoded, \PDO::PARAM_STR);
+ $updateStmt->bindValue(':time', time(), \PDO::PARAM_INT);
+ $updateStmt->execute();
+
+ // When MERGE is not supported, like in Postgres, we have to use this approach that can result in
+ // duplicate key errors when the same session is written simultaneously. We can just catch such an
+ // error and re-execute the update. This is similar to a serializable transaction with retry logic
+ // on serialization failures but without the overhead and without possible false positives due to
+ // longer gap locking.
+ if (!$updateStmt->rowCount()) {
+ try {
+ $insertStmt = $this->pdo->prepare(
+ "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time)"
+ );
+ $insertStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR);
+ $insertStmt->bindParam(':data', $encoded, \PDO::PARAM_STR);
+ $insertStmt->bindValue(':time', time(), \PDO::PARAM_INT);
+ $insertStmt->execute();
+ } catch (\PDOException $e) {
+ // Handle integrity violation SQLSTATE 23000 (or a subclass like 23505 in Postgres) for duplicate keys
+ if (0 === strpos($e->getCode(), '23')) {
+ $updateStmt->execute();
+ } else {
+ throw $e;
+ }
+ }
+ }
+ } catch (\PDOException $e) {
+ throw new \RuntimeException(sprintf('PDOException was thrown when trying to write the session data: %s', $e->getMessage()), 0, $e);
+ }
+
+ return true;
+ }
+
+ /**
+ * Returns a merge/upsert (i.e. insert or update) SQL query when supported by the database.
+ *
+ * @return string|null The SQL string or null when not supported
+ */
+ private function getMergeSql()
+ {
+ $driver = $this->pdo->getAttribute(\PDO::ATTR_DRIVER_NAME);
+
+ switch ($driver) {
+ case 'mysql':
+ return "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) ".
+ "ON DUPLICATE KEY UPDATE $this->dataCol = VALUES($this->dataCol), $this->timeCol = VALUES($this->timeCol)";
+ case 'oci':
+ // DUAL is Oracle specific dummy table
+ return "MERGE INTO $this->table USING DUAL ON ($this->idCol = :id) ".
+ "WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) ".
+ "WHEN MATCHED THEN UPDATE SET $this->dataCol = :data, $this->timeCol = :time";
+ case 'sqlsrv' === $driver && version_compare($this->pdo->getAttribute(\PDO::ATTR_SERVER_VERSION), '10', '>='):
+ // MERGE is only available since SQL Server 2008 and must be terminated by semicolon
+ // It also requires HOLDLOCK according to http://weblogs.sqlteam.com/dang/archive/2009/01/31/UPSERT-Race-Condition-With-MERGE.aspx
+ return "MERGE INTO $this->table WITH (HOLDLOCK) USING (SELECT 1 AS dummy) AS src ON ($this->idCol = :id) ".
+ "WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) ".
+ "WHEN MATCHED THEN UPDATE SET $this->dataCol = :data, $this->timeCol = :time;";
+ case 'sqlite':
+ return "INSERT OR REPLACE INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time)";
+ }
+ }
+
+ /**
+ * Return a PDO instance
+ *
+ * @return \PDO
+ */
+ protected function getConnection()
+ {
+ return $this->pdo;
+ }
+}
diff --git a/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/LegacyPdoSessionHandlerTest.php b/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/LegacyPdoSessionHandlerTest.php
new file mode 100644
index 000000000..5fa625541
--- /dev/null
+++ b/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/LegacyPdoSessionHandlerTest.php
@@ -0,0 +1,111 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler;
+
+use Symfony\Component\HttpFoundation\Session\Storage\Handler\LegacyPdoSessionHandler;
+
+class LegacyPdoSessionHandlerTest extends \PHPUnit_Framework_TestCase
+{
+ private $pdo;
+
+ protected function setUp()
+ {
+ if (!class_exists('PDO') || !in_array('sqlite', \PDO::getAvailableDrivers())) {
+ $this->markTestSkipped('This test requires SQLite support in your environment');
+ }
+
+ $this->pdo = new \PDO('sqlite::memory:');
+ $this->pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
+ $sql = 'CREATE TABLE sessions (sess_id VARCHAR(128) PRIMARY KEY, sess_data TEXT, sess_time INTEGER)';
+ $this->pdo->exec($sql);
+ }
+
+ public function testIncompleteOptions()
+ {
+ $this->setExpectedException('InvalidArgumentException');
+ $storage = new LegacyPdoSessionHandler($this->pdo, array());
+ }
+
+ public function testWrongPdoErrMode()
+ {
+ $pdo = new \PDO('sqlite::memory:');
+ $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_SILENT);
+ $pdo->exec('CREATE TABLE sessions (sess_id VARCHAR(128) PRIMARY KEY, sess_data TEXT, sess_time INTEGER)');
+
+ $this->setExpectedException('InvalidArgumentException');
+ $storage = new LegacyPdoSessionHandler($pdo, array('db_table' => 'sessions'));
+ }
+
+ public function testWrongTableOptionsWrite()
+ {
+ $storage = new LegacyPdoSessionHandler($this->pdo, array('db_table' => 'bad_name'));
+ $this->setExpectedException('RuntimeException');
+ $storage->write('foo', 'bar');
+ }
+
+ public function testWrongTableOptionsRead()
+ {
+ $storage = new LegacyPdoSessionHandler($this->pdo, array('db_table' => 'bad_name'));
+ $this->setExpectedException('RuntimeException');
+ $storage->read('foo', 'bar');
+ }
+
+ public function testWriteRead()
+ {
+ $storage = new LegacyPdoSessionHandler($this->pdo, array('db_table' => 'sessions'));
+ $storage->write('foo', 'bar');
+ $this->assertEquals('bar', $storage->read('foo'), 'written value can be read back correctly');
+ }
+
+ public function testMultipleInstances()
+ {
+ $storage1 = new LegacyPdoSessionHandler($this->pdo, array('db_table' => 'sessions'));
+ $storage1->write('foo', 'bar');
+
+ $storage2 = new LegacyPdoSessionHandler($this->pdo, array('db_table' => 'sessions'));
+ $this->assertEquals('bar', $storage2->read('foo'), 'values persist between instances');
+ }
+
+ public function testSessionDestroy()
+ {
+ $storage = new LegacyPdoSessionHandler($this->pdo, array('db_table' => 'sessions'));
+ $storage->write('foo', 'bar');
+ $this->assertCount(1, $this->pdo->query('SELECT * FROM sessions')->fetchAll());
+
+ $storage->destroy('foo');
+
+ $this->assertCount(0, $this->pdo->query('SELECT * FROM sessions')->fetchAll());
+ }
+
+ public function testSessionGC()
+ {
+ $storage = new LegacyPdoSessionHandler($this->pdo, array('db_table' => 'sessions'));
+
+ $storage->write('foo', 'bar');
+ $storage->write('baz', 'bar');
+
+ $this->assertCount(2, $this->pdo->query('SELECT * FROM sessions')->fetchAll());
+
+ $storage->gc(-1);
+ $this->assertCount(0, $this->pdo->query('SELECT * FROM sessions')->fetchAll());
+ }
+
+ public function testGetConnection()
+ {
+ $storage = new LegacyPdoSessionHandler($this->pdo, array('db_table' => 'sessions'), array());
+
+ $method = new \ReflectionMethod($storage, 'getConnection');
+ $method->setAccessible(true);
+
+ $this->assertInstanceOf('\PDO', $method->invoke($storage));
+ }
+}