Ejemplo n.º 1
0
 /** @test */
 function it_can_disable_a_bank_account()
 {
     $customer = $this->api->createCustomer($this->get_basic_customer());
     $account = $this->get_customer_bank_account($customer);
     $account = $this->api->createCustomerBankAccount($account);
     $account = $this->api->disableCustomerBankAccount($account->getId());
     $this->assertFalse($account->isEnabled());
     $this->assertTrue($account->isDisabled());
 }
Ejemplo n.º 2
0
require __DIR__ . '/vendor/autoload.php';
use GuzzleHttp\Client;
use GoCardless\Pro\Api;
use GoCardless\Pro\Models\Customer;
use GoCardless\Pro\Models\CustomerBankAccount;
use GoCardless\Pro\Models\Creditor;
use GoCardless\Pro\Models\Mandate;
use GoCardless\Pro\Models\Payment;
/**
 * When you sign up for GoCardless pro you will be given an API key by default.
 * Navigate to the organisation area and scroll to the API section. Grab those keys!
 *
 * @link https://manage-sandbox.gocardless.com/organisation
 * @link https://developer.gocardless.com/pro/#overview-backwards-compatibility
 */
$api = new Api(new Client(), 'ACCESS_TOKEN', '2015-04-29');
/** On with the show */
$customer = (new Customer())->setFullName('David', 'Cameron')->setAddress('10 Downing Street', 'London', 'SW1A 2AA', 'GB');
$customer = $api->createCustomer($customer);
$account = (new CustomerBankAccount())->withAccountDetails('Mr D Cameron', '55997711', '200000', 'GB', $customer);
$account = $api->createCustomerBankAccount($account);
// You also get a creditor ID automatically when you sign up.
$mandate = new Mandate($account, Creditor::withId('CR123'));
$mandate = $api->createMandate($mandate);
/**
 * Now lets take some money!
 */
$payment = (new Payment())->collect(5000, 'GBP')->on('2015-02-16')->using($mandate);
$payment = $api->createPayment($payment);
$payment->isPendingSubmission();
// true