PHP code example of shadiakiki1986 / fatca-ides-php

1. Go to this page and download the library: Download shadiakiki1986/fatca-ides-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

shadiakiki1986 / fatca-ides-php example snippets



use FatcaIdesPhp\Transmitter;

// set tax year
$taxYear=2014;

// example client data
$di=array(
  array("Compte"=>"1234","ENT_FIRSTNAME"=>"Clyde","ENT_LASTNAME"=>"Barrow","ENT_FATCA_ID"=>"123-1234-123","ENT_ADDRESS"=>"Some street somewhere","ResidenceCountry"=>"US","posCur"=>100000000,"cur"=>"USD","ENT_TYPE"=>"Individual"),
  array("Compte"=>"5678","ENT_FIRSTNAME"=>"Bonnie","ENT_LASTNAME"=>"Parker","ENT_FATCA_ID"=>"456-1234-123","ENT_ADDRESS"=>"Dallas, Texas","ResidenceCountry"=>"US","posCur"=>100,"cur"=>"LBP","ENT_TYPE"=>"Individual")
);

// config with paths to files downloaded
$config = array(
  # SSL certificate bought using the private key
  "FatcaCrt" => "/var/lib/IDES/keys/ssl_certificate.crt",
  # Private key used to get the SSL certificate
  "FatcaKeyPrivate" => "/var/lib/IDES/keys/institution-fatca-private.pem",
  # public key extracted out of private key above
  "FatcaKeyPublic" => "/var/lib/IDES/keys/institution-fatca-public.pem",

  # Fatca Sender GIIN
  "ffaid" => 'A1BBCD.00000.XY.123',
  # Fatca Receiver GIIN, e.g. IRS
  "ffaidReceiver" => '000000.00000.TA.840',

  # email configuration if Transmitter::toEmail is used
  "swiftmailer" => array(
    "host" => "my.host.com",
    "port" => 12345,
    "username" => "myusername",
    "password" => "mypassword",
    "name" => "My Name",
    "reply" => "[email protected]")

);

$factory = new \FatcaIdesPhp\Factory();

$fda = new \FatcaIdesPhp\FatcaDataArray($di);
$fdo = $factory->array2oecd($fda); // , false, null, $taxYear, "zip", "", $config
$tmtr=$factory->transmitter($fdo);
$tmtr->getZip();

$sxe = simplexml_load_file("path/to/xml");
$fdx = new \FatcaIdesPhp\FatcaDataXml($sxe);
$tmtr=$factory->transmitter($fdx);
bash
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '55d6ead61b29c7bdee5cccfb50076874187bd9f21f65d8991d46ec5cc90518f447387fb9f76ebae1fbbacf329e583e30') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
bash
sudo apt-get install php7.0-xml php-mbstring php-zip php-mcrypt php-pear libyaml-dev php-dev php-bcmath
sudo pecl install yaml-2.0.0
sudo echo "extension=yaml.so" > /etc/php/7.0/mods-available/yaml.ini
sudo ln -s /etc/php/7.0/mods-available/yaml.ini /etc/php/7.0/cli/conf.d/20-yaml.ini

composer