Skip to content

Commit

Permalink
Merge pull request #39 from rohitkes/future
Browse files Browse the repository at this point in the history
Support for Meta Key and README changes.
  • Loading branch information
mahendya1002 authored Oct 6, 2021
2 parents 730219c + 15a3d9b commit ea0d378
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 13 deletions.
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ If you want to install SDK from Packagist,add the following dependency to your a
```
## Prerequisites

- PHP 5.3 or above
- PHP 7.3 or above
- [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
- A CyberSource account. You can create an evaluation account [here](http://www.cybersource.com/register/).
- 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).
Expand All @@ -27,8 +27,15 @@ You can install the client either via [Composer](https://getcomposer.org/) or ma
### Installing with Composer
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:
```
composer.phar install
Linux: composer.phar install
Windows: composer install
```
If you already have composer installed for the project, you'll need to run the update command as below
```
Linux: composer.phar update
Windows: composer update
```

Then, to use the client, you'll need to include the Composer-generated autoload file:

```php
Expand Down Expand Up @@ -103,6 +110,15 @@ php samples/Sale.php

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.

## Meta Key support
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.

SOAP PHP SDK supports meta key by default. Additional detail regarding cybs.ini changes.

merchantID=\<Refers to portfolio or account MID> <br>
transaction_key=\<Soap password generated for meta key><br>
Send transacting merchantID in the sample request.

## Tests

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
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
}
],
"require": {
"php": ">=5.3",
"php": ">=7.3",
"ext-curl": "*",
"ext-openssl": "*",
"ext-soap": "*"
},
"require-dev": {
"phpunit/phpunit": "3.7.*"
"phpunit/phpunit": "9.5.*"
},
"autoload": {
"classmap": ["lib/"]
Expand Down
7 changes: 4 additions & 3 deletions samples/AuthFollowOnCapture.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/CybsSoapClient.php');


// Before using this example, you can use your own reference code for the transaction.
Expand All @@ -31,11 +31,12 @@
$billTo->email = 'null@cybersource.com';
$billTo->ipAddress = '10.7.111.111';
$request->billTo = $billTo;
//$request->merchantID = '<merchantID>';

$card = new stdClass();
$card->accountNumber = '4111111111111111';
$card->expirationMonth = '12';
$card->expirationYear = '2020';
$card->expirationYear = '2021';
$request->card = $card;

$purchaseTotals = new stdClass();
Expand Down Expand Up @@ -73,7 +74,7 @@
$captureRequest->ccCaptureService = $ccCaptureService;
$captureRequest->item = array($item0, $item1);
$captureRequest->purchaseTotals = $purchaseTotals;

//$captureRequest->merchantID = '<merchantID>';
$captureReply = $client->runTransaction($captureRequest);

// This section will show all the reply fields.
Expand Down
6 changes: 4 additions & 2 deletions samples/AuthFromNameValuePairs.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/CybsNameValuePairClient.php');
//require_once(__DIR__ . '/../lib/CybsNameValuePairClient.php');


// Before using this example, you can use your own reference code for the transaction.
Expand All @@ -26,10 +26,12 @@
$request['billTo_email'] = 'jsmith@example.com';
$request['card_accountNumber'] = '4111111111111111';
$request['card_expirationMonth'] = '12';
$request['card_expirationYear'] = '2019';
$request['card_expirationYear'] = '2021';
$request['purchaseTotals_currency'] = 'USD';
$request['item_0_unitPrice'] = '12.34';
$request['item_1_unitPrice'] = '56.78';
//$request['merchantID'] = '<merchantID>';

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

// This section will show all the reply fields.
Expand Down
3 changes: 2 additions & 1 deletion samples/Sale.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@
$card = new stdClass();
$card->accountNumber = '4111111111111111';
$card->expirationMonth = '12';
$card->expirationYear = '2020';
$card->expirationYear = '2021';
$request->card = $card;

$purchaseTotals = new stdClass();
$purchaseTotals->currency = 'USD';
$purchaseTotals->grandTotalAmount = '90.01';
$request->purchaseTotals = $purchaseTotals;
//$request->merchantID = '<merchantID>';

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

Expand Down
2 changes: 1 addition & 1 deletion samples/Subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
$card = new stdClass();
$card->accountNumber = '4111111111111111';
$card->expirationMonth = '12';
$card->expirationYear = '2020';
$card->expirationYear = '2021';
$card->cardType='001';
$request->card = $card;

Expand Down
3 changes: 2 additions & 1 deletion samples/xml/auth.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<requestMessage
xmlns="urn:schemas-cybersource-com:transaction-data-_1.109_"> -->
<merchantReferenceCode>your_merchant_reference_code</merchantReferenceCode>
<!--<merchantID>cybs_test_new1</merchantID>-->
<billTo>
<firstName>John</firstName>
<lastName>Doe</lastName>
Expand Down Expand Up @@ -35,7 +36,7 @@
<card>
<accountNumber>4111111111111111</accountNumber>
<expirationMonth>12</expirationMonth>
<expirationYear>2020</expirationYear>
<expirationYear>2021</expirationYear>
</card>
<ccAuthService run="true">
</ccAuthService>
Expand Down
4 changes: 3 additions & 1 deletion test/CybsSoapClientTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php
require __DIR__ . '/../vendor/autoload.php';
use PHPUnit\Framework\TestCase;

class CybsSoapClientTestCase extends PHPUnit_Framework_TestCase
class CybsSoapClientTestCase extends TestCase
{
public function testClient()
{
Expand Down

0 comments on commit ea0d378

Please sign in to comment.