Skip to content

Commit

Permalink
Fixed Formating.
Browse files Browse the repository at this point in the history
  • Loading branch information
DhruvSheth authored and Dhruv Sheth - Dev committed Mar 30, 2018
1 parent 921fd46 commit 5f1208c
Show file tree
Hide file tree
Showing 111 changed files with 6,382 additions and 6,077 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
= LitleOnline CHANGELOG


==version 8.31.0
* Feature: Visa reccuring transaction

==version 8.29.2
Update SSL version to 6

Expand Down
53 changes: 30 additions & 23 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
{
"name": "litle/payments-sdk",
"type": "library",
"description": "The Litle PHP SDK is a PHP implementation of the [Litle & Co.](http://www.litle.com). XML API. This SDK was created to make it as easy as possible to connect process your payments with Litle",
"keywords": ["litle","sdk","ecommerce","payments"],
"homepage": "https://www.litle.com/developers/php",
"license": "MIT",
"authors": [
{
"name": "Litle SDK",
"email": "[email protected]",
"homepage": "https://www.litle.com/developers",
"role": "Developer"
}
],
"require": {
"php": ">=5.3.0",
"phpseclib/phpseclib": "0.3.5"
},
"require-dev": {
"phpunit/phpunit": "3.7.*"
},
"autoload":{
"psr-0":{"litle\\sdk" : "."}
"name": "litle/payments-sdk",
"type": "library",
"description": "The Litle PHP SDK is a PHP implementation of the [Litle & Co.](http://www.litle.com). XML API. This SDK was created to make it as easy as possible to connect process your payments with Litle",
"keywords": [
"litle",
"sdk",
"ecommerce",
"payments"
],
"homepage": "https://www.litle.com/developers/php",
"license": "MIT",
"authors": [
{
"name": "Litle SDK",
"email": "[email protected]",
"homepage": "https://www.litle.com/developers",
"role": "Developer"
}
],
"require": {
"php": ">=5.3.0",
"phpseclib/phpseclib": "0.3.5"
},
"require-dev": {
"phpunit/phpunit": "3.7.*"
},
"autoload": {
"psr-0": {
"litle\\sdk": "."
}
}
}
75 changes: 40 additions & 35 deletions litle/sdk/BatchRequest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace litle\sdk;
class BatchRequest
{
Expand All @@ -18,7 +19,7 @@ public function isFull()
return $this->total_txns >= MAX_TXNS_PER_BATCH;
}

public function __construct($request_dir=NULL)
public function __construct($request_dir = NULL)
{
// initialize the counts and amounts

Expand Down Expand Up @@ -148,8 +149,8 @@ public function addSale($hash_in)
{
$hash_out = Transactions::createSaleHash($hash_in);

$choice_hash = array($hash_out['card'],$hash_out['paypal'],$hash_out['token'],$hash_out['paypage']);
$choice2_hash= array($hash_out['fraudCheck'],$hash_out['cardholderAuthentication']);
$choice_hash = array($hash_out['card'], $hash_out['paypal'], $hash_out['token'], $hash_out['paypage']);
$choice2_hash = array($hash_out['fraudCheck'], $hash_out['cardholderAuthentication']);

$this->addTransaction($hash_out, $hash_in, 'sale', $choice_hash, $choice2_hash);
$this->counts_and_amounts['sale']['count'] += 1;
Expand All @@ -160,7 +161,7 @@ public function addAuth($hash_in)
{
$hash_out = Transactions::createAuthHash($hash_in);

$choice_hash = array(XmlFields::returnArrayValue($hash_out,'card'),XmlFields::returnArrayValue($hash_out,'paypal'),XmlFields::returnArrayValue($hash_out,'token'),XmlFields::returnArrayValue($hash_out,'paypage'));
$choice_hash = array(XmlFields::returnArrayValue($hash_out, 'card'), XmlFields::returnArrayValue($hash_out, 'paypal'), XmlFields::returnArrayValue($hash_out, 'token'), XmlFields::returnArrayValue($hash_out, 'paypage'));

$this->addTransaction($hash_out, $hash_in, 'authorization', $choice_hash);
$this->counts_and_amounts['auth']['count'] += 1;
Expand All @@ -171,7 +172,7 @@ public function addAuthReversal($hash_in)
{
$hash_out = Transactions::createAuthReversalHash($hash_in);

$this->addTransaction($hash_out,$hash_in,'authReversal');
$this->addTransaction($hash_out, $hash_in, 'authReversal');
$this->counts_and_amounts['authReversal']['count'] += 1;
$this->counts_and_amounts['authReversal']['amount'] += $hash_out['amount'];
}
Expand All @@ -180,9 +181,9 @@ public function addCredit($hash_in)
{
$hash_out = Transactions::createCreditHash($hash_in);

$choice_hash = array($hash_out['card'],$hash_out['paypal'],$hash_out['token'],$hash_out['paypage']);
$choice_hash = array($hash_out['card'], $hash_out['paypal'], $hash_out['token'], $hash_out['paypage']);

$this->addTransaction($hash_out,$hash_in,'credit',$choice_hash);
$this->addTransaction($hash_out, $hash_in, 'credit', $choice_hash);
$this->counts_and_amounts['credit']['count'] += 1;
$this->counts_and_amounts['credit']['amount'] += $hash_out['amount'];
}
Expand All @@ -191,19 +192,19 @@ public function addRegisterToken($hash_in)
{
$hash_out = Transactions::createRegisterTokenHash($hash_in);

$choice_hash = array($hash_out['accountNumber'],$hash_out['echeckForToken'],$hash_out['paypageRegistrationId']);
$choice_hash = array($hash_out['accountNumber'], $hash_out['echeckForToken'], $hash_out['paypageRegistrationId']);

$this->addTransaction($hash_out,$hash_in,'registerTokenRequest',$choice_hash);
$this->addTransaction($hash_out, $hash_in, 'registerTokenRequest', $choice_hash);
$this->counts_and_amounts['tokenRegistration']['count'] += 1;
}

public function addForceCapture($hash_in)
{
$hash_out = Transactions::createForceCaptureHash($hash_in);

$choice_hash = array(XmlFields::returnArrayValue($hash_out,'card'),XmlFields::returnArrayValue($hash_out,'paypal'),XmlFields::returnArrayValue($hash_out,'token'),XmlFields::returnArrayValue($hash_out,'paypage'));
$choice_hash = array(XmlFields::returnArrayValue($hash_out, 'card'), XmlFields::returnArrayValue($hash_out, 'paypal'), XmlFields::returnArrayValue($hash_out, 'token'), XmlFields::returnArrayValue($hash_out, 'paypage'));

$this->addTransaction($hash_out,$hash_in,'forceCapture',$choice_hash);
$this->addTransaction($hash_out, $hash_in, 'forceCapture', $choice_hash);
$this->counts_and_amounts['forceCapture']['count'] += 1;
$this->counts_and_amounts['forceCapture']['amount'] += $hash_out['amount'];

Expand All @@ -213,7 +214,7 @@ public function addCapture($hash_in)
{
$hash_out = Transactions::createCaptureHash($hash_in);

$this->addTransaction($hash_out,$hash_in,'capture');
$this->addTransaction($hash_out, $hash_in, 'capture');
$this->counts_and_amounts['capture']['count'] += 1;
$this->counts_and_amounts['capture']['amount'] += $hash_out['amount'];

Expand All @@ -223,9 +224,9 @@ public function addCaptureGivenAuth($hash_in)
{
$hash_out = Transactions::createCaptureGivenAuthHash($hash_in);

$choice_hash = array($hash_out['card'],$hash_out['token'],$hash_out['paypage']);
$choice_hash = array($hash_out['card'], $hash_out['token'], $hash_out['paypage']);

$this->addTransaction($hash_out,$hash_in,'captureGivenAuth',$choice_hash);
$this->addTransaction($hash_out, $hash_in, 'captureGivenAuth', $choice_hash);
$this->counts_and_amounts['captureGivenAuth']['count'] += 1;
$this->counts_and_amounts['captureGivenAuth']['amount'] += $hash_out['amount'];

Expand All @@ -235,19 +236,19 @@ public function addEcheckRedeposit($hash_in)
{
$hash_out = Transactions::createEcheckRedepositHash($hash_in);

$choice_hash = array($hash_out['echeck'],$hash_out['echeckToken']);
$choice_hash = array($hash_out['echeck'], $hash_out['echeckToken']);

$this->addTransaction($hash_out,$hash_in,'echeckRedeposit',$choice_hash);
$this->addTransaction($hash_out, $hash_in, 'echeckRedeposit', $choice_hash);
$this->counts_and_amounts['echeckRedeposit']['count'] += 1;
}

public function addEcheckSale($hash_in)
{
$hash_out = Transactions::createEcheckSaleHash($hash_in);

$choice_hash = array($hash_out['echeck'],$hash_out['echeckToken']);
$choice_hash = array($hash_out['echeck'], $hash_out['echeckToken']);

$this->addTransaction($hash_out,$hash_in,'echeckSale',$choice_hash);
$this->addTransaction($hash_out, $hash_in, 'echeckSale', $choice_hash);
$this->counts_and_amounts['echeckSale']['count'] += 1;
$this->counts_and_amounts['echeckSale']['amount'] += $hash_out['amount'];

Expand All @@ -257,9 +258,9 @@ public function addEcheckCredit($hash_in)
{
$hash_out = Transactions::createEcheckCreditHash($hash_in);

$choice_hash = array($hash_out['echeck'],$hash_out['echeckToken']);
$choice_hash = array($hash_out['echeck'], $hash_out['echeckToken']);

$this->addTransaction($hash_out,$hash_in,'echeckCredit',$choice_hash);
$this->addTransaction($hash_out, $hash_in, 'echeckCredit', $choice_hash);
$this->counts_and_amounts['echeckCredit']['count'] += 1;
$this->counts_and_amounts['echeckCredit']['amount'] += $hash_out['amount'];

Expand All @@ -269,9 +270,9 @@ public function addEcheckVerification($hash_in)
{
$hash_out = Transactions::createEcheckVerificationHash($hash_in);

$choice_hash = array($hash_out['echeck'],$hash_out['echeckToken']);
$choice_hash = array($hash_out['echeck'], $hash_out['echeckToken']);

$this->addTransaction($hash_out,$hash_in,'echeckVerification',$choice_hash);
$this->addTransaction($hash_out, $hash_in, 'echeckVerification', $choice_hash);
$this->counts_and_amounts['echeckVerification']['count'] += 1;
$this->counts_and_amounts['echeckVerification']['amount'] += $hash_out['amount'];

Expand All @@ -281,88 +282,92 @@ public function addUpdateCardValidationNumOnToken($hash_in)
{
$hash_out = Transactions::createUpdateCardValidationNumOnTokenHash($hash_in);

$this->addTransaction($hash_out,$hash_in,"updateCardValidationNumOnToken");
$this->addTransaction($hash_out, $hash_in, "updateCardValidationNumOnToken");
$this->counts_and_amounts['updateCardValidationNumOnToken']['count'] += 1;
}

public function addUpdateSubscription($hash_in)
{
$hash_out = Transactions::createUpdateSubscriptionHash($hash_in);

$this->addTransaction($hash_out,$hash_in,"updateSubscription");
$this->addTransaction($hash_out, $hash_in, "updateSubscription");
$this->counts_and_amounts['updateSubscription']['count'] += 1;
}

public function addCancelSubscription($hash_in)
{
$hash_out = Transactions::createCancelSubscriptionHash($hash_in);

$this->addTransaction($hash_out,$hash_in,"cancelSubscription");
$this->addTransaction($hash_out, $hash_in, "cancelSubscription");
$this->counts_and_amounts['cancelSubscription']['count'] += 1;
}

public function addCreatePlan($hash_in)
{
$hash_out = Transactions::createCreatePlanHash($hash_in);

$this->addTransaction($hash_out,$hash_in,"createPlan");
$this->addTransaction($hash_out, $hash_in, "createPlan");
$this->counts_and_amounts['createPlan']['count'] += 1;
}

public function addUpdatePlan($hash_in)
{
$hash_out = Transactions::createUpdatePlanHash($hash_in);

$this->addTransaction($hash_out,$hash_in,"updatePlan");
$this->addTransaction($hash_out, $hash_in, "updatePlan");
$this->counts_and_amounts['updatePlan']['count'] += 1;
}

public function addActivate($hash_in)
{
$hash_out = Transactions::createActivateHash($hash_in);

$this->addTransaction($hash_out,$hash_in,"activate");
$this->addTransaction($hash_out, $hash_in, "activate");
$this->counts_and_amounts['activate']['count'] += 1;
$this->counts_and_amounts['activate']['amount'] += $hash_out['amount'];
}

public function addDeactivate($hash_in)
{
$hash_out = Transactions::createDeactivateHash($hash_in);

$this->addTransaction($hash_out,$hash_in,"deactivate");
$this->addTransaction($hash_out, $hash_in, "deactivate");
$this->counts_and_amounts['deactivate']['count'] += 1;
}

public function addLoad($hash_in)
{
$hash_out = Transactions::createLoadHash($hash_in);

$this->addTransaction($hash_out,$hash_in,"load");
$this->addTransaction($hash_out, $hash_in, "load");
$this->counts_and_amounts['load']['count'] += 1;
$this->counts_and_amounts['load']['amount'] += $hash_out['amount'];
}

public function addUnload($hash_in)
{
$hash_out = Transactions::createUnloadHash($hash_in);

$this->addTransaction($hash_out,$hash_in,"unload");
$this->addTransaction($hash_out, $hash_in, "unload");
$this->counts_and_amounts['unload']['count'] += 1;
$this->counts_and_amounts['unload']['amount'] += $hash_out['amount'];
}

public function addBalanceInquiry($hash_in)
{
$hash_out = Transactions::createBalanceInquiryHash($hash_in);

$this->addTransaction($hash_out,$hash_in,"balanceInquiry");
$this->addTransaction($hash_out, $hash_in, "balanceInquiry");
$this->counts_and_amounts['balanceInquiry']['count'] += 1;
}

public function addAccountUpdate($hash_in)
{
$hash_out = Transactions::createAccountUpdate($hash_in);

$choice_hash = array(XmlFields::returnArrayValue($hash_out,'card'),XmlFields::returnArrayValue($hash_out,'token'));
$choice_hash = array(XmlFields::returnArrayValue($hash_out, 'card'), XmlFields::returnArrayValue($hash_out, 'token'));

$this->addTransaction($hash_out,$hash_in,'accountUpdate',$choice_hash);
$this->addTransaction($hash_out, $hash_in, 'accountUpdate', $choice_hash);
$this->counts_and_amounts['accountUpdate']['count'] += 1;
}

Expand Down Expand Up @@ -408,7 +413,7 @@ private function addTransaction($hash_out, $hash_in, $type, $choice1 = null, $ch
*/
public function closeRequest()
{
$handle = @fopen($this->transaction_file,"r");
$handle = @fopen($this->transaction_file, "r");
if ($handle) {
file_put_contents($this->batch_file, Obj2xml::generateBatchHeader($this->counts_and_amounts), FILE_APPEND);
while (($buffer = fgets($handle, 4096)) !== false) {
Expand Down
5 changes: 3 additions & 2 deletions litle/sdk/Checker.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/

namespace litle\sdk;
class Checker
{
Expand All @@ -36,8 +37,8 @@ public static function requiredField($value)

public static function choice($choiceArray)
{
$i= 0;
for ($y=0;$y<count($choiceArray);$y++) {
$i = 0;
for ($y = 0; $y < count($choiceArray); $y++) {
if (isset($choiceArray[$y])) {
$i++;
}
Expand Down
15 changes: 8 additions & 7 deletions litle/sdk/Communication.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,36 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/

namespace litle\sdk;
class Communication
{
public static function httpRequest($req,$hash_config=NULL)
public static function httpRequest($req, $hash_config = NULL)
{
$config = Obj2xml::getConfig($hash_config);

if ((int) $config['print_xml']) {
if ((int)$config['print_xml']) {
echo $req;
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_PROXY, $config['proxy']);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: text/xml','Expect: '));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: text/xml', 'Expect: '));
curl_setopt($ch, CURLOPT_URL, $config['url']);
curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, true);
curl_setopt($ch,CURLOPT_TIMEOUT, $config['timeout']);
curl_setopt($ch, CURLOPT_TIMEOUT, $config['timeout']);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,2);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSLVERSION, 6);
$output = curl_exec($ch);
$responseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (! $output) {
if (!$output) {
throw new \Exception (curl_error($ch));
} else {
curl_close($ch);
if ((int) $config['print_xml']) {
if ((int)$config['print_xml']) {
echo $output;
}

Expand Down
Loading

0 comments on commit 5f1208c

Please sign in to comment.