* @copyright PayPal * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ namespace PaypalAddons\classes\API\Request; use PaypalAddons\classes\AbstractMethodPaypal; use PayPalCheckoutSdk\Core\PayPalHttpClient; class PaypalOrderPartialRefundRequest extends PaypalOrderRefundRequest { protected $amount; public function __construct(PayPalHttpClient $client, AbstractMethodPaypal $method, \PaypalOrder $paypalOrder, $amount) { parent::__construct($client, $method, $paypalOrder); $this->amount = $this->method->formatPrice($amount, $this->paypalOrder->currency); } /** * @return array */ protected function buildRequestBody() { $body = [ 'amount' => $this->getAmount() ]; return $body; } /** * @return array */ protected function getAmount() { $amount = [ 'currency_code' => $this->paypalOrder->currency, 'value' => $this->amount ]; return $amount; } }