forked from LiveCarta/PayPal-PHP-SDK
@@ -2,9 +2,7 @@
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Api\Refund;
|
||||
use PayPal\Common\PayPalResourceModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Transport\PayPalRestCall;
|
||||
use PayPal\Validation\ArgumentValidator;
|
||||
|
||||
@@ -26,25 +24,11 @@ use PayPal\Validation\ArgumentValidator;
|
||||
* @property string protection_eligibility_type
|
||||
* @property string clearing_time
|
||||
* @property string parent_payment
|
||||
* @property \PayPal\Api\TransactionFee $transactionFee
|
||||
* @property \PayPal\Api\Currency $transaction_fee
|
||||
* @package PayPal\Api
|
||||
*/
|
||||
class Sale extends PayPalResourceModel
|
||||
{
|
||||
public function setTransactionFee(\PayPal\Api\TransactionFee $transactionFee)
|
||||
{
|
||||
$this->transactionFee = $transactionFee;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \PayPal\Api\TransactionFee
|
||||
*/
|
||||
public function getTransactionFee()
|
||||
{
|
||||
return $this->transactionFee;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifier of the authorization transaction.
|
||||
*
|
||||
@@ -285,6 +269,29 @@ class Sale extends PayPalResourceModel
|
||||
return $this->protection_eligibility_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transaction fee applicable for this payment.
|
||||
*
|
||||
* @param Currency $transaction_fee
|
||||
* @return $this
|
||||
*/
|
||||
public function setTransactionFee($transaction_fee)
|
||||
{
|
||||
$this->transaction_fee = $transaction_fee;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transaction fee applicable for this payment.
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
public function getTransactionFee()
|
||||
{
|
||||
return $this->transaction_fee;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Expected clearing time for eCheck Transactions
|
||||
*
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Converter\FormatConverter;
|
||||
use PayPal\Validation\NumericValidator;
|
||||
|
||||
/**
|
||||
* Class TranactionFee
|
||||
*
|
||||
* Let's you specify details of the transaction fee.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string currency
|
||||
* @property string value
|
||||
*/
|
||||
class TransactionFee extends PayPalModel
|
||||
{
|
||||
/**
|
||||
* 3 letter currency code
|
||||
*
|
||||
*
|
||||
* @param string $currency
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCurrency($currency)
|
||||
{
|
||||
$this->currency = $currency;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 3 letter currency code
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCurrency()
|
||||
{
|
||||
return $this->currency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Total amount charged from the Payer account (or card) to Payee. In case of a refund, this is the refunded amount to the original Payer from Payee account.
|
||||
*
|
||||
*
|
||||
* @param string|double $value
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
NumericValidator::validate($value, "value");
|
||||
$value = FormatConverter::formatToPrice($value, $this->getCurrency());
|
||||
$this->value = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Value amount charged from the Payer account (or card) to Payee. In case of a refund, this is the refunded amount to the original Payer from Payee account.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Api\Currency;
|
||||
use PayPal\Api\Sale;
|
||||
use PayPal\Test\Api\AmountTest;
|
||||
|
||||
@@ -27,7 +28,7 @@ class SaleTest extends \PHPUnit_Framework_TestCase
|
||||
$sale->setParentPayment(self::$parentPayment);
|
||||
$sale->setState(self::$state);
|
||||
|
||||
$this->tFee = new \PayPal\Api\TransactionFee();
|
||||
$this->tFee = new Currency();
|
||||
$this->tFee->setCurrency('AUD');
|
||||
$this->tFee->setValue('0.10');
|
||||
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Api\TransactionFee;
|
||||
|
||||
class TransactionFeeTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testGetterSetter()
|
||||
{
|
||||
$tfee = new TransactionFee();
|
||||
$tfee->setCurrency('AUD');
|
||||
$this->assertEquals('AUD', $tfee->getCurrency());
|
||||
|
||||
$tfee->setValue('0.10');
|
||||
$this->assertEquals('0.10', $tfee->getValue());
|
||||
}
|
||||
}
|
||||
@@ -2,14 +2,12 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Api\SubTransaction;
|
||||
|
||||
use PayPal\Api\Transaction;
|
||||
use PayPal\Test\Constants;
|
||||
|
||||
class TransactionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/** @var Transaction */
|
||||
private $transaction;
|
||||
|
||||
public static $description = "desc . . . ";
|
||||
|
||||
Reference in New Issue
Block a user