diff --git a/lib/CybsNameValuePairClient.php b/lib/CybsNameValuePairClient.php index 0d70513..c7ceeb3 100644 --- a/lib/CybsNameValuePairClient.php +++ b/lib/CybsNameValuePairClient.php @@ -28,6 +28,9 @@ public function runTransaction($request) if (!is_array($request)) { throw new Exception('Name-value pairs must be in array'); } + if (!array_key_exists('merchantID', $request)) { + $request['merchantID'] = $this->getMerchantId(); + } $nvpRequest = ""; foreach($request as $k => $v) { $nvpRequest .= ($k . "=" . $v ."\n"); diff --git a/samples/AuthFollowOnCapture.php b/samples/AuthFollowOnCapture.php index 0ae0537..fd81c8a 100644 --- a/samples/AuthFollowOnCapture.php +++ b/samples/AuthFollowOnCapture.php @@ -56,6 +56,7 @@ $reply = $client->runTransaction($request); // This section will show all the reply fields. +echo '
'; print("\nAUTH RESPONSE: " . print_r($reply, true)); if ($reply->decision != 'ACCEPT') { @@ -76,4 +77,5 @@ $captureReply = $client->runTransaction($captureRequest); // This section will show all the reply fields. -print("\nCAPTRUE RESPONSE: " . print_r($captureReply, true)); +print("\nCAPTURE RESPONSE: " . print_r($captureReply, true)); +echo ''; diff --git a/samples/AuthFromNameValuePairs.php b/samples/AuthFromNameValuePairs.php index 3de11e5..c6450d1 100644 --- a/samples/AuthFromNameValuePairs.php +++ b/samples/AuthFromNameValuePairs.php @@ -5,7 +5,7 @@ // Using Composer-generated autoload file. require __DIR__ . '/../vendor/autoload.php'; // Or, uncomment the line below if you're not using Composer autoloader. -// require_once(__DIR__ . '/../lib/CybsSoapClient.php'); +// require_once(__DIR__ . '/../lib/CybsNameValuePairClient.php'); // Before using this example, you can use your own reference code for the transaction. @@ -15,7 +15,6 @@ $request = array(); $request['ccAuthService_run'] = 'true'; -$request['merchantID'] = 'your_merchant_id'; $request['merchantReferenceCode'] = $referenceCode; $request['billTo_firstName'] = 'Jane'; $request['billTo_lastName'] = 'Smith'; @@ -34,4 +33,6 @@ $reply = $client->runTransaction($request); // This section will show all the reply fields. +echo '
'; print("\nRESPONSE:\n" . $reply); +echo ''; diff --git a/samples/AuthFromXml.php b/samples/AuthFromXml.php index ccbff1e..717623b 100644 --- a/samples/AuthFromXml.php +++ b/samples/AuthFromXml.php @@ -15,4 +15,6 @@ $reply = $client->runTransactionFromFile(__DIR__ . '/xml/auth.xml', $referenceCode); // This section will show all the reply fields. +echo '
'; print("\nRESPONSE: " . print_r($reply, true)); +echo ''; diff --git a/samples/Sale.php b/samples/Sale.php index 481b539..5d92cc7 100644 --- a/samples/Sale.php +++ b/samples/Sale.php @@ -50,4 +50,6 @@ $reply = $client->runTransaction($request); // This section will show all the reply fields. +echo '
'; print("\nRESPONSE: " . print_r($reply, true)); +echo ''; diff --git a/samples/Subscription.php b/samples/Subscription.php index 25ac2be..185906f 100644 --- a/samples/Subscription.php +++ b/samples/Subscription.php @@ -54,13 +54,14 @@ $reply = $client->runTransaction($request); // This section will show all the reply fields. +echo '
'; print("\nSUBSCRIPTION RESPONSE: " . print_r($reply, true)); if ($reply->decision != 'ACCEPT') { print("\nFailed subscription request.\n"); - return; } else { print("\n Subscription service request successful\n"); } +echo '';