Skip to content

Commit 8d9e0de

Browse files
committed
Merge pull request #16 from djvaldez/nvp-support
Update name-value pair client to automatically include the merchant I…
2 parents b42b48e + 919a21e commit 8d9e0de

6 files changed

Lines changed: 15 additions & 4 deletions

File tree

lib/CybsNameValuePairClient.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ public function runTransaction($request)
2828
if (!is_array($request)) {
2929
throw new Exception('Name-value pairs must be in array');
3030
}
31+
if (!array_key_exists('merchantID', $request)) {
32+
$request['merchantID'] = $this->getMerchantId();
33+
}
3134
$nvpRequest = "";
3235
foreach($request as $k => $v) {
3336
$nvpRequest .= ($k . "=" . $v ."\n");

samples/AuthFollowOnCapture.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
$reply = $client->runTransaction($request);
5757

5858
// This section will show all the reply fields.
59+
echo '<pre>';
5960
print("\nAUTH RESPONSE: " . print_r($reply, true));
6061

6162
if ($reply->decision != 'ACCEPT') {
@@ -76,4 +77,5 @@
7677
$captureReply = $client->runTransaction($captureRequest);
7778

7879
// This section will show all the reply fields.
79-
print("\nCAPTRUE RESPONSE: " . print_r($captureReply, true));
80+
print("\nCAPTURE RESPONSE: " . print_r($captureReply, true));
81+
echo '</pre>';

samples/AuthFromNameValuePairs.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Using Composer-generated autoload file.
66
require __DIR__ . '/../vendor/autoload.php';
77
// Or, uncomment the line below if you're not using Composer autoloader.
8-
// require_once(__DIR__ . '/../lib/CybsSoapClient.php');
8+
// require_once(__DIR__ . '/../lib/CybsNameValuePairClient.php');
99

1010

1111
// Before using this example, you can use your own reference code for the transaction.
@@ -15,7 +15,6 @@
1515

1616
$request = array();
1717
$request['ccAuthService_run'] = 'true';
18-
$request['merchantID'] = 'your_merchant_id';
1918
$request['merchantReferenceCode'] = $referenceCode;
2019
$request['billTo_firstName'] = 'Jane';
2120
$request['billTo_lastName'] = 'Smith';
@@ -34,4 +33,6 @@
3433
$reply = $client->runTransaction($request);
3534

3635
// This section will show all the reply fields.
36+
echo '<pre>';
3737
print("\nRESPONSE:\n" . $reply);
38+
echo '</pre>';

samples/AuthFromXml.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@
1515
$reply = $client->runTransactionFromFile(__DIR__ . '/xml/auth.xml', $referenceCode);
1616

1717
// This section will show all the reply fields.
18+
echo '<pre>';
1819
print("\nRESPONSE: " . print_r($reply, true));
20+
echo '</pre>';

samples/Sale.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,6 @@
5050
$reply = $client->runTransaction($request);
5151

5252
// This section will show all the reply fields.
53+
echo '<pre>';
5354
print("\nRESPONSE: " . print_r($reply, true));
55+
echo '</pre>';

samples/Subscription.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,14 @@
5454
$reply = $client->runTransaction($request);
5555

5656
// This section will show all the reply fields.
57+
echo '<pre>';
5758
print("\nSUBSCRIPTION RESPONSE: " . print_r($reply, true));
5859

5960
if ($reply->decision != 'ACCEPT') {
6061
print("\nFailed subscription request.\n");
61-
return;
6262
}
6363
else
6464
{
6565
print("\n Subscription service request successful\n");
6666
}
67+
echo '</pre>';

0 commit comments

Comments
 (0)