currency_cloud 1.0.1 copy "currency_cloud: ^1.0.1" to clipboard
currency_cloud: ^1.0.1 copied to clipboard

outdated

A dart library for the Currency Cloud service. It operates as a wrapper for the Currency Cloud REST API.

example/example.dart

import 'package:currency_cloud/currency_cloud.dart';
import 'package:decimal/decimal.dart';

main() async {
  final cc = new CurrencyCloud('loginId', 'apiKey');

  // 1. Authenticate
  await cc.authApi.authenticate();

  // 2. Get a Quote
  final buyCurrency = 'EUR';
  final sellCurrency = 'GBP';
  final fixedSide = FixedSide.buy;
  final amount = new Decimal.parse('1000.00');

  final rate = await cc.ratesApi.detailed(DetailedRateRequest(
    buyCurrency: buyCurrency,
    sellCurrency: sellCurrency,
    fixedSide: fixedSide,
    amount: amount,
  ));
  print(rate);

  // 3. Convert
  final createConversion = new CreateConversion(
    buyCurrency: buyCurrency,
    sellCurrency: sellCurrency,
    fixedSide: fixedSide,
    amount: amount,
    termAgreement: true,
    reason: 'Invoice Payment',
  );

  final conversion = await cc.conversionApi.create(createConversion);
  print(conversion);

  // 4. Add a Beneficiary
  final createBeneficiary = new CreateBeneficiary(
    name: 'My Test Beneficiary',
    bankAccountHolderName: 'My Test Account Holder',
    bankCountry: 'DE',
    currency: buyCurrency,
    iban: 'DE89370400440532013000',
    bicSwift: 'COBADEFF',
  );

  final beneficiary = await cc.beneficiariesApi.create(createBeneficiary);
  print(beneficiary);

  // 5. Pay
  final createPayment = new CreatePayment(
    currency: buyCurrency,
    beneficiaryId: '9b40b6e7-5d18-42ac-87bc-5c5f774e91ab',
    amount: amount,
    reason: 'This is a test payment.',
    reference: 'This is a test reference.',
  );

  final payment = await cc.paymentsApi.create(createPayment);
  print(payment);
}
1
likes
0
pub points
0%
popularity

Publisher

unverified uploader

A dart library for the Currency Cloud service. It operates as a wrapper for the Currency Cloud REST API.

Repository (GitLab)
View/report issues

License

unknown (license)

Dependencies

decimal, http, json_annotation, logging, meta

More

Packages that depend on currency_cloud