forked from LiveCarta/PayPal-PHP-SDK
Merge branch 'update-version'
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -8,6 +8,7 @@ build
|
|||||||
.project
|
.project
|
||||||
.settings
|
.settings
|
||||||
.buildpath
|
.buildpath
|
||||||
|
atlassian-ide-plugin.xml
|
||||||
*.bak
|
*.bak
|
||||||
|
|
||||||
# Composer
|
# Composer
|
||||||
|
|||||||
18
README.md
18
README.md
@@ -104,10 +104,26 @@ use PayPal\Api\Payment;
|
|||||||
## SDK Configuration
|
## SDK Configuration
|
||||||
|
|
||||||
The samples in this repo pick the SDK configuration from the `sdk_config.ini` file. If you do not want to use an ini file or want to pick your configuration dynamically, you can use the `$apiContext->setConfig()` method to pass in the configuration as a hashmap. See the `sample/bootstrap.php` file for an example.
|
The samples in this repo pick the SDK configuration from the `sdk_config.ini` file. If you do not want to use an ini file or want to pick your configuration dynamically, you can use the `$apiContext->setConfig()` method to pass in the configuration as a hashmap. See the `sample/bootstrap.php` file for an example.
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
There are two kinds of tests that we include in our sdk package. Unit tests, and Integration Tests.
|
||||||
|
|
||||||
|
* **Unit Tests**
|
||||||
|
* Unit tests can be executed by running this command `phpunit` at Paypal SDK root location.
|
||||||
|
* It executes the tests with configuration stored in `phpunit.xml` file.
|
||||||
|
* **Integration Tests**
|
||||||
|
* Integration tests make curl requests to sandbox environments by default. It would test both unit as well as integration tests. To execute, run this command `phpunit -c phpunit.integration.xml` at Paypal SDK root location.
|
||||||
|
* It executes the tests with configuration stored in `phpunit.integration.xml` file.
|
||||||
|
* The configurations could be changed from `tests\sdk_config.ini` file.
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
* If you find solution to an [issue/improvements](https://github.com/paypal/rest-api-sdk-php/issues) in sdk that would be helpful to everyone, feel free to send us a pull request.
|
||||||
|
* The ideal approach to create a fix would be to fork the repository, create a branch in your repository, and make a pull request out of it.
|
||||||
|
* It is desirable if there is enough comments/documentation and Tests included in the pull request.
|
||||||
|
* For general idea of contribution, please follow the guidelines mentioned [here](https://guides.github.com/activities/contributing-to-open-source/).
|
||||||
|
|
||||||
## More help
|
## More help
|
||||||
|
|
||||||
* [API Reference](https://developer.paypal.com/webapps/developer/docs/api/)
|
* [API Reference](https://developer.paypal.com/webapps/developer/docs/api/)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
"php": ">=5.3.0",
|
"php": ">=5.3.0",
|
||||||
"ext-curl": "*",
|
"ext-curl": "*",
|
||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"paypal/sdk-core-php": "2.4.*"
|
"paypal/sdk-core-php": "2.5.*"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "3.7.*"
|
"phpunit/phpunit": "3.7.*"
|
||||||
@@ -24,5 +24,5 @@
|
|||||||
"psr-0": {
|
"psr-0": {
|
||||||
"PayPal": "lib/"
|
"PayPal": "lib/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
32
phpunit.integration.xml
Normal file
32
phpunit.integration.xml
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<phpunit bootstrap="./tests/bootstrap.php"
|
||||||
|
colors="true"
|
||||||
|
processIsolation="false"
|
||||||
|
stopOnFailure="false"
|
||||||
|
syntaxCheck="false"
|
||||||
|
convertErrorsToExceptions="true"
|
||||||
|
convertNoticesToExceptions="true"
|
||||||
|
convertWarningsToExceptions="true"
|
||||||
|
testSuiteLoaderClass="PHPUnit_Runner_StandardTestSuiteLoader">
|
||||||
|
|
||||||
|
<testsuites>
|
||||||
|
<testsuite name="All">
|
||||||
|
<directory>tests</directory>
|
||||||
|
</testsuite>
|
||||||
|
</testsuites>
|
||||||
|
|
||||||
|
<logging>
|
||||||
|
<log type="junit" target="build/junit.xml" logIncompleteSkipped="false" />
|
||||||
|
<log type="coverage-html" target="build/coverage/" charset="UTF-8"
|
||||||
|
highlight="true" lowUpperBound="35" highLowerBound="70"/>
|
||||||
|
<log type="coverage-clover" target="build/coverage/clover.xml"/>
|
||||||
|
</logging>
|
||||||
|
|
||||||
|
<filter>
|
||||||
|
<whitelist>
|
||||||
|
<directory suffix=".php">./lib</directory>
|
||||||
|
<exclude>
|
||||||
|
</exclude>
|
||||||
|
</whitelist>
|
||||||
|
</filter>
|
||||||
|
</phpunit>
|
||||||
@@ -15,6 +15,12 @@
|
|||||||
</testsuite>
|
</testsuite>
|
||||||
</testsuites>
|
</testsuites>
|
||||||
|
|
||||||
|
<groups>
|
||||||
|
<exclude>
|
||||||
|
<group>integration</group>
|
||||||
|
</exclude>
|
||||||
|
</groups>
|
||||||
|
|
||||||
<logging>
|
<logging>
|
||||||
<log type="junit" target="build/junit.xml" logIncompleteSkipped="false" />
|
<log type="junit" target="build/junit.xml" logIncompleteSkipped="false" />
|
||||||
<log type="coverage-html" target="build/coverage/" charset="UTF-8"
|
<log type="coverage-html" target="build/coverage/" charset="UTF-8"
|
||||||
|
|||||||
@@ -1,6 +1,18 @@
|
|||||||
PayPal PHP SDK release notes
|
PayPal PHP SDK release notes
|
||||||
============================
|
============================
|
||||||
|
|
||||||
|
v0.11.0
|
||||||
|
----
|
||||||
|
* Ability for PUT and PATCH requests
|
||||||
|
* Invoice number, custom and soft descriptor
|
||||||
|
* Order API and tests, more Authorization tests
|
||||||
|
* remove references to sdk-packages
|
||||||
|
* patch for retrieving paid invoices
|
||||||
|
* Shipping address docs patch
|
||||||
|
* Remove @array annotation
|
||||||
|
* Validate return cancel url
|
||||||
|
* type hinting, comment cleaning, and getters and setters for Shipping
|
||||||
|
|
||||||
v0.8.0
|
v0.8.0
|
||||||
-----
|
-----
|
||||||
* Invoicing API support added
|
* Invoicing API support added
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
Rest API Samples
|
Rest API Samples
|
||||||
===================
|
===================
|
||||||
|
|
||||||
|
This sample project is a simple web app that you can explore to understand what the payment APIs can do for you.
|
||||||
|
|
||||||
This sample project is a simple web app that you can explore to understand what the payment APIs can do for you. To try out the sample, run `composer update --no-dev` from the samples folder and you are all set.
|
To try out the sample, run `composer update --no-dev` from the rest-api-sdk-php folder and you are all set.
|
||||||
|
|
||||||
|
|
||||||
The sample comes pre-configured with a test account but in case you need to try them against your account, you must
|
The sample comes pre-configured with a test account but in case you need to try them against your account, you must
|
||||||
|
|
||||||
|
|||||||
@@ -4,12 +4,15 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Include the composer autoloader
|
// Include the composer autoloader
|
||||||
|
// The location of your project's vendor autoloader.
|
||||||
$composerAutoload = dirname(dirname(dirname(__DIR__))) . '/autoload.php';
|
$composerAutoload = dirname(dirname(dirname(__DIR__))) . '/autoload.php';
|
||||||
if (!file_exists($composerAutoload))
|
if (!file_exists($composerAutoload))
|
||||||
{
|
{
|
||||||
$composerAutoload = __DIR__ .'/vendor/autoload.php';
|
//If the project is used as its own project, it would use rest-api-sdk-php composer autoloader.
|
||||||
|
$composerAutoload = dirname(__DIR__) .'/vendor/autoload.php';
|
||||||
|
|
||||||
if(!file_exists(__DIR__ .'/vendor/autoload.php')) {
|
|
||||||
|
if(!file_exists($composerAutoload)) {
|
||||||
echo "The 'vendor' folder is missing. You must run 'composer update' to resolve application dependencies.\nPlease see the README for more information.\n";
|
echo "The 'vendor' folder is missing. You must run 'composer update' to resolve application dependencies.\nPlease see the README for more information.\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "paypal/rest-api-sdk-sample-php",
|
|
||||||
"description": "Samples using PayPal's REST API SDK for PHP",
|
|
||||||
"homepage": "https://github.com/paypal/rest-api-sdk-php",
|
|
||||||
"config": {
|
|
||||||
"require-all": true
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"php": ">=5.3.0",
|
|
||||||
"ext-curl": "*",
|
|
||||||
"ext-json": "*",
|
|
||||||
"paypal/rest-api-sdk-php" : "0.8.*"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -24,12 +24,12 @@ use PayPal\Api\Transaction;
|
|||||||
// used to fund a payment.
|
// used to fund a payment.
|
||||||
$card = new CreditCard();
|
$card = new CreditCard();
|
||||||
$card->setType("visa")
|
$card->setType("visa")
|
||||||
->setNumber("4417119669820331")
|
->setNumber("4417119669820331")
|
||||||
->setExpireMonth("11")
|
->setExpireMonth("11")
|
||||||
->setExpireYear("2019")
|
->setExpireYear("2019")
|
||||||
->setCvv2("012")
|
->setCvv2("012")
|
||||||
->setFirstName("Joe")
|
->setFirstName("Joe")
|
||||||
->setLastName("Shopper");
|
->setLastName("Shopper");
|
||||||
|
|
||||||
// ### FundingInstrument
|
// ### FundingInstrument
|
||||||
// A resource representing a Payer's funding instrument.
|
// A resource representing a Payer's funding instrument.
|
||||||
@@ -44,21 +44,25 @@ $fi->setCreditCard($card);
|
|||||||
// to 'credit_card' and add an array of funding instruments.
|
// to 'credit_card' and add an array of funding instruments.
|
||||||
$payer = new Payer();
|
$payer = new Payer();
|
||||||
$payer->setPaymentMethod("credit_card")
|
$payer->setPaymentMethod("credit_card")
|
||||||
->setFundingInstruments(array($fi));
|
->setFundingInstruments(array($fi));
|
||||||
|
|
||||||
// ### Itemized information
|
// ### Itemized information
|
||||||
// (Optional) Lets you specify item wise
|
// (Optional) Lets you specify item wise
|
||||||
// information
|
// information
|
||||||
$item1 = new Item();
|
$item1 = new Item();
|
||||||
$item1->setName('Ground Coffee 40 oz')
|
$item1->setName('Ground Coffee 40 oz')
|
||||||
->setCurrency('USD')
|
->setDescription('Ground Coffee 40 oz')
|
||||||
->setQuantity(1)
|
->setCurrency('USD')
|
||||||
->setPrice('7.50');
|
->setQuantity(1)
|
||||||
|
->setTax('0.30')
|
||||||
|
->setPrice('7.50');
|
||||||
$item2 = new Item();
|
$item2 = new Item();
|
||||||
$item2->setName('Granola bars')
|
$item2->setName('Granola bars')
|
||||||
->setCurrency('USD')
|
->setDescription('Granola Bars with Peanuts')
|
||||||
->setQuantity(5)
|
->setCurrency('USD')
|
||||||
->setPrice('2.00');
|
->setQuantity(5)
|
||||||
|
->setTax('0.20')
|
||||||
|
->setPrice('2.00');
|
||||||
|
|
||||||
$itemList = new ItemList();
|
$itemList = new ItemList();
|
||||||
$itemList->setItems(array($item1, $item2));
|
$itemList->setItems(array($item1, $item2));
|
||||||
@@ -69,8 +73,8 @@ $itemList->setItems(array($item1, $item2));
|
|||||||
// charges etc.
|
// charges etc.
|
||||||
$details = new Details();
|
$details = new Details();
|
||||||
$details->setShipping('1.20')
|
$details->setShipping('1.20')
|
||||||
->setTax('1.30')
|
->setTax('1.30')
|
||||||
->setSubtotal('17.50');
|
->setSubtotal('17.50');
|
||||||
|
|
||||||
// ### Amount
|
// ### Amount
|
||||||
// Lets you specify a payment amount.
|
// Lets you specify a payment amount.
|
||||||
@@ -78,8 +82,8 @@ $details->setShipping('1.20')
|
|||||||
// such as shipping, tax.
|
// such as shipping, tax.
|
||||||
$amount = new Amount();
|
$amount = new Amount();
|
||||||
$amount->setCurrency("USD")
|
$amount->setCurrency("USD")
|
||||||
->setTotal("20.00")
|
->setTotal("20.00")
|
||||||
->setDetails($details);
|
->setDetails($details);
|
||||||
|
|
||||||
// ### Transaction
|
// ### Transaction
|
||||||
// A transaction defines the contract of a
|
// A transaction defines the contract of a
|
||||||
@@ -87,39 +91,39 @@ $amount->setCurrency("USD")
|
|||||||
// is fulfilling it.
|
// is fulfilling it.
|
||||||
$transaction = new Transaction();
|
$transaction = new Transaction();
|
||||||
$transaction->setAmount($amount)
|
$transaction->setAmount($amount)
|
||||||
->setItemList($itemList)
|
->setItemList($itemList)
|
||||||
->setDescription("Payment description");
|
->setDescription("Payment description");
|
||||||
|
|
||||||
// ### Payment
|
// ### Payment
|
||||||
// A Payment Resource; create one using
|
// A Payment Resource; create one using
|
||||||
// the above types and intent set to sale 'sale'
|
// the above types and intent set to sale 'sale'
|
||||||
$payment = new Payment();
|
$payment = new Payment();
|
||||||
$payment->setIntent("sale")
|
$payment->setIntent("sale")
|
||||||
->setPayer($payer)
|
->setPayer($payer)
|
||||||
->setTransactions(array($transaction));
|
->setTransactions(array($transaction));
|
||||||
|
|
||||||
// ### Create Payment
|
// ### Create Payment
|
||||||
// Create a payment by calling the payment->create() method
|
// Create a payment by calling the payment->create() method
|
||||||
// with a valid ApiContext (See bootstrap.php for more on `ApiContext`)
|
// with a valid ApiContext (See bootstrap.php for more on `ApiContext`)
|
||||||
// The return object contains the state.
|
// The return object contains the state.
|
||||||
try {
|
try {
|
||||||
$payment->create($apiContext);
|
$payment->create($apiContext);
|
||||||
} catch (PayPal\Exception\PPConnectionException $ex) {
|
} catch (PayPal\Exception\PPConnectionException $ex) {
|
||||||
echo "Exception: " . $ex->getMessage() . PHP_EOL;
|
echo "Exception: " . $ex->getMessage() . PHP_EOL;
|
||||||
var_dump($ex->getData());
|
var_dump($ex->getData());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Direct Credit card payments</title>
|
<title>Direct Credit card payments</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div>
|
<div>
|
||||||
Created payment:
|
Created payment:
|
||||||
<?php echo $payment->getId();?>
|
<?php echo $payment->getId();?>
|
||||||
</div>
|
</div>
|
||||||
<pre><?php var_dump($payment->toArray());?></pre>
|
<pre><?php var_dump($payment->toArray());?></pre>
|
||||||
<a href='../index.html'>Back</a>
|
<a href='../index.html'>Back</a>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -42,7 +42,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$this->assertEquals(self::$countryCode, $this->address->getCountryCode());
|
$this->assertEquals(self::$countryCode, $this->address->getCountryCode());
|
||||||
$this->assertEquals(self::$phone, $this->address->getPhone());
|
$this->assertEquals(self::$phone, $this->address->getPhone());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSerializeDeserialize() {
|
public function testSerializeDeserialize() {
|
||||||
$a1 = $this->address;
|
$a1 = $this->address;
|
||||||
|
|
||||||
|
|||||||
@@ -122,6 +122,10 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$a2->fromJson($a1->toJson());
|
$a2->fromJson($a1->toJson());
|
||||||
$this->assertEquals($a1, $a2);
|
$this->assertEquals($a1, $a2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group integration
|
||||||
|
*/
|
||||||
public function testOperations() {
|
public function testOperations() {
|
||||||
try {
|
try {
|
||||||
$authId = self::authorize();
|
$authId = self::authorize();
|
||||||
@@ -150,13 +154,16 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase {
|
|||||||
} catch (\InvalidArgumentException $ex) {
|
} catch (\InvalidArgumentException $ex) {
|
||||||
$this->assertEquals($ex->getMessage(), "Id cannot be null");
|
$this->assertEquals($ex->getMessage(), "Id cannot be null");
|
||||||
}
|
}
|
||||||
} catch (\PayPal\Exception\PPConnectionException $ex) {
|
} catch (PPConnectionException $ex) {
|
||||||
$this->markTestSkipped(
|
$this->markTestSkipped(
|
||||||
'Tests failing because of intermittent failures in Paypal Sandbox environment.' . $ex->getMessage()
|
'Tests failing because of intermittent failures in Paypal Sandbox environment.' . $ex->getMessage()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group integration
|
||||||
|
*/
|
||||||
public function testReauthorize() {
|
public function testReauthorize() {
|
||||||
$authorization = Authorization::get('7GH53639GA425732B');
|
$authorization = Authorization::get('7GH53639GA425732B');
|
||||||
|
|
||||||
|
|||||||
@@ -55,33 +55,42 @@ class CaptureTest extends \PHPUnit_Framework_TestCase {
|
|||||||
|
|
||||||
$this->assertEquals($c1, $c2);
|
$this->assertEquals($c1, $c2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group integration
|
||||||
|
*/
|
||||||
public function testOperations()
|
public function testOperations()
|
||||||
{
|
{
|
||||||
$authId = AuthorizationTest::authorize();
|
try {
|
||||||
$auth = Authorization::get($authId);
|
$authId = AuthorizationTest::authorize();
|
||||||
|
$auth = Authorization::get($authId);
|
||||||
$amount = new Amount();
|
|
||||||
$amount->setCurrency("USD");
|
$amount = new Amount();
|
||||||
$amount->setTotal("1.00");
|
$amount->setCurrency("USD");
|
||||||
|
$amount->setTotal("1.00");
|
||||||
$captr = new Capture();
|
|
||||||
$captr->setId($authId);
|
$captr = new Capture();
|
||||||
$captr->setAmount($amount);
|
$captr->setId($authId);
|
||||||
|
$captr->setAmount($amount);
|
||||||
$capt = $auth->capture($captr);
|
|
||||||
$captureId = $capt->getId();
|
$capt = $auth->capture($captr);
|
||||||
$this->assertNotNull($captureId);
|
$captureId = $capt->getId();
|
||||||
|
$this->assertNotNull($captureId);
|
||||||
$refund = new Refund();
|
|
||||||
$refund->setId($captureId);
|
$refund = new Refund();
|
||||||
$refund->setAmount($amount);
|
$refund->setId($captureId);
|
||||||
|
$refund->setAmount($amount);
|
||||||
$capture = Capture::get($captureId);
|
|
||||||
$this->assertNotNull($capture->getId());
|
$capture = Capture::get($captureId);
|
||||||
|
$this->assertNotNull($capture->getId());
|
||||||
$retund = $capture->refund($refund);
|
|
||||||
$this->assertNotNull($retund->getId());
|
$retund = $capture->refund($refund);
|
||||||
|
$this->assertNotNull($retund->getId());
|
||||||
|
} catch (PPConnectionException $ex) {
|
||||||
|
$this->markTestSkipped(
|
||||||
|
'Tests failing because of intermittent failures in Paypal Sandbox environment.' . $ex->getMessage()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -71,6 +71,9 @@ class CreditCardTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$this->assertEquals($c1, $c2);
|
$this->assertEquals($c1, $c2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group integration
|
||||||
|
*/
|
||||||
public function testOperations() {
|
public function testOperations() {
|
||||||
$c1 = $this->cards['full'];
|
$c1 = $this->cards['full'];
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,9 @@ class PaymentTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$this->assertEquals($p2, $this->payments['full']);
|
$this->assertEquals($p2, $this->payments['full']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group integration
|
||||||
|
*/
|
||||||
public function testOperations() {
|
public function testOperations() {
|
||||||
|
|
||||||
$p1 = $this->payments['new'];
|
$p1 = $this->payments['new'];
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ use PayPal\Test\Constants;
|
|||||||
use PayPal\Test\Api\AmountTest;
|
use PayPal\Test\Api\AmountTest;
|
||||||
use PayPal\Test\Api\PaymentTest;
|
use PayPal\Test\Api\PaymentTest;
|
||||||
use PayPal\Test\Api\LinksTest;
|
use PayPal\Test\Api\LinksTest;
|
||||||
|
use PayPal\Exception\PPConnectionException;
|
||||||
|
|
||||||
class SaleTest extends \PHPUnit_Framework_TestCase {
|
class SaleTest extends \PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
@@ -51,23 +52,32 @@ class SaleTest extends \PHPUnit_Framework_TestCase {
|
|||||||
|
|
||||||
$this->assertEquals($s1, $s2);
|
$this->assertEquals($s1, $s2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group integration
|
||||||
|
*/
|
||||||
public function testOperations() {
|
public function testOperations() {
|
||||||
$payment = PaymentTest::createNewPayment();
|
try {
|
||||||
$payment->create();
|
$payment = PaymentTest::createNewPayment();
|
||||||
|
$payment->create();
|
||||||
$transactions = $payment->getTransactions();
|
|
||||||
$resources = $transactions[0]->getRelatedResources();
|
$transactions = $payment->getTransactions();
|
||||||
$saleId = $resources[0]->getSale()->getId();
|
$resources = $transactions[0]->getRelatedResources();
|
||||||
|
$saleId = $resources[0]->getSale()->getId();
|
||||||
$sale = Sale::get($saleId);
|
|
||||||
$this->assertNotNull($sale);
|
$sale = Sale::get($saleId);
|
||||||
|
$this->assertNotNull($sale);
|
||||||
$refund = new Refund();
|
|
||||||
$refund->setAmount(AmountTest::createAmount());
|
$refund = new Refund();
|
||||||
$sale->refund($refund);
|
$refund->setAmount(AmountTest::createAmount());
|
||||||
|
$sale->refund($refund);
|
||||||
$this->setExpectedException('\InvalidArgumentException');
|
|
||||||
$sale->refund(NULL);
|
$this->setExpectedException('\InvalidArgumentException');
|
||||||
|
$sale->refund(NULL);
|
||||||
|
} catch (PPConnectionException $ex) {
|
||||||
|
$this->markTestSkipped(
|
||||||
|
'Tests failing because of intermittent failures in Paypal Sandbox environment.' . $ex->getMessage()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,13 +23,13 @@ service.EndPoint="https://api.sandbox.paypal.com"
|
|||||||
|
|
||||||
log.LogEnabled=true
|
log.LogEnabled=true
|
||||||
|
|
||||||
# When using a relative path, the log file is created
|
; When using a relative path, the log file is created
|
||||||
# relative to the .php file that is the entry point
|
; relative to the .php file that is the entry point
|
||||||
# for this request. You can also provide an absolute
|
; for this request. You can also provide an absolute
|
||||||
# path here
|
; path here
|
||||||
log.FileName=PayPal.log
|
log.FileName=PayPal.log
|
||||||
|
|
||||||
# Logging level can be one of FINE, INFO, WARN or ERROR
|
; Logging level can be one of FINE, INFO, WARN or ERROR
|
||||||
# Logging is most verbose in the 'FINE' level and
|
; Logging is most verbose in the 'FINE' level and
|
||||||
# decreases as you proceed towards ERROR
|
; decreases as you proceed towards ERROR
|
||||||
log.LogLevel=FINE
|
log.LogLevel=FINE
|
||||||
|
|||||||
Reference in New Issue
Block a user