function test_it_can_create_a_refund() { $this->guardAgainstInvalidPaymentToRefund(); $config = (require __DIR__ . '/../config.php'); $payment = $this->api->getPayment($config['paymentToRefund']); $refund = (new Refund())->of($payment)->returning($payment->getAmount())->totalling($payment->getAmount()); $refund = $this->api->createRefund($refund); $this->assertInstanceOf('GoCardless\\Pro\\Models\\Refund', $refund); $this->assertNotNull($refund->getId()); $this->assertNotNull($refund->getCreatedAt()); $this->assertSame($payment->getAmount(), $refund->getAmount()); $this->assertSame('GBP', $refund->getCurrency()); }