Omnipay\PayPal\RestGateway::refundCapture PHP Method

refundCapture() public method

To refund captured payments (authorization transaction) created by a authorize request.
public refundCapture ( array $parameters = [] ) : RestRefundCaptureRequest
$parameters array
return Omnipay\PayPal\Message\RestRefundCaptureRequest
    public function refundCapture(array $parameters = array())
    {
        return $this->createRequest('\\Omnipay\\PayPal\\Message\\RestRefundCaptureRequest', $parameters);
    }

Usage Example

Exemplo n.º 1
0
 public function testRefundCapture()
 {
     $request = $this->gateway->refundCapture(array('transactionReference' => 'abc123'));
     $this->assertInstanceOf('\\Omnipay\\PayPal\\Message\\RestRefundCaptureRequest', $request);
     $this->assertSame('abc123', $request->getTransactionReference());
     $endPoint = $request->getEndpoint();
     $this->assertSame('https://api.paypal.com/v1/payments/capture/abc123/refund', $endPoint);
     $request->setAmount('15.99');
     $request->setCurrency('BRL');
     $request->setDescription('Test Description');
     $data = $request->getData();
     // we're expecting an empty object here
     $json = json_encode($data);
     $this->assertEquals('{"amount":{"currency":"BRL","total":"15.99"},"description":"Test Description"}', $json);
 }