Exemplo n.º 1
0
 /** @test */
 function it_can_be_created_from_an_api_response()
 {
     $mandate = Mandate::fromArray(['id' => 'MD123', 'created_at' => '2014-05-08T17:01:06.000Z', 'reference' => 'REF-123', 'status' => 'pending_submission', 'scheme' => 'bacs', 'next_possible_charge_date' => '2014-11-10', 'metadata' => ['contract' => 'ABCD1234'], 'links' => ['customer_bank_account' => 'BA123', 'creditor' => 'CR123']]);
     $this->assertEquals('MD123', $mandate->getId());
     $this->assertEquals('2014-05-08T17:01:06.000Z', $mandate->getCreatedAt());
     $this->assertEquals('REF-123', $mandate->getReference());
     $this->assertEquals('pending_submission', $mandate->getStatus());
     $this->assertEquals('bacs', $mandate->getScheme());
     $this->assertEquals('2014-11-10', $mandate->getNextPossibleChargeDate());
 }
Exemplo n.º 2
0
 /** @test */
 function it_can_be_converted_an_array_for_the_api()
 {
     $redirectFlow = (new RedirectFlow(Creditor::fromArray(['id' => 'CR111']), Mandate::fromArray(['id' => 'MD111'])))->useSepaCore();
     $this->assertEquals(['scheme' => 'sepa_core', 'links' => ['creditor' => 'CR111', 'mandate' => 'MD111']], $redirectFlow->toArray());
 }
Exemplo n.º 3
0
 /**
  * @see https://developer.gocardless.com/pro/#mandates-reinstate-a-mandate
  *
  * @param $id
  *
  * @return Mandate
  */
 public function reinstateMandate($id)
 {
     $response = $this->post(self::MANDATES, [], $id . '/actions/reinstate');
     return Mandate::fromArray($response);
 }
Exemplo n.º 4
0
 /** @test */
 function it_can_be_converted_an_array_for_the_api()
 {
     $payment = new Payment();
     $payment->setAmount(300)->setCurrency('GBP')->setChargeDate('2014-05-19')->setDescription('My simple description')->setMandate(Mandate::fromArray(['id' => 'MD123']));
     $this->assertEquals(['amount' => '300', 'currency' => 'GBP', 'charge_date' => '2014-05-19', 'description' => 'My simple description', 'links' => ['mandate' => 'MD123']], $payment->toArray());
 }
Exemplo n.º 5
0
 /** @test */
 function it_populates_using_fromarray()
 {
     $mandate = \GoCardless\Pro\Models\Mandate::fromArray(['metadata' => ['foo' => 'bar']]);
     $this->assertEquals(['foo' => 'bar'], $mandate->getMetadata());
 }