Skip to content

Commit ea0d378

Browse files
authored
Merge pull request #39 from rohitkes/future
Support for Meta Key and README changes.
2 parents 730219c + 15a3d9b commit ea0d378

File tree

8 files changed

+36
-13
lines changed

8 files changed

+36
-13
lines changed

README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ If you want to install SDK from Packagist,add the following dependency to your a
1313
```
1414
## Prerequisites
1515

16-
- PHP 5.3 or above
16+
- PHP 7.3 or above
1717
- [curl](http://php.net/manual/en/book.curl.php), [openssl](http://php.net/manual/en/book.openssl.php), [soap](http://php.net/manual/en/book.soap.php) extensions must be enabled
1818
- A CyberSource account. You can create an evaluation account [here](http://www.cybersource.com/register/).
1919
- A CyberSource transaction key. You will need to set your merchant ID and transaction key in the ````cybs.ini```` file in ````lib/conf````. Instructions on obtaining a transaction key can be found [here](http://www.cybersource.com/developers/integration_methods/simple_order_and_soap_toolkit_api/soap_api/html/wwhelp/wwhimpl/js/html/wwhelp.htm#href=Intro.04.3.html).
@@ -27,8 +27,15 @@ You can install the client either via [Composer](https://getcomposer.org/) or ma
2727
### Installing with Composer
2828
You'll first need to make sure you have Composer installed. You can follow the instructions on the [official web site](https://getcomposer.org/download/). Once Composer is installed, you can enter the project root and run:
2929
```
30-
composer.phar install
30+
Linux: composer.phar install
31+
Windows: composer install
3132
```
33+
If you already have composer installed for the project, you'll need to run the update command as below
34+
```
35+
Linux: composer.phar update
36+
Windows: composer update
37+
```
38+
3239
Then, to use the client, you'll need to include the Composer-generated autoload file:
3340

3441
```php
@@ -103,6 +110,15 @@ php samples/Sale.php
103110

104111
The samples will output the response object for each request if successful. Note that the samples contain test data and should not be run in a live environment.
105112

113+
## Meta Key support
114+
Meta Key is a key generated by an entity that can be used to authenticate on behalf of other entities provided that the entity which holds key is a parent entity or associated as a partner.
115+
116+
SOAP PHP SDK supports meta key by default. Additional detail regarding cybs.ini changes.
117+
118+
merchantID=\<Refers to portfolio or account MID> <br>
119+
transaction_key=\<Soap password generated for meta key><br>
120+
Send transacting merchantID in the sample request.
121+
106122
## Tests
107123

108124
In order to run tests, you'll need [PHPUnit](https://phpunit.de). You'll also need to use [Composer](https://getcomposer.org/) for autoloading. If you used Composer to install the client, this should already be set up. Otherwise, to use Composer for autoloading only, from the project root run

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
}
1616
],
1717
"require": {
18-
"php": ">=5.3",
18+
"php": ">=7.3",
1919
"ext-curl": "*",
2020
"ext-openssl": "*",
2121
"ext-soap": "*"
2222
},
2323
"require-dev": {
24-
"phpunit/phpunit": "3.7.*"
24+
"phpunit/phpunit": "9.5.*"
2525
},
2626
"autoload": {
2727
"classmap": ["lib/"]

samples/AuthFollowOnCapture.php

Lines changed: 4 additions & 3 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/CybsSoapClient.php');
99

1010

1111
// Before using this example, you can use your own reference code for the transaction.
@@ -31,11 +31,12 @@
3131
$billTo->email = '[email protected]';
3232
$billTo->ipAddress = '10.7.111.111';
3333
$request->billTo = $billTo;
34+
//$request->merchantID = '<merchantID>';
3435

3536
$card = new stdClass();
3637
$card->accountNumber = '4111111111111111';
3738
$card->expirationMonth = '12';
38-
$card->expirationYear = '2020';
39+
$card->expirationYear = '2021';
3940
$request->card = $card;
4041

4142
$purchaseTotals = new stdClass();
@@ -73,7 +74,7 @@
7374
$captureRequest->ccCaptureService = $ccCaptureService;
7475
$captureRequest->item = array($item0, $item1);
7576
$captureRequest->purchaseTotals = $purchaseTotals;
76-
77+
//$captureRequest->merchantID = '<merchantID>';
7778
$captureReply = $client->runTransaction($captureRequest);
7879

7980
// This section will show all the reply fields.

samples/AuthFromNameValuePairs.php

Lines changed: 4 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/CybsNameValuePairClient.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.
@@ -26,10 +26,12 @@
2626
$request['billTo_email'] = '[email protected]';
2727
$request['card_accountNumber'] = '4111111111111111';
2828
$request['card_expirationMonth'] = '12';
29-
$request['card_expirationYear'] = '2019';
29+
$request['card_expirationYear'] = '2021';
3030
$request['purchaseTotals_currency'] = 'USD';
3131
$request['item_0_unitPrice'] = '12.34';
3232
$request['item_1_unitPrice'] = '56.78';
33+
//$request['merchantID'] = '<merchantID>';
34+
3335
$reply = $client->runTransaction($request);
3436

3537
// This section will show all the reply fields.

samples/Sale.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,14 @@
3939
$card = new stdClass();
4040
$card->accountNumber = '4111111111111111';
4141
$card->expirationMonth = '12';
42-
$card->expirationYear = '2020';
42+
$card->expirationYear = '2021';
4343
$request->card = $card;
4444

4545
$purchaseTotals = new stdClass();
4646
$purchaseTotals->currency = 'USD';
4747
$purchaseTotals->grandTotalAmount = '90.01';
4848
$request->purchaseTotals = $purchaseTotals;
49+
//$request->merchantID = '<merchantID>';
4950

5051
$reply = $client->runTransaction($request);
5152

samples/Subscription.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
$card = new stdClass();
3535
$card->accountNumber = '4111111111111111';
3636
$card->expirationMonth = '12';
37-
$card->expirationYear = '2020';
37+
$card->expirationYear = '2021';
3838
$card->cardType='001';
3939
$request->card = $card;
4040

samples/xml/auth.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<requestMessage
33
xmlns="urn:schemas-cybersource-com:transaction-data-_1.109_"> -->
44
<merchantReferenceCode>your_merchant_reference_code</merchantReferenceCode>
5+
<!--<merchantID>cybs_test_new1</merchantID>-->
56
<billTo>
67
<firstName>John</firstName>
78
<lastName>Doe</lastName>
@@ -35,7 +36,7 @@
3536
<card>
3637
<accountNumber>4111111111111111</accountNumber>
3738
<expirationMonth>12</expirationMonth>
38-
<expirationYear>2020</expirationYear>
39+
<expirationYear>2021</expirationYear>
3940
</card>
4041
<ccAuthService run="true">
4142
</ccAuthService>

test/CybsSoapClientTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
2+
require __DIR__ . '/../vendor/autoload.php';
3+
use PHPUnit\Framework\TestCase;
24

3-
class CybsSoapClientTestCase extends PHPUnit_Framework_TestCase
5+
class CybsSoapClientTestCase extends TestCase
46
{
57
public function testClient()
68
{

0 commit comments

Comments
 (0)