-
Notifications
You must be signed in to change notification settings - Fork 38
/
cook-book.php
executable file
·49 lines (33 loc) · 1.39 KB
/
cook-book.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/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);