/**
  * @vcr Actions/can_create.yaml
  * @test
  */
 public function canCreate()
 {
     $beneficiary = Beneficiary::create('Test User', 'GB', 'GBP', 'Test User')->setAccountNumber('12345678')->setRoutingCodeType1('sort_code')->setRoutingCodeValue1('123456')->setPaymentTypes(['regular']);
     $beneficiary = $this->getAuthenticatedClient()->beneficiaries()->create($beneficiary);
     $dummy = json_decode('{"id":"081596c9-02de-483e-9f2a-4cf55dcdf98c","bank_account_holder_name":"Test User","name":"Test User","email":null,"payment_types":["regular"],"beneficiary_address":[],"beneficiary_country":null,"beneficiary_entity_type":null,"beneficiary_company_name":null,"beneficiary_first_name":null,"beneficiary_last_name":null,"beneficiary_city":null,"beneficiary_postcode":null,"beneficiary_state_or_province":null,"beneficiary_date_of_birth":null,"beneficiary_identification_type":null,"beneficiary_identification_value":null,"bank_country":"GB","bank_name":"HSBC BANK PLC","bank_account_type":null,"currency":"GBP","account_number":"12345678","routing_code_type_1":"sort_code","routing_code_value_1":"123456","routing_code_type_2":null,"routing_code_value_2":null,"bic_swift":null,"iban":null,"default_beneficiary":"false","creator_contact_id":"c4d838e8-1625-44c6-a9fb-39bcb1fe353d","bank_address":["5 Wimbledon Hill Rd","Wimbledon","London"],"created_at":"2015-04-25T09:21:00+00:00","updated_at":"2015-04-25T09:21:00+00:00"}', true);
     $this->validateObjectStrictName($beneficiary, $dummy);
 }
#!/usr/bin/env php
<?php 
use CurrencyCloud\CurrencyCloud;
use CurrencyCloud\Model\Beneficiary;
use CurrencyCloud\Model\Conversion;
use CurrencyCloud\Model\Payment;
use CurrencyCloud\Session;
require_once __DIR__ . '/../vendor/autoload.php';
$session = new Session(Session::ENVIRONMENT_DEMONSTRATION, '<user-id>', '<api-key>');
$currencyCloud = CurrencyCloud::createDefault($session);
//Note that there is no direct call to authenticate api
$detailedRate = $currencyCloud->rates()->detailed('EUR', 'GBP', 'buy', '10000.00');
var_dump($detailedRate);
$conversion = Conversion::create('EUR', 'GBP', 'buy');
$conversion = $currencyCloud->conversions()->create($conversion, '10000.00', 'Invoice Payment', true);
var_dump($conversion);
$beneficiaryRequiredDetails = $currencyCloud->reference()->beneficiaryRequiredDetails('EUR', 'DE');
var_dump($beneficiaryRequiredDetails);
$beneficiary = Beneficiary::create('Acme GmbH', 'DE', 'EUR', 'John Doe')->setBeneficiaryCountry('DE')->setBicSwift('COBADEFF')->setIban('DE89370400440532013000');
$beneficiary = $currencyCloud->beneficiaries()->create($beneficiary);
var_dump($beneficiary);
$payment = Payment::create('EUR', $beneficiary->getId(), '10000', 'Invoice Payment', 'Invoice 1234')->setPaymentType('regular')->setConversionId($conversion->getId());
$payment = $currencyCloud->payments()->create($payment);
var_dump($payment);