/** @test */ function it_can_be_converted_an_array_for_the_api() { $refund = new Refund(); $refund->setAmount(150)->setTotalAmountConfirmation(300)->setReference('Nude Wines refund')->setPayment(Payment::fromArray(['id' => 'PM123'])); $this->assertEquals(['amount' => 150, 'total_amount_confirmation' => 300, 'reference' => 'Nude Wines refund', 'links' => ['payment' => 'PM123']], $refund->toArray()); }
/** * @see https://developer.gocardless.com/pro/#refunds-create-a-refund * * @param Refund $refund * * @return Refund */ public function createRefund(Refund $refund) { $response = $this->post(self::REFUNDS, $refund->toArray()); return Refund::fromArray($response); }