-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from caswell-wc/master
Created messages for capture, void, and refund and created integration tests
- Loading branch information
Showing
20 changed files
with
778 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
composer.lock | ||
composer.phar | ||
phpunit.xml | ||
/tests/Mock/myCredentials.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<?php | ||
|
||
namespace Omnipay\Elavon\Message; | ||
|
||
/** | ||
* Elavon's Converge Completion Request | ||
* | ||
* This class processes form post requests using the Elavon/Converge gateway as documented here: | ||
* https://resourcecentre.elavonpaymentgateway.com/index.php/download-developer-guide | ||
* | ||
* Also here: https://www.convergepay.com/converge-webapp/developer/#/welcome | ||
* | ||
* ### Test Mode | ||
* | ||
* In order to begin testing you will need the following parameters from Elavon/Converge: | ||
* | ||
* * merchantId, aka ssl_merchant_id | ||
* * username, aka ssl_user_id | ||
* * password, aka ssl_pin | ||
* | ||
* These parameters are issued for a short time only. You need to contact Converge to request an extension | ||
* a few days before these parameters expire. | ||
* | ||
* ### Example | ||
* | ||
* #### Initialize Gateway | ||
* | ||
* <code> | ||
* // | ||
* // Put your gateway credentials here. | ||
* // | ||
* $credentials = array( | ||
* 'merchantId' => '000000', | ||
* 'username' => 'USERNAME', | ||
* 'password' => 'PASSWORD' | ||
* 'testMode' => true, // Or false if you want to test production mode | ||
* ); | ||
* | ||
* // Create a gateway object | ||
* // (routes to GatewayFactory::create) | ||
* $gateway = Omnipay::create('Elavon_Converge'); | ||
* | ||
* // Initialise the gateway | ||
* $gateway->initialize($credentials); | ||
* </code> | ||
* | ||
* #### Direct Credit Card Completion | ||
* | ||
* <code> | ||
* try { | ||
* $transaction = $gateway->capture(array( | ||
* 'amount' => '10.00', | ||
* 'transactionReference' => '123456' | ||
* )); | ||
* $response = $transaction->send(); | ||
* $data = $response->getData(); | ||
* echo "Gateway capture response data == " . print_r($data, true) . "\n"; | ||
* | ||
* if ($response->isSuccessful()) { | ||
* echo "Capture transaction was successful!\n"; | ||
* } | ||
* } catch (\Exception $e) { | ||
* echo "Exception caught while attempting capture.\n"; | ||
* echo "Exception type == " . get_class($e) . "\n"; | ||
* echo "Message == " . $e->getMessage() . "\n"; | ||
* } | ||
* </code> | ||
* | ||
* @link https://www.myvirtualmerchant.com/VirtualMerchant/ | ||
* @link https://resourcecentre.elavonpaymentgateway.com/index.php/download-developer-guide | ||
* @see \Omnipay\Elavon\ConvergeGateway | ||
*/ | ||
class ConvergeCaptureRequest extends ConvergeTransactionManage | ||
{ | ||
|
||
protected $transactionType = 'cccomplete'; | ||
|
||
protected function manageValidate() | ||
{ | ||
$this->validate('transactionReference', 'amount'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<?php | ||
|
||
namespace Omnipay\Elavon\Message; | ||
|
||
/** | ||
* Elavon's Converge Return Request | ||
* | ||
* This class processes form post requests using the Elavon/Converge gateway as documented here: | ||
* https://resourcecentre.elavonpaymentgateway.com/index.php/download-developer-guide | ||
* | ||
* Also here: https://www.convergepay.com/converge-webapp/developer/#/welcome | ||
* | ||
* ### Test Mode | ||
* | ||
* In order to begin testing you will need the following parameters from Elavon/Converge: | ||
* | ||
* * merchantId, aka ssl_merchant_id | ||
* * username, aka ssl_user_id | ||
* * password, aka ssl_pin | ||
* | ||
* These parameters are issued for a short time only. You need to contact Converge to request an extension | ||
* a few days before these parameters expire. | ||
* | ||
* ### Example | ||
* | ||
* #### Initialize Gateway | ||
* | ||
* <code> | ||
* // | ||
* // Put your gateway credentials here. | ||
* // | ||
* $credentials = array( | ||
* 'merchantId' => '000000', | ||
* 'username' => 'USERNAME', | ||
* 'password' => 'PASSWORD' | ||
* 'testMode' => true, // Or false if you want to test production mode | ||
* ); | ||
* | ||
* // Create a gateway object | ||
* // (routes to GatewayFactory::create) | ||
* $gateway = Omnipay::create('Elavon_Converge'); | ||
* | ||
* // Initialise the gateway | ||
* $gateway->initialize($credentials); | ||
* </code> | ||
* | ||
* #### Direct Credit Card Completion | ||
* | ||
* <code> | ||
* try { | ||
* $transaction = $gateway->refund(array( | ||
* 'amount' => '10.00', | ||
* 'transactionReference' => '123456' | ||
* )); | ||
* $response = $transaction->send(); | ||
* $data = $response->getData(); | ||
* echo "Gateway capture response data == " . print_r($data, true) . "\n"; | ||
* | ||
* if ($response->isSuccessful()) { | ||
* echo "Capture transaction was successful!\n"; | ||
* } | ||
* } catch (\Exception $e) { | ||
* echo "Exception caught while attempting capture.\n"; | ||
* echo "Exception type == " . get_class($e) . "\n"; | ||
* echo "Message == " . $e->getMessage() . "\n"; | ||
* } | ||
* </code> | ||
* | ||
* @link https://www.myvirtualmerchant.com/VirtualMerchant/ | ||
* @link https://resourcecentre.elavonpaymentgateway.com/index.php/download-developer-guide | ||
* @see \Omnipay\Elavon\ConvergeGateway | ||
*/ | ||
class ConvergeRefundRequest extends ConvergeTransactionManage | ||
{ | ||
|
||
protected $transactionType = 'ccreturn'; | ||
|
||
protected function manageValidate() | ||
{ | ||
$this->validate('transactionReference', 'amount'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace Omnipay\Elavon\Message; | ||
|
||
/** | ||
* Class ConvergeTransactionManage | ||
* | ||
* This is a base class used in requests that manage an existing transaction | ||
* | ||
* @package Omnipay\Elavon\Message | ||
*/ | ||
abstract class ConvergeTransactionManage extends ConvergeAbstractRequest | ||
{ | ||
|
||
protected $transactionType; | ||
|
||
/** | ||
* Get the data needed for a transaction modification | ||
* | ||
* @return array | ||
*/ | ||
public function getData() | ||
{ | ||
$this->manageValidate(); | ||
|
||
$data = array( | ||
'ssl_transaction_type'=>$this->transactionType, | ||
'ssl_txn_id'=>$this->getTransactionReference(), | ||
'ssl_amount'=>$this->getAmount() | ||
); | ||
|
||
return array_merge($this->getBaseData(), $data); | ||
} | ||
|
||
abstract protected function manageValidate(); | ||
} |
Oops, something went wrong.