<?php
namespace App\Service;
use App\Entity\District;
use App\Entity\Ekyc;
use Doctrine\ORM\EntityManagerInterface;
class AccountService
{
/**
* @var EntityManagerInterface
*/
private EntityManagerInterface $entityManager;
public function __construct(EntityManagerInterface $entityManager)
{
$this->entityManager = $entityManager;
}
public function getRepository()
{
return $this->entityManager->getRepository(District::class);
}
public function create(Ekyc $ekyc): array
{
// @TODO : Move to .env
//$url = "http://103.17.69.149:8080/omnitest/omni/ekyc/kycinfo";
$url = "http://omniaccount.bankasia-bd.com/omni/apiomni/omni2ekyc/ekyc";
$applicationId = 'DVNT'.mt_rand(1000000, 9999999);
$xmlRequestData = $this->prepareRequestXml($ekyc, $applicationId);
if ($xmlRequestData['error']) {
return [
'cbs_response' => array(),
'account_no' => '',
'response_code' => '01',
'response_message' => $xmlRequestData['msg']
];
}
$xml = $xmlRequestData['data'];
$headers = array(
"Content-type: text/xml",
"Content-length: " . strlen($xml),
"In_UserId: OEKYC01",
"In_AuthKey: 123456",
"In_Chksum: 123456",
"in_reqid: 2343231",
"in_reqtype: BA_OMNI_EKYC01",
"out_xmldata: YES",
"in_xmldata: $xml",
"Connection: close",
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 1000);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$data = curl_exec($ch);
if (curl_errno($ch)) {
throw new \RuntimeException(curl_error($ch));
} else {
curl_close($ch);
$responseArray = json_decode($data, true);
$dataXML = simplexml_load_string($responseArray['out_xmldata']);
$accountNo = $dataXML->xpath('/NEWACOPNREQUEST/CUSTOMERINFO/ACTNUM')[0]->__toString();
$responseCode = $dataXML->xpath('/NEWACOPNREQUEST/STATUSCODE')[0]->__toString();
$responseMessage = $dataXML->xpath('/NEWACOPNREQUEST/MESSAGE')[0]->__toString();
$cuscod = $dataXML->xpath('/NEWACOPNREQUEST/CUSTOMERINFO/CUSCOD')[0]->__toString();
return [
'cbs_response' => $data,
'account_no' => (string)$accountNo.'_'.$cuscod,
'response_code' => $responseCode,
'response_message' => ($responseCode == '00') ? $responseMessage : 'Ref: '.$applicationId.'. '.$responseMessage
];
}
}
// Mapping Functions
private function mapGender($value)
{
$gender = [
'male' => 'M',
'female' => 'F',
'other' => 'O'
];
return (isset($gender[strtolower($value)])) ? $gender[strtolower($value)] : 'O';
}
private function mapManageType($value)
{
$manageType = [
'individual' => 'I',
'joint' => 'J',
'company' => 'C'
];
return (isset($manageType[strtolower($value)])) ? $manageType[strtolower($value)] : 'I';
}
// @TODO : Move the mapping to dedicated Type class
private function mapOperationType($value)
{
$operationType = [
'any three' => 'AN3',
'any two jointly or survivors or survivor' => 'AN2',
'either or survivor' => 'EOS',
'joint a/c' => 'JNT',
'single a/c' => 'SIN'
];
return (isset($operationType[strtolower($value)])) ? $operationType[strtolower($value)] : 'SIN';
}
// @TODO : Move the mapping to dedicated Type class
private function mapNationality($value)
{
$nationality = [
'american' => 'AMR',
'anguilla' => 'AGU',
'australian' => 'AUS',
'argentina' => 'ARG',
'austria' => 'AST',
'bangladeshi' => 'BNG',
'belgiumese' => 'BEL',
'brazilian' => 'BRA',
'bahamian' => 'BAH',
'bhutanist' => 'BHT',
'canadian' => 'CAD',
'caribbeans' => 'CAR',
'chinese' => 'CHI',
'croatia' => 'CRO',
'czech republic' => 'CZH',
'denmark' => 'DEN',
'dutch' => 'HOL',
'english' => 'ENG',
'ethiopian' => 'ETH',
'egyptian' => 'EGY',
'french' => 'FRN',
'finland' => 'FIN',
'german' => 'GER',
'guatemala' => 'GUT',
'hongkong' => 'HON',
'hungarian' => 'HUN',
'indian' => 'IND',
'indonesian' => 'INA',
'irani' => 'IRN',
'iraqi' => 'IRQ',
'irish' => 'IRS',
'israel' => 'ISR',
'italian' => 'ITL',
'ireland' => 'IRE',
'jamaika' => 'JMK',
'japanese' => 'JAP',
'jordan' => 'JOR',
'kenya' => 'KEN',
'korean' => 'KRN',
'kuwaiti' => 'KUT',
'lebanese' => 'LEB',
'liberian' => 'LBN',
'lithuania' => 'LIT',
'luxembourg' => 'LOU',
'malayasin' => 'MAL',
'maldives' => 'MLD',
'mauritius' => 'MTS',
'nepalese' => 'NEP',
'nigerian' => 'NGR',
'norwegian' => 'NRG',
'netherlands' => 'NAD',
'newzealand' => 'NEW',
'omani' => 'OMN',
'pakisthani' => 'PAK',
'philipines' => 'PHI',
'romanian' => 'ROM',
'russia' => 'RUS',
'saint kittes and nevis' => 'STK',
'saint martin (french part)' => 'SKN',
'saudi' => 'SAU',
'singaporean' => 'SIN',
'somalian' => 'SOM',
'south african' => 'SAF',
'spain' => 'SPN',
'srilanka' => 'SRI',
'sudani' => 'SDN',
'swedish' => 'SDE',
'swiss' => 'SWS',
'taiwanese' => 'TAI',
'thai' => 'THI',
'turkey' => 'TRK',
'tunisia' => 'TUN',
'united arab emirates national' => 'UAE',
'united kingdom' => 'UKG',
'uruguay' => 'URG',
'vietnam' => 'VAT',
'west indies n.i.e.' => 'WIN'
];
return (isset($nationality[strtolower($value)])) ? $nationality[strtolower($value)] : 'BNG';
}
// @TODO : Move the mapping to dedicated Type class
private function mapReligious($value)
{
$religious = [
'islam' => 'MUS',
'hindu' => 'HIN',
'buddhishm' => 'BUD',
'christian' => 'CHR'
];
return (isset($religious[strtolower($value)])) ? $religious[strtolower($value)] : 'MUS';
}
// @TODO : Update Occupation type to hold the short version as well
private function mapOccupation($value)
{
$occupation = [
'ADVOCATE/LAWYEAR' => 'ADV',
//'AGENT(BANK)' => 'AGB',
'ARCHITECT' => 'ARC',
'ATTORNEY' => 'ATY',
'BANKER' => 'BAN',
'BUSINESS(ADVERTISING)' => 'BAD',
'BUSINESS(AGENCY)' => 'AGN',
'BUSINESS(CARDEALER,REPAIR,FINANCE)' => 'CDL',
'BUSINESS(CLEARINGANDFORWARDING)' => 'CLF',
'BUSINESS(COMMISSIONAGENT)' => 'CAG',
'BUSINESS(COURIERSERVICE)' => 'COS',
'BUSINESS(DEALERSHIP)' => 'DLS',
'BUSINESS(ENGINEERINGWORKSHOP)' => 'BEW',
'BUSINESS(EXPORTANDIMPORT)' => 'EXI',
'BUSINESS(EXPORTSECTOR)' => 'EXS',
'BUSINESS(GARMENTS/BUYINGHOUSE)' => 'GAR',
'BUSINESS(HOTEL/RESTAURANT/BAR)' => 'HRB',
'BUSINESS(IMPORTSECTOR)' => 'IMS',
'BUSINESS(INDENTING)' => 'IDN',
'BUSINESS(ITSECTOR)' => 'ITS',
'BUSINESS(JEWELRY/GEMS/ART/ANTIQUE)' => 'JGA',
'BUSINESS(MANUFACTURING)' => 'MAN',
'BUSINESS(MEDICALCOLLEGE&HOSPITAL)' => 'MCH',
'BUSINESS(MONEYCHANGER)' => 'MCN',
'BUSINESS(MUSIC)' => 'MUS',
'BUSINESS(OTHERLOCALBUSINESS)' => 'OLB',
'BUSINESS(PETROLPUMP/CNGSTATION)' => 'CNG',
'BUSINESS(PHARMACEUTICALS)' => 'PMT',
'BUSINESS(REALESTATE/CONSTRUCTION)' => 'REC',
'BUSINESS(RETAIL)' => 'TRE',
'BUSINESS(SHIPPINGAGENT)' => 'BSA',
'BUSINESS(STOCKBROKER/DELAER)' => 'SBD',
'BUSINESS(SUPPLY)' => 'SUP',
'BUSINESS(TOURGUIDE)' => 'TGU',
'BUSINESS(TRADING)' => 'TTR',
'BUSINESS(TRADING,RETAIL)' => 'TRR',
'BUSINESS(TRANSPORTATION)' => 'TRP',
'BUSINESS(TRAVELAGENCY/AIRTICKETING)' => 'TAG',
'BUSINESS(WHOLESALE)' => 'BWS',
'BUSINESSPROFESSIONAL' => 'BSN',
'CHAIRMAN(COOPERATIVESOCIETY)' => 'CCS',
'CHAIRMANPRIVATELTD.COMPANY' => 'CHR',
'CHARTEREDACCOUNTANT' => 'CAC',
'CHIEFEXECUTIVEOFFICERS' => 'CEO',
'COMPUTERPROGRAMMER' => 'PRG',
'CONSULTANT' => 'CON',
'CONTRACTOR' => 'CTT',
'DEFENSESERVICE(COMMISSIONEDOFFICER)' => 'DSC',
'DEFENSESERVICE(NON-COMMISSIONED)' => 'DSN',
'DIRECTORPRIVATELIMITEDCOMPANY' => 'DPR',
'DIRECTORPUBLICLIMITEDCOMPANY' => 'DPL',
'DISTRIBUTOR' => 'DST',
'DOCTOR' => 'DOC',
'DRIVER' => 'DRV',
'ENGINEER' => 'ENG',
'FARMER' => 'FER',
'GOVERNMENTEMPLOYMENT' => 'GEM',
'GOVERNMENTSERVICE-NON-OFFICER' => 'GNO',
'GOVERNMENTSERVICE-OFFICER' => 'GSO',
'HOUSEWIFE' => 'HOW',
'INSURACEAGENT' => 'INA',
'JOURNALIST' => 'JNL',
'JUDICIARY' => 'JDR',
'LANDLORD' => 'LLD',
'MANAGER' => 'MGR',
'MANAGINGDIRECTORPRIVATELTD.COMPANY' => 'MNG',
'MEMBEROFPARLIAMENT' => 'MOP',
'OTHERS' => 'OTH',
'PILOT/FLIGHTATTENDANT' => 'FLA',
'PLAYER' => 'PLY',
'POLICE,CUSTOMS,TAX' => 'PCT',
'PRIVATEEMPLOYMENT' => 'PEM',
'PRIVATESERVICE(MANAGERIAL)' => 'PSM',
'PRIVATESERVICE(NON-MANAGERIAL)' => 'PSN',
'PROFESSOR' => 'PRF',
'RETIREDPERSON' => 'RTD',
'SECRETARY' => 'SEC',
'SELFEMPLOYEDPROFESSIONAL' => 'LWY',
'SERVICE(ABROAD)' => 'SEA',
'SERVICE(AIRLINES)' => 'SAR',
'SERVICE(CAPITAL MARKET)' => 'SCM',
'SERVICE(GARMENTS/TEXTILES)' => 'SGT',
'SERVICE(ITSECTOR)' => 'SIT',
'SERVICE(NGO)' => 'SNG',
'SERVICE(OTHERS)' => 'SOT',
'SERVICE(PHARMACEUTICALS)' => 'SPH',
'SERVICE-StateOwnedEnt.(Managerial)' => 'SOE',
'SERVICE-StateOwnedEnt.(Non-Managerial)' => 'SEN',
'STUDENT' => 'STD',
'TEACHER' => 'TCH',
'TRUST' => 'TRU',
];
return (isset($occupation[$value])) ? $occupation[$value] : 'HOW';
}
private function mapMaritalStatus($value)
{
$maritalStatus = [
'married' => 'MAR',
'widower' => 'WID',
'single' => 'SNG',
'unmarried' => 'SNG',
'divorcee' => 'DVR',
'un specified' => 'UNS'
];
return (isset($maritalStatus[strtolower($value)])) ? $maritalStatus[strtolower($value)] : 'MAR';
}
// @TODO : Move the mapping to dedicated Type class
private function mapRelation($value)
{
$relation = [
'aunt' => 'AUN',
'husband' => 'HUS',
'wife' => 'WFE',
'brother' => 'BRO',
'brother in law' => 'BIL',
'sister' => 'SIS',
'daughter' => 'DTR',
'father' => 'FAT',
'father in law' => 'FIL',
'friend' => 'FRI',
'grand father' => 'GFA',
'grand mother' => 'GMO',
'lover' => 'LOV',
'mother' => 'MOT',
'mother in law' => 'MIL',
'nephew' => 'NEP',
'niece' => 'NIE',
'sister in law' => 'SIL',
'son' => 'SON',
'uncle' => 'UCL'
];
return (isset($relation[strtolower($value)])) ? $relation[strtolower($value)] : 'HUS';
}
// @TODO : Move the mapping to dedicated Type class
private function mapSectorCode($value)
{
$sectorCode = [
'Bangladesh Haor And Wetland Development' => 484,
'Executive Cell, BEPZA' => 485,
'Gram Parishad' => 489,
'Rice mills including puffed rice, chirr' => 508,
'Salt Processing Industries' => 516,
'Office of the Divisional Commissioner' => 567,
'West Zone Power Distribution Company Ltd' => 568,
'Food Ministry( Including food divisions/' => 569,
'Other Local Individuals not above menti' => 570,
'Processing of bread and biscuits, vermic' => 571,
'Processed fruit products (jam, jelly, ju' => 572,
'Fruits processing including vegetables' => 573,
'Manufacturing of flour, sujee (Flour Mil' => 574,
'Processing of mushroom and spirulina' => 575,
'Starch, glucose and other dextrose p' => 576,
'Processing of potato products (chips' => 577,
'processing of powder spice' => 578,
'Manufacturing of Unani and Ayurvedic' => 579,
'Fish feed and fish meal processing f' => 580,
'Seed processing and preservation' => 581,
'Pulse Mills' => 582,
'Processing of rubber tape, shellac' => 583,
'Production of bamboo and cane furnit' => 584,
'Meat processing' => 585,
'Production of bio slurry, mixed manu' => 586,
'Production of bio-pesticides, neem p' => 587,
'Sweetening products.' => 588,
'Soya food production & processing.' => 589,
'Mustard oil producing industry (if l' => 590,
'Other Agro based Industries.' => 591,
'Accident Research Institute (ARI), Bangl' => 592,
'Advertising Industry and modeling (print' => 593,
'Agrani SME Financing Company Limited' => 594,
'Agriculture Information Service' => 595,
'Ashuganj Power Station Company Ltd (APSC' => 597,
'Audit and Accounting Firm/CA Firm/ Credi' => 598,
'Auto mobile service including CNG conver' => 599,
'Bangabandhu Sheikh Mujibur Rahman Novo T' => 600,
'Bangabandhu Sheikh Mujibur Rahman Scienc' => 601,
'Bangladesh Hi-Tech Park Authority' => 602,
'Bangladesh Accreditation Board' => 603,
'Bangladesh Air Force' => 604,
'Bangladesh Ansar and VDP' => 605,
'Bangladesh Army' => 606,
'Bangladesh Cable Shilpa Limited' => 607,
'Bangladesh Coast Guard' => 608,
'Bangladesh Computer Council (BCC)' => 609,
'Bangladesh Co-operative Academy' => 610,
'Bangladesh Education Engineering Departm' => 611,
'Bangladesh Energy Regulatory Commission' => 612,
'Bangladesh Foreign Trade Institute (BFTI' => 613,
'Bangladesh Forest Department' => 614,
'Bangladesh Forest Research Institute' => 615,
'Bangladesh Form and Publications Office' => 616,
'Bangladesh Health Professionals Institut' => 617,
'Bangladesh Infrastructure Finance Fund L' => 618,
'Bangladesh Institute of Bank Management' => 619,
'Bangladesh Institute of International an' => 620,
'Bangladesh Institute of International an ' => 621,
'Bangladesh Institute of Textile Technolo' => 622,
'Bangladesh Judicial Service Commission' => 623,
'Bangladesh Krira Shikkha Protisthan (BKS' => 624,
'Bangladesh Machine Tools Factory Limited' => 625,
'Bangladesh Missions in Abroad' => 626,
'Bangladesh National Commission of UNESCO' => 627,
'Bangladesh National Herbarium' => 628,
'Bangladesh National Medical Council' => 629,
'Bangladesh National Parliament (Jatio Sa' => 630,
'Bangladesh Navy' => 631,
'Bangladesh NGO Foundation' => 632,
'Bangladesh Ordniance Factories' => 633,
'Bangladesh Petroleum Institute' => 634,
'Bangladesh Police' => 635,
'Bangladesh Post Office (except Savings B' => 636,
'Bangladesh Post Office Savings Bank Sche' => 637,
'Bangladesh Public Service Commission' => 638,
'Bangladesh Road Transport Authority (BRT' => 639,
'Bangladesh Samabaya Bank Ltd' => 640,
'Bangladesh Secretariat' => 641,
'Bangladesh Seri cultural Research and Tr' => 642,
'Bangladesh Silk Research and Training In' => 643,
'Bangladesh Small & Cottage Industries Co' => 644,
'Bangladesh Sthala Bandar Katripaksha' => 645,
'Bangladesh Submarine Cable Company Limit' => 646,
'Bangladesh Supreme Court (Including High' => 647,
'Bangladesh Tariff Commission' => 648,
'Bangladesh Tea Research Institute (BTRI)' => 649,
'Bangladesh Telecommunication Regulatory' => 650,
'Bangladesh Textile University' => 651,
'Bangladesh University of Professional' => 652,
'Barisal University' => 653,
'Battery Manufacturing Industries' => 654,
'Begum Rokeya University' => 655,
'Beverage and Soft Drinks manufacturing C' => 656,
'Board of Investment Bangladesh' => 657,
'Border Guard Bangladesh' => 658,
'Brokerage Houses/ (Share & Security Trad' => 659,
'Bureau of Manpower, Employment and Train' => 660,
'Bureau of Non-formal Education' => 661,
'Businessmen/Industrialist' => 662,
'Caterers /Decorators/Sound & Lighting re' => 664,
'Central Development Resources Developmen' => 665,
'Chain Super Market/Shopping Mall' => 666,
'Chittagong Veterinary and Animal Science' => 667,
'Christian Welfare Trust' => 668,
'Cinema Hall/Cineplex' => 669,
'Cinema Studio' => 670,
'Comilla University' => 671,
'Community Centres/ Convention centres/Au' => 672,
'Comprehensive Disaster Management Progra' => 673,
'Consultancy & Supervisory Farms' => 674,
'Contractor and Supplier farms' => 675,
'Copyright Office' => 676,
'Cotton Development Board' => 677,
"Cox's Bazar Cultural Centre" => 678,
'Department of Agricultural Marketing' => 679,
'Department of Architecture' => 680,
'Department of Disaster Management' => 681,
'Department of Environment' => 682,
'Department of Explosive' => 683,
'Department of Film and Publications' => 684,
'Department of Fire Service and Civil Def' => 685,
'Department of Fisheries' => 686,
'Department of Immigration and Passports' => 687,
'Department of Livestock Services' => 688,
'Department of Mass Communication' => 689,
'Department of Narcotics Control' => 690,
'Department of Patents, Designs and Trade' => 691,
'Department of Prisons' => 692,
'Department of Shipping' => 693,
'Department of Youth Development' => 694,
'Dhaka Power Distribution Company Ltd (DP' => 695,
'Directorate General of Defence Purchase' => 696,
'Directorate General of Drug Administrati' => 697,
'Directorate General of Family Planning' => 698,
'Directorate General of Forces Intelligen' => 699,
'Directorate of Archives and Libraries' => 700,
'Directorate of Bangladesh Survey' => 701,
'Directorate of Govt. Accommodation' => 702,
'Directorate of Inspection and Audit of M' => 703,
'Directorate of Meteorology' => 704,
'Directorate of National Consumer Rights' => 705,
'Directorate of Nursing Services' => 706,
'Directorate of Technical Education' => 707,
'Disaster Management Bureau' => 708,
'Distilleries, Mineral & Drinking Water p' => 709,
'District Judge Court (Including Other Co' => 710,
'Election Commission Bangladesh' => 711,
'Electricity Generation Company of Bangla' => 712,
'Electronic Goods Manufacturing/ Assembli' => 713,
'Equity Entrepreneurship Fund' => 717,
'Essential Drugs Company Limited' => 718,
'Farmer/Fishermen' => 719,
'Filling Stations (Petrol pump, CNG Stati' => 720,
'Freight Forwarders' => 721,
'Garments Accessories manufacturing indus' => 722,
'Graphic Designers' => 723,
'Grihayan Tahobill' => 724,
'Health Engineering Department' => 725,
'Horticulture Export Development Foundati' => 726,
'Housewife' => 727,
'Housing & Building Research Institute' => 728,
'Hydrocarbon Unit, Bangladesh' => 729,
'Ice Factory' => 730,
'Indenting firms' => 731,
'Institute of Water Modeling' => 732,
'Insurance Development and Regularity Aut' => 733,
'Interior Design & Decorators and other e' => 734,
'International Mother Language Institute' => 735,
'Issue manager, Under-writer, Asset Manag' => 736,
'Jagannath University' => 737,
'Jatiya Kabi Kazi Nazrul Islam University' => 738,
'Jatiya Mohila Sangstha' => 739,
'Jessore Science & Technology University' => 740,
'Joint River Commission' => 741,
'Judicial Administration Training Institu' => 742,
'Jewelry Services' => 743,
'Khudro Nri Gosthi Cultural Academy, Biri' => 744,
'Khudro Nri Gosthi Cultural Institute, Ra' => 745,
'Khulna Shipyard Limited' => 746,
'Land Administration Training Centre (LAT' => 747,
'Land Appeal Board' => 748,
'Land Lord' => 749,
'Land Reform Board' => 750,
'Laundry Services' => 751,
'Leather Processing and Tanning (raw hide' => 752,
'Legal advisory Firms' => 753,
'Light Engineering and Metal-workshop' => 754,
'Madrasha Teachers Training Institute (MT' => 755,
'Manufacturing of agro-equipments' => 756,
'Manufacturing of Electrical equipments &' => 757,
'Manufacturing of Transport Equipments' => 758,
'Mawlana Bhashani Science & Technology Un' => 759,
'Merchant Banks' => 760,
'Micro Credit Regulatory Authority (MRA)' => 761,
'Minor/Autistics/Disabled and other depe' => 762,
'Modernised Cleaning Service for High-ris' => 763,
'Mutual Funds' => 764,
'National Academy for Computer Training a' => 765,
'National Academy for Educational Managem' => 766,
'National Academy of Primary Education (N' => 767,
'National Foundation for Development of t' => 768,
'National Foundation for Research on Huma' => 769,
'National Freedom Fighter Council' => 770,
'National Human Rights Commission' => 771,
'National Institute of Biotechnology' => 772,
'National Institute of Mass Communication' => 773,
'National Legal Aid Institute' => 774,
'National Maritime Institute' => 775,
'NGO Affairs Bureau' => 776,
'Non-Government Teachers Registration and' => 777,
'North West Power Generation Company Ltd' => 778,
'Office of the Assistant Commissioner of' => 779,
'Office of the Chief Inspector of Boilers' => 780,
'Office of the Thana Executive Officer' => 781,
'Old/Widowed/Distressed person' => 782,
'Online News Media' => 783,
'Other Ministries, Directorates and Depar' => 786,
'Others' => 788,
'Outsourcing and Security Service' => 790,
'Pabna University of Science and Technolo' => 791,
'Packaging Industries including paper boa' => 792,
'Palli Karma-Sahayak Foundation (PKSF)' => 793,
'Pally Bidyut Samities' => 794,
'Patuakhali Science and Technology Univer' => 795,
'Polymer and polythene industries' => 797,
'Power Cell' => 798,
'Power Grid Company of Bangladesh (PGCB)' => 799,
'Press Information Department' => 800,
'Private Inland Container Depot and Conta' => 801,
'Private Survey Institutions' => 802,
'Probashi Kallyan Bank' => 803,
'Public Private Partnership Office' => 804,
'Rapid Action Battalion (RAB)' => 805,
'Registrar of Joint ¿Stock Companies and' => 806,
'Residential Hotels ( Including 3star & A' => 807,
'Retired Persons' => 808,
'Rural Power Company Ltd (RPCL)' => 809,
'Satellite Cable Operator' => 810,
'Satellite Channel Distributor/Cinema Dis' => 811,
'Seed Certification Agency' => 812,
'Sheikh Zayad Bin Sultan Al Nahian Trust' => 813,
'Ship Breaking Industries' => 814,
'Ship Building Industries' => 815,
'Shipping Agency' => 816,
'SME Foundation' => 817,
'Soil Resources Development Institute' => 818,
'Special Security Force' => 819,
'Sports and Event management organisation' => 820,
'Stock Exchanges (DSE, CSE, etc)' => 821,
'Stone Crashers' => 822,
'Student' => 823,
'Sugar Mills' => 824,
'Sylhet Agricultural University' => 825,
'Tailoring Shop and Tailors' => 826,
'Tank Terminal' => 827,
'Testing Laboratory' => 828,
'Tourism Industry' => 829,
'Urban Development Directorate' => 830,
'Dhaka Electric Supply Company (DESCO)' => 363,
'Printing & Dyeing Industries' => 366,
'Spinning Mills' => 367,
'Weaving Mills' => 368,
'Coconut oil production industries' => 369,
'Tobacco Processing Industries' => 370,
'Cosmetics & Toiletries Industries' => 371,
'Rubber And Plastic Industries' => 372,
'Leather Products Manufacturing Industri' => 374,
'Paper and Paper Products Manufacturing I' => 376,
'Furniture, Fixture, Particle Boards and' => 377,
'Milk Processing Industries' => 378,
'Food Processing Industry (PRAN, AFTAB,' => 379,
'Pharmaceutical Industries' => 381,
'Salt Processing Industries ' => 382,
'Tea processing industries' => 383,
'Fertilizer Company' => 387,
'LP Gas Companies' => 397,
'Oxygen Gas Companies' => 398,
'Other Gas Companies' => 399,
'Others ' => 400,
'Photo Studios and Color labs' => 401,
'Travel Agencies/Overseas Employment / Av' => 402,
'Cold-Storages' => 403,
'Beauty Parlours/ Saloons/ Health Club/Fi' => 404,
'Pension Funds /Provident Funds of privat' => 414,
'Foreign Individuals' => 416,
'Foreign Offices/ Embassies/Enterprises/C' => 417,
'Mosques' => 418,
'Temples, Churches & the like' => 419,
'Sports Clubs' => 420,
'Other Clubs' => 421,
'Theatre & Cultural Organisations' => 422,
'Political Parties' => 423,
'Trade Unions' => 424,
'District/Upazilla Associations' => 425,
'Professional Associations (Doctor, Engg)' => 426,
'Chambers of Industries' => 427,
'Other Associations, n.e.s.' => 428,
'Trust fund & Other Non-profit Organisati' => 429,
'Institutes of Technology (Including Poly' => 442,
'Bangladesh University of Engineering & T' => 443,
'Chittagong University of Engineering & T' => 454,
'Khulna University of Engineering & Techn' => 455,
'Rajshahi University of Engineering & Tec' => 456,
'Bangabandhu Sheikh Mujibur Rahman Agricu' => 457,
'Sher-e-Bangla Agricultural University' => 458,
'Hajee Mohammad Danesh Science & Technolo' => 459,
'Patuakhali Science & Technology Universi' => 460,
'Other Public Educational Institutions' => 461,
'Bangladesh Veterinary Council' => 462,
'Foreign Service Academy' => 463,
'National Institute of Population, Resear' => 464,
'Institute of Public Health and Nutrition' => 465,
'National Institute of Cardiovascular Dis' => 466,
'National Institute of Preventive & Socia' => 467,
'Institute of Public Health And Hospital' => 468,
'National Institute of Disease of Chest &' => 469,
'National Institute of Ophthalmology' => 470,
'National Institute of Traumatology & Ort' => 471,
'Dhaka Transport Co-ordination Authority' => 477,
'Chittagong Hill Tracts Regional Council' => 478,
'Rangamati Hill District Council' => 479,
'Khagrachori Hill District Council' => 480,
'Bandarban Hill District Council' => 481,
'Bangladesh Overseas Employment Service L' => 482,
'National Housing Authority' => 483,
'Importers' => 189,
'Investment Companies' => 196,
'Central Co-operative Bank' => 197,
'Land Mortgage Co-operative Bank' => 198,
'Other Co-operative Banks/Societies' => 199,
'Professionals and Self-employed Persons' => 200,
'Wage Earners (Bangladeshi nationals work' => 201,
'Roads and Highway Department' => 204,
'Directorate of Social Welfare' => 208,
'Bangladesh Govt. Press (BG Press)' => 209,
'Directorate of Secondary and Higher Seco' => 210,
'Directorate of Livestock' => 211,
'Hajj Office' => 212,
'Directorate of Sports' => 213,
'Directorate of Archaeology' => 214,
'Directorate of Bangladesh Family Plannin' => 216,
'Directorate of Printing, Stationary, For' => 217,
'Department of Local Government & Enginee' => 218,
'Bangladesh Open University (BOU)' => 221,
'Medical/Dental Colleges' => 222,
'Bangabandhu Sheikh Mujib Medical Univers' => 225,
'Dhaka University' => 226,
'Rajshahi University' => 227,
'Chittagong University' => 228,
'Jahangirnagar University' => 229,
'Khulna University' => 230,
'Shahjalal University of Science and Tech' => 231,
'Bangladesh Agricultural University' => 232,
'Islamic University' => 233,
'Dhaka University of Engineering & Techno' => 234,
'National Academy for Planning & Developm' => 235,
'Bangladesh Sugarcane Research Institute' => 236,
'Investment Corporation of Bangladesh (IC' => 126,
'Grameen Bank' => 127,
'Infrastructure Development Company Limit' => 128,
'Sadharan Bima Corporation' => 129,
'Jiban Bima Corporation' => 130,
'Bangladesh Textile Mills Corporation & R' => 131,
'Sugar Mills ' => 132,
'Food and Allied Industries' => 133,
'Fertilizer, Chemical & Pharmaceutical In' => 134,
'Paper and Paper Board Industries' => 135,
'Steel Mills' => 136,
'Engineering and Ship Building Industries' => 137,
'Bangladesh Jute Mills Corporation and Re' => 138,
'Bangladesh Petroleum Corporation & relat' => 140,
'Bangladesh Oil, Gas & Mineral Corporatio' => 141,
'Bangladesh Power Development Board' => 142,
'Bangladesh Biman Corporation' => 143,
'Bangladesh Shipping Corporation' => 144,
'Trading Corporation of Bangladesh' => 145,
'Bangladesh Railway' => 146,
'Bangladesh Telecommunications Company Li' => 147,
'Bangladesh Road Transport Corporation (B' => 148,
'Bangladesh Forest Industries Development' => 149,
'Others1' => 150,
'Bangladesh Fish Development Corporation' => 151,
'Bangladesh Tea Board' => 152,
'Bangladesh Inland Water Transport Author' => 153,
'Bangladesh Inland Water Transport Corpor' => 154,
'Bangladesh Water Development Board' => 155,
'Rural Electrification Board (REB)' => 158,
'Dhaka Electric Supply Authority (DESA)' => 159,
'Chittagong Port Authority' => 160,
'Mongla Port Authority' => 161,
'BANGLADESH SMALL & COTTAGE IND.CORP.' => 162,
'Bangladesh Parjatan Corporation' => 163,
'Bangladesh Film Development Corporation' => 164,
"BANGLADESH CONSUMER'S SUPPLIES LTD." => 165,
'Civil Aviation Authority of Bangladesh' => 166,
'Bangladesh Freedom Fighters Welfare Trus' => 167,
'Telephone Shilpa Sangstha' => 168,
'Bangladesh Cable Industries Corporation' => 169,
'Bangladesh Tannery Industries Corporatio' => 170,
'Bangladesh Services Ltd.' => 171,
'Hotels International Ltd. (3 Stars & abo' => 172,
'Zila Parishad' => 173,
'Municipal/City Corporation' => 174,
'Thana/Upazila Parishad' => 175,
'Union Parishad' => 176,
'Agricultural Farms (Nursery, Horticultur' => 178,
'Jute Mills/Jute products Manufacturing I' => 179,
'Textile Mills' => 180,
'Readymade Garments Industries' => 181,
'Chemical and Chemical Products Industrie' => 182,
'Soaps & Detergents Factories' => 274,
'Steel Engineering & Metallic Products In' => 275,
'Assembling Industry' => 276,
'Production, supply and distribution of p' => 278,
'Entertainment (Amusement Park, Theme par' => 279,
'Nazrul Institute' => 238,
'Bangladesh Livestock Research Institute' => 239,
'Bangladesh Rural Development Training In' => 240,
'River Research Institute' => 241,
'Council of Bangladesh Institute of Techn' => 242,
'National Training & Research Academy for' => 243,
'Bangladesh Fisheries Research Institute' => 244,
'National Sports Council (NSC)' => 245,
'Bangladesh Bridge Authority' => 247,
'Privatisation Commission' => 248,
'Water Resources Planning Organisation (W' => 249,
'BARID Multipurpose Development Authority' => 250,
'The Security Printing Corporation (Bangl' => 251,
'Bangladesh National Science & Technical' => 252,
"Bangladesh Tea Plantation Employees' Pro" => 253,
'Dock Labour Management Board, Chittagong' => 255,
'Dock Labour Management Board, Bagerhat' => 256,
'Saudi Bangladesh Industrial and Agricult' => 258,
'Others2' => 259,
'Ansar-VDP Unnayan Bank' => 261,
'Karma Sangsthan Bank' => 262,
'Others3' => 263,
'Gram Parishad ' => 264,
'Fishing Farms ( Hatchery, Shrimp Culture' => 265,
'Dairy Farms' => 266,
'Poultry Farms' => 267,
'Hosiery Factories' => 268,
'Cement Factories' => 269,
'Ceramic Industries' => 270,
'Bricks Manufacturers and Sand elevators' => 271,
'Glass and Glassware Products Factories' => 272,
'Hospitals, Clinics, Diagnostic Centres a' => 280,
'IT-based activities (system analysis, de' => 281,
'Courier Services & Express Mail Services' => 282,
'Restaurants /Fast Food' => 283,
'Exporters' => 285,
'Importers and Exporters' => 286,
'Whole Sale Traders' => 287,
'Retail Traders' => 288,
'Other Business Institutions' => 289,
'NGO/Micro Credit Organizations -( BRAC,' => 294,
'Newspaper' => 295,
'Television' => 296,
'Radio' => 297,
'Private Schools, Colleges, University Co' => 298,
'Medical & Dental Colleges' => 299,
'Private Universities' => 300,
'Private Institute of IT' => 301,
'Other Educational /Training institutes /' => 302,
'Leasing Companies (Non-depository)' => 303,
'Other Financial Intermediaries' => 304,
'Leasing Companies (Depository)' => 305,
'Other Depository Corporations' => 308,
'Money Changers' => 309,
'Service Holders (Salaried Person)' => 311,
'Office of the District Commissioner' => 004,
'Directorate of Relief and Rehabilitation' => 006,
'Anti Corruption Commission' => 007,
'Bangladesh Nursing Council' => 58,
'Bangladesh Marine Academy' => 9,
'Directorate of Primary Education' => 010,
'Office of the Comptroller and Auditor Ge' => 011,
'National Board of Revenue' => 012,
'Directorate of National Savings' => 013,
'Bangladesh Bureau of Statistics' => 015,
'Bangladesh Civil Service Administration' => 016,
'Directorate of Health' => 18,
'Directorate of Jute' => 19,
'Department of Textile' => 020,
'Directorate of Labor' => 021,
'Directorate of Land Record and Survey' => 023,
'Geological Survey of Bangladesh' => 024,
'Public Works Department' => 025,
'Department of Women Affairs' => 026,
'Registration Directorate' => 027,
'Department of Agricultural Extension' => 28,
'Directorate of Public Health and Enginee' => 29,
'Department of Co-operative' => 030,
'National Curriculum and Text Book Board' => 033,
'Bangladesh Madrasha Education Board' => 034,
'Bangladesh Technical Education Board' => 035,
'Board of Intermediate and Secondary Educ' => 036,
'Government Schools, Colleges, Universit' => 037,
'Cadet Colleges' => 38,
'National University (NU), Gazipur' => 39,
'Bangladesh Academy for Rural Development' => 040,
'Rural Development Academy, Bogra' => 041,
'Bangla Academy' => 042,
'Bangladesh Shilpakala Academy' => 043,
'Islamic Foundation, Bangladesh' => 044,
'Bangladesh Agricultural Research Institu' => 045,
'Bangladesh Council of Scientific & Indus' => 046,
'Bangladesh Rice Research Institute (BRRI' => 047,
'Bangladesh Standards and Testing Institu' => 48,
'Central Public Library' => 49,
'Bangladesh National Museum' => 050,
'Other Councils/Institutions' => 051,
'Bangladesh Insurance Academy' => 052,
'National Book Centre, Bangladesh' => 053,
'Bangladesh Medical & Dental Council (BMD' => 054,
'Bangladesh Medical Research Council' => 055,
'Pharmacy Council of Bangladesh' => 056,
'Bangladesh College of Physicians & Surge' => 057,
'Bangladesh Jute Research Institute (BJRI' => 060,
'Bangladesh Institute of Development Stud' => 061,
'Bangladesh Agriculture Research Council' => 062,
'Bangladesh National Social Welfare Counc' => 064,
'Marine Fisheries Academy' => 065,
'Bangladesh Institute of Management (BIM)' => 066,
'Bangladesh Industrial Technical Assistan' => 067,
'Institute of Chartered Accountants of Ba' => 68,
'Institute of Cost & Management Accountan' => 69,
'National Institute of Local Government' => 070,
'Bangladesh Space Research and Remote Sen' => 071,
'National Museum of Science & Technology' => 073,
'Bangladesh Shishu Academy' => 074,
'Bangladesh Institute of Nuclear Agricult' => 077,
'Public Administration Training Centre, S' => 78,
'Press Institute of Bangladesh' => 79,
'Bangladesh Atomic Energy Commission' => 80,
'Bangladesh Agricultural Development Corp' => 81,
'Chittagong Hill Tracts Development Board' => 82,
"Prime Minister's Relief Fund" => 83,
'Rajdhani Unnayan Kartreepaksha (RAJUK)' => 84,
'Chittagong Development Authority' => 85,
'Khulna Development Authority' => 86,
'Rajshahi Development Authority' => 87,
'Bangladesh Handloom Board' => 88,
'Bangladesh Sericulture Board' => 89,
'Export Promotion Bureau' => 90,
'Bangladesh Rural Development Board (BRDB' => 91,
'Bangladesh Scouts' => 93,
"Bangladesh Girls' Guide Association" => 94,
'Bangladesh Homoeopathic Board' => 96,
'Buddhist Welfare Trust' => 97,
'Bangladesh Tobacco Development Board' => 99,
'Jute Industries Development Board' => 100,
'Bangladesh Applied Nutrition And Human R' => 101,
'Investment Advisory Centre of Bangladesh' => 102,
'Bangladesh Sports Control Board' => 103,
'Vested Property Management Board' => 104,
'University Grants Commission of Banglade' => 105,
'Board of Unani & Ayurvedic Council' => 106,
'Bangladesh Press Council' => 107,
'Office of the Bangladesh Waqf Administra' => 108,
'Welfare Funds' => 109,
'Public Trust Funds' => 110,
'Development Funds' => 111,
'Benevolent Funds' => 112,
'Public Educational Funds' => 113,
'Development Works Program Fund' => 114,
'Bangladesh Export Processing Zone Author' => 115,
'National Board of Abandoned Properties' => 116,
'Cyclone Preparedness Programme (CPP)' => 117,
'Hindu Welfare Trust' => 118,
'Urban Development Trust' => 119,
'Bangladesh Folk Arts & Craft Foundation,' => 120,
'Bangladesh Television/BTV World/ Sangsha' => 121,
'Bangladesh Sangbad Sangstha (BSS)' => 122,
'Bangladesh Betar' => 123,
'Bangladesh House Building Finance Corpor' => 124,
'Office of the commissioner to taxes' => 831,
'Directorate of armd force medical servic' => 832,
'Directorate of govt. transport' => 833,
'Directorate of insurance' => 834,
'Department of Railroad inspector' => 835,
'Bangladesh Diplomatic mission' => 836,
'National Brodcasting Authority' => 837,
'Agrani SME Financing Company Limited ' => 838,
'Bangladesh Infrastructure Finance Fund L ' => 839,
'WASA (Dhaka, Chittagong, Khulna etc)' => 840,
'Bangladesh Power Development Board ' => 841,
'Other Local Authorities.' => 842,
'Cottage Industries' => 843,
'Saw Mills' => 844,
'Handloom Factories' => 845,
'Handicrafts Factories' => 846,
'EPZ Industries (Type A)' => 847,
'EPZ Industries (Type B)' => 848,
'EPZ Industries (Type C)' => 849,
'Other Industries not above mentioned' => 850,
'Road Transport Companies (including Rent' => 851,
'Water Transport' => 852,
'Air Transport' => 853,
'Construction Companies' => 854,
'Publishing Industries (including printin' => 855,
'Telecommunication (Mobile/cellular opera' => 856,
'Housing Companies or Societies/Land Deve' => 857,
'Warehouse' => 858,
'Buying House' => 859,
'Other ServicesProviding Org' => 860,
'Coconut oil production industries ' => 861,
'Milk Processing Industries (Pasteurisat' => 863,
'Food Processing Industry (PRAN, AFTAB, ' => 864,
'Tea processing industries ' => 866,
'Refining and hydrogenation of edible oi' => 867,
'Processing of Prawn/Shrimp and other fis' => 868,
'Other Pvt Sector Official AC' => 869,
'Life Insurance Companies' => 870,
'General Insurance Companies' => 871,
'Clearing & Forwarding (C & F) Agent' => 405,
'Bank Account -All Scheduled Banks' => 872
];
return (isset($sectorCode[$value])) ? $sectorCode[$value] : 853;
}
// @TODO : Move the mapping to dedicated Type class
private function mapCountry($value)
{
$country = [
'anguilla' => 'AGU',
'afghanistan' => 'AFG',
'albania' => 'ALB',
'algeria' => 'ALG',
'american samoa' => 'AMS',
'andorra' => 'AND',
'angola' => 'ANG',
'antigua' => 'ANT',
'antilles netherlands' => 'ATN',
'argentina' => 'AGT',
'armenia' => 'ARM',
'australia' => 'AUS',
'austria' => 'AST',
'austria ' => 'AAT',
'azerbijan' => 'AZE',
'bahamas' => 'BAH',
'bahrain' => 'BHR',
'bangladesh' => 'BAN',
'barbados' => 'BAR',
'belgium' => 'BEL',
'belize' => 'BLZ',
'belorussia' => 'BLR',
'benin' => 'BNN',
'bermuda' => 'BER',
'bhutan' => 'BHT',
'bolivia' => 'BOL',
'bosnia harzegovina' => 'BOS',
'botswana' => 'BOT',
'brazil' => 'BRZ',
'brunei' => 'BRN',
'bulgaria' => 'BUL',
'burkina faso' => 'BRK',
'burundi' => 'BUR',
'cambodia' => 'CAM',
'cameroon' => 'CMR',
'canada' => 'CAN',
'cape verde' => 'CAP',
'central african republic' => 'CEN',
'chad' => 'CHD',
'chile' => 'CHL',
'china' => 'CHI',
'colombia' => 'COL',
'comoros (comoro islands)' => 'COM',
'congo' => 'CON',
'costa rica' => 'COS',
'croatia' => 'CRO',
'cuba' => 'CUB',
'cyprus' => 'CYP',
'czech republic' => 'CZE',
'denmark' => 'DEN',
'djbouti' => 'DJI',
'dominica' => 'DOM',
'dominican republic' => 'DOR',
'egypt' => 'EGP',
'el-salvador' => 'ELS',
'epz' => 'EPZ',
'equador' => 'EQD',
'equatorial guinea' => 'EQG',
'eritria' => 'ERI',
'estonia' => 'EST',
'ethiopia' => 'ETH',
'european community' => 'EUC',
'faeroe islands' => 'FRI',
'falkland islands' => 'FKL',
'fiji (including pitcairn)' => 'FIJ',
'finland' => 'FIN',
'france' => 'FRA',
'french polynesia' => 'FRP',
'gabon' => 'GAB',
'gambia' => 'GAM',
'georgia' => 'GEO',
'germany' => 'GER',
'ghana' => 'GHA',
'gibraltar' => 'GIB',
'gilbert' => 'GIL',
'greece' => 'GRE',
'greenland' => 'GRL',
'grenada' => 'GRD',
'guadeloupe' => 'GUD',
'guam' => 'GUM',
'guatemala' => 'GUT',
'guiana, french' => 'GUF',
'guinea' => 'GUA',
'guinea-bissau' => 'GUB',
'guyana' => 'GUY',
'haiti' => 'HAI',
'honduras' => 'HOD',
'hongkong' => 'HOK',
'hungary' => 'HUN',
'iceland' => 'ICE',
'india' => 'IND',
'indonesia' => 'IDS',
'iran' => 'IRN',
'iraq' => 'IRQ',
'ireland' => 'IRL',
'italy' => 'ITL',
'ivory coast' => 'IVC',
'jamaica' => 'JAM',
'japan' => 'JAP',
'jordan' => 'JOR',
'kazakh stan' => 'KAZ',
'kenya' => 'KEN',
'kingdom of saudi arabia' => 'SDA',
'kiribati, republic Of' => 'KIR',
'kuwait' => 'KWT',
'kyrghyz republic' => 'KYR',
'luxembourg ' => 'LOU',
'laos p.d. republic of' => 'LOS',
'latvia' => 'LAT',
'lebanon' => 'LEB',
'lesotho' => 'LES',
'liberia' => 'LBR',
'libya (arab jamhuria)' => 'LIB',
'lithuania' => 'LIT',
'luxembourg' => 'LUX',
'macao' => 'MAC',
'madagascar' => 'MAD',
'malawi' => 'MLW',
'malaysia' => 'MAL',
'maldives' => 'MLD',
'mali' => 'MLI',
'malta' => 'MLT',
'martinique' => 'MAR',
'mauritania' => 'MTA',
'mauritius' => 'MTS',
'mexico' => 'MEX',
'moldovia' => 'MOL',
'mongolian republic' => 'MLR',
'montserrat' => 'MON',
'morocco' => 'MOR',
'mozambique' => 'MOZ',
'myanmar' => 'MYA',
'namibia' => 'NAM',
'nauru' => 'NAU',
'nepal' => 'NEP',
'netherlands' => 'NLD',
'new caledonia' => 'NCL',
'new zealand' => 'NZL',
'newzealand' => 'NEW',
'nicaragua' => 'NIC',
'niger' => 'NGR',
'nigeria' => 'NGA',
'norfolk islands' => 'NRF',
'north korea' => 'KON',
'norway' => 'NRW',
'others' => 'OTH',
'pakistan' => 'PAK',
'panama' => 'PAN',
'papua new guinea' => 'PAP',
'paraguay' => 'PGY',
'peru' => 'PRU',
'philippines' => 'PHI',
'poland' => 'POL',
'portugal' => 'POR',
'reunion' => 'REU',
'romania' => 'ROM',
'russia' => 'RSA',
'rwanda' => 'RWA',
'saint kitts and nevis' => 'STK',
'saint martin (french part)' => 'SKN',
'sao tome & princepe' => 'SAO',
'senegal' => 'SGL',
'serbia/montenigro(former yugoslavia)' => 'SRB',
'seychelles' => 'SEY',
'sierra leone' => 'SIE',
'singapore' => 'SIG',
'slovak republic' => 'SLR',
'slovenia' => 'SLV',
'solomon ilands' => 'SLI',
'somalia' => 'SOM',
'south africa' => 'SAF',
'south korea' => 'KOS',
'south korea ' => 'SHK',
'spain' => 'SPN',
'sri-lanka' => 'SLK',
'st. helena' => 'STH',
'st. lucia' => 'STL',
'st. pierre & miquelon' => 'STP',
'st. vincent' => 'STV',
'state of qatar' => 'STQ',
'sudan' => 'SUD',
'sultanate of oman' => 'SOO',
'surinam' => 'SUR',
'swaziland' => 'SWL',
'sweden' => 'SDN',
'switzerland ' => 'SWZ',
'syrian arab republic' => 'SYR',
'taiwan' => 'TAI',
'tanzania' => 'TNZ',
'tazikistan' => 'TAZ',
'thailand' => 'THI',
'togo' => 'TGO',
'tonga' => 'TON',
'trinidad & tobago' => 'TRI',
'tunisia' => 'TUN',
'turkey' => 'TUR',
'turkmenistan' => 'TRN',
'tuvalu' => 'TUV',
'u.s. virgin islands' => 'USV',
'uganda' => 'UGD',
'ukraine' => 'UKR',
'united arab emirates' => 'UAE',
'united kingdom ' => 'UKG',
'united kingdom' => 'GBR',
'upper volta' => 'UVT',
'uruguay' => 'UGY',
'usa' => 'USA',
'uzbekistan' => 'UBZ',
'vanuatu (new hebridges)' => 'VNT',
'vatican city' => 'VTC',
'venezuela' => 'VNZ',
'vietnam' => 'VTM',
'west indies n.i.e.' => 'WIN',
'western samoa' => 'WES',
'windward islands' => 'WWI',
'yemen, arab republic of' => 'YMN',
'yugoslavia' => 'YUG',
'zaire' => 'ZRE',
'zambia' => 'ZAM',
'zimbabwe' => 'ZIM'
];
return (isset($country[strtolower($value)])) ? $country[strtolower($value)] : 'BAN';
}
/**
* @param Ekyc $ekyc
* @param string $applicationId
*/
private function prepareRequestXml(Ekyc $ekyc, $applicationId)
{
try {
$applicantNames = explode(' ', $ekyc->getApplicantDetail()->getName());
if (count($applicantNames) > 1) {
$lastName = $applicantNames[count($applicantNames) - 1];
unset($applicantNames[count($applicantNames) - 1]);
$firstName = implode(' ', $applicantNames);
} else {
$lastName = $firstName = implode(' ', $applicantNames);
}
$presentDistrictInfo = ($ekyc->getPresentAddress()->getDistrict()) ? $this->getRepository()->find($ekyc->getPresentAddress()->getDistrict()) : null;
$permanentDistrictInfo = ($ekyc->getPermanentAddress()->getDistrict()) ? $this->getRepository()->find($ekyc->getPermanentAddress()->getDistrict()) : null;
$preAddressL1 = preg_replace('/[^A-Za-z0-9\-, ]/', '', $ekyc->getPresentAddress()->getAddressLine1());
$finalPreAddressL1 = (!empty(trim($preAddressL1))) ? substr($preAddressL1, 0, 25) : "Pre Address L1";
$preAddressL2 = preg_replace('/[^A-Za-z0-9\-, ]/', '', $ekyc->getPresentAddress()->getAddressLine2());
$finalPreAddressL2 = (!empty(trim($preAddressL2))) ? substr($preAddressL2, 0, 25) : "Pre Address L2";
$perAddressL1 = preg_replace('/[^A-Za-z0-9\-, ]/', '', $ekyc->getPermanentAddress()->getAddressLine1());
$finalPerAddressL1 = (!empty(trim($perAddressL1))) ? substr($perAddressL1, 0, 25) : "Per Address L1";
$perAddressL2 = preg_replace('/[^A-Za-z0-9\-, ]/', '', $ekyc->getPermanentAddress()->getAddressLine2());
$finalPerAddressL2 = (!empty(trim($perAddressL2))) ? substr($perAddressL2, 0, 25) : "Per Address L2";
if (!filter_var($ekyc->getApplicantDetail()->getEmail(), FILTER_VALIDATE_EMAIL)) {
$email = $applicationId.'@gmail.com';
} else {
$email = $ekyc->getApplicantDetail()->getEmail();
}
$spouseText = preg_replace('/[^A-Za-z0-9\-. ]/', '', $ekyc->getApplicantDetail()->getSpouseName());
if (!empty(trim($spouseText))) {
$spouseName = $spouseText;
} else {
$spouseName = 'Unmarried';
}
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<NEWACCREQUEST>
<APPLICATIONID>' . $applicationId . '</APPLICATIONID>
<CUSTOMERINFOS>
<CUSTOMERINFO>
<NEW_CUSTOMER>YES</NEW_CUSTOMER>
<CUST_CODE />
<CUST_TYPE>N</CUST_TYPE>
<IS_FIRST_APPLICANT>Y</IS_FIRST_APPLICANT>
<OWNER_DIRECTOR>O</OWNER_DIRECTOR>
<DIRECTORY_TYPE>OWN</DIRECTORY_TYPE>
<FIRST_NAME>' . preg_replace('/[^A-Za-z0-9\-. ]/', '', $firstName) . '</FIRST_NAME>
<LAST_NAME>' . preg_replace('/[^A-Za-z0-9\- ]/', '', $lastName) . '</LAST_NAME>
<FATHER_NAME>' . $ekyc->getApplicantDetail()->getFatherName() . '</FATHER_NAME>
<MOTHER_NAME>' . $ekyc->getApplicantDetail()->getMotherName() . '</MOTHER_NAME>
<DATE_OF_BIRTH>' . date('d/m/Y', strtotime($ekyc->getApplicantDetail()->getDob())) . '</DATE_OF_BIRTH>
<NATIONALITY>' . $this->mapNationality($ekyc->getApplicantDetail()->getNationality()) . '</NATIONALITY>
<GENDER>' . $this->mapGender($ekyc->getApplicantDetail()->getGender()) . '</GENDER>
<NATIONALID>' . preg_replace('/\D/', '', $ekyc->getApplicantDetail()->getNidNumber()) . '</NATIONALID>
<PLACE_OF_BIRTH>Dhaka</PLACE_OF_BIRTH>
<COUNTRY_OF_BIRTH>' . $this->mapCountry('') . '</COUNTRY_OF_BIRTH>
<MOBILENO>' . $ekyc->getApplicantDetail()->getPhone() . '</MOBILENO>
<MAILID>' . $email . '</MAILID>
<COMPANY_TITLE />
<COMPANY_TYPE />
<RELIGIOUS_CODE>' . $this->mapReligious('') . '</RELIGIOUS_CODE>
<OCCUPATION_CODE>' . $this->mapOccupation(strtoupper($ekyc->getApplicantDetail()->getOccupation())) . '</OCCUPATION_CODE>
<OTH_OCCUPATION_DETAIL />
<MONTHLY_INCOME>' . intval($ekyc->getApplicantDetail()->getMonthlyIncome()) . '</MONTHLY_INCOME>
<MARITUAL_STATUS>' . $this->mapMaritalStatus($ekyc->getApplicantDetail()->getMaritalStatus()) . '</MARITUAL_STATUS>
<SPOUSE_NAME>' . $spouseName . '</SPOUSE_NAME>
<SIGNATURE>Y</SIGNATURE>
<CUSADDRESS>
<ADDRESS>
<ADRTYP>PRE</ADRTYP>
<ADD_LINE1>' . $finalPreAddressL1 . '</ADD_LINE1>
<ADD_LINE2>' . $finalPreAddressL2 . '</ADD_LINE2>
<CITYCODE>BAN</CITYCODE>
<ZIPCOD>' . (intval($ekyc->getPresentAddress()->getPostcode()) > 0) ? intval($ekyc->getPresentAddress()->getPostcode()) : 1230 . '</ZIPCOD>
<UNION_CODE />
<UPAZILA_CODE />
<DISTRICT_CODE>'. (($presentDistrictInfo) ? $presentDistrictInfo->getCode() : 26) .'</DISTRICT_CODE>
<DIVISION_CODE>'. (($presentDistrictInfo) ? $presentDistrictInfo->getDivisionCode() : 30) .'</DIVISION_CODE>
</ADDRESS>
<ADDRESS>
<ADRTYP>EMR</ADRTYP>
<ADD_LINE1>Dhaka</ADD_LINE1>
<ADD_LINE2>Dhaka</ADD_LINE2>
<CITYCODE>BAN</CITYCODE>
<ZIPCOD>1360</ZIPCOD>
<UNION_CODE />
<UPAZILA_CODE>12</UPAZILA_CODE>
<DISTRICT_CODE>26</DISTRICT_CODE>
<DIVISION_CODE>30</DIVISION_CODE>
</ADDRESS>
<ADDRESS>
<ADRTYP>PER</ADRTYP>
<ADD_LINE1>' . $finalPerAddressL1 . '</ADD_LINE1>
<ADD_LINE2>' . $finalPerAddressL2 . '</ADD_LINE2>
<CITYCODE>BAN</CITYCODE>
<ZIPCOD>' . (intval($ekyc->getPermanentAddress()->getPostcode()) > 0) ? intval($ekyc->getPermanentAddress()->getPostcode()) : 1230 . '</ZIPCOD>
<UNION_CODE />
<UPAZILA_CODE />
<DISTRICT_CODE>'. (($permanentDistrictInfo) ? $permanentDistrictInfo->getCode() : 26) .'</DISTRICT_CODE>
<DIVISION_CODE>'. (($permanentDistrictInfo) ? $permanentDistrictInfo->getDivisionCode() : 30) .'</DIVISION_CODE>
</ADDRESS>
</CUSADDRESS>
<CUSDOCUMENT>
<DOCUMENT>
<DOCUMENT_CODE>NAI</DOCUMENT_CODE>
<DOCUMENT_NO>' . preg_replace('/\D/', '', $ekyc->getApplicantDetail()->getNidNumber()) . '</DOCUMENT_NO>
<ISSUE_PLACE>Dhaka</ISSUE_PLACE>
<COUNTRY_OF_ISSUE>BAN</COUNTRY_OF_ISSUE>
<ISSUE_DATE>27/03/2019</ISSUE_DATE>
<EXPIRE_DATE>27/03/2019</EXPIRE_DATE>
</DOCUMENT>
</CUSDOCUMENT>
</CUSTOMERINFO>
</CUSTOMERINFOS>
<NOMINEES>
<NOMINEE>
<IS_NEW_NOMINEE />
<BRANCD />
<ACTYPE />
<ACTNUM />
<SERNUM />
<NOMINEE_TYPCDE />
<NOMINEE_CODE />
<NOMINEE_NAME />
<NOMINEE_GEN />
<NOMINEE_DOB />
<NATIOANALITY />
<MOBILENO />
<NATIONAL_ID />
<FATHER_NAME />
<MOTHER_NAME />
<SPOUSE_NAME />
<NOMINEE_PERCENT />
<RELIGIOUS_CODE />
<RELATION_CODE />
<RELATION_DESC />
<OCCUPATION_CODE />
<NOMINEE_ADRESS>
<ADDRESS>
<ADRTYP />
<ADD_LINE1 />
<ADD_LINE2 />
<CITYCODE />
<ZIPCOD />
<UNION_CODE />
<UPAZILA_CODE />
<DISTRICT_CODE />
<DIVISION_CODE />
<COUNTRY_CODE />
</ADDRESS>
<ADDRESS>
<ADRTYP />
<ADD_LINE1 />
<ADD_LINE2 />
<CITYCODE />
<ZIPCOD />
<UNION_CODE />
<UPAZILA_CODE />
<DISTRICT_CODE />
<DIVISION_CODE />
<COUNTRY_CODE />
</ADDRESS>
</NOMINEE_ADRESS>
<NOMDOCUMENT>
<DOCUMENT>
<DOCUMENT_CODE />
<DOCUMENT_NO />
<ISSUE_PLACE />
<COUNTRY_OF_ISSUE />
<ISSUE_DATE />
<EXPIRE_DATE />
</DOCUMENT>
</NOMDOCUMENT>
</NOMINEE>
</NOMINEES>
<TRANSPROFILES>
<TRANSPROFILE>
<OPERATION_CODE />
<TRANS_PER_DAY />
<TRANS_PER_MONTH />
<TOT_AMNT_PERDAY />
<TOT_AMNT_PERMONTH />
<MAX_AMNT_PERTRAN />
<ISRESTRICTED />
</TRANSPROFILE>
</TRANSPROFILES>
<AC_OPNG_CHCKLST>
<CHECKLIST>
<BRANCD />
<ACTYPE />
<ACTNUM />
<AC_OPNG_DOC_ID />
<DOC_RECEIVED_STAT />
<CHECKER />
</CHECKLIST>
</AC_OPNG_CHCKLST>
<CUSTOMER_AC_INFO>
<BRANCD>'. $ekyc->getBranch()->getCode() .'</BRANCD>
<ACTYPE>' . (($ekyc->getAccountType()) ? $ekyc->getAccountType()->getCode() : 'S02') . '</ACTYPE>
<ACTNUM />
<ACTTIT>' . $ekyc->getAccountDetail()->getAccountName() . '</ACTTIT>
<COMPANY_OR_INDIVIDUAL>' . $this->mapManageType($ekyc->getAccountDetail()->getManageType()) . '</COMPANY_OR_INDIVIDUAL>
<OPERATING_INST>' . $this->mapOperationType($ekyc->getAccountDetail()->getManageType()) . '</OPERATING_INST>
<INTRODUCER_ACCNO>04934001922</INTRODUCER_ACCNO>
<STATEMENT_FREQ>4</STATEMENT_FREQ>
<MINOR />
<MIN_DOB />
<NOMINEE_ID />
<CHEQUE_BOOK>Y</CHEQUE_BOOK>
<SECTOR_CODE>' . $this->mapSectorCode('') . '</SECTOR_CODE>
<ECONOMY_CODE>133</ECONOMY_CODE>
<SECURITY_CODE />
<ARO_OR_EXECUTVE_ID>SO000002</ARO_OR_EXECUTVE_ID>
<RELATIONSHIP_MGR_ID>MA000001</RELATIONSHIP_MGR_ID>
<IS_CHECKLIST_EXIST>N</IS_CHECKLIST_EXIST>
<IS_TRNPROF_EXIST>N</IS_TRNPROF_EXIST>
</CUSTOMER_AC_INFO>
<FATCA_INFO>
<CUSTOMER_CODE />
<COUNTRY_OF_RESIDENCE />
<IS_USCITIZEN />
<COUNTRY_OF_BIRTH />
<IS_USRESIDENCE />
<PR_OR_GREENCARD_HOLDER />
<IS_SISCONOF_PARNT_COMP />
<IS_PARNTCOMP_US_REGSTRD />
<IS_PARNTCOMP_US_REGSTRD />
<IS_SISCOMP_US_REGSTRD />
<ANY_USCITIZEN_DIRECTOR />
</FATCA_INFO>
</NEWACCREQUEST>';
$xml = str_replace("\n", " ", $xml);
//return array('data' => $xml);
return array('error' => 0, 'data' => $xml);
} catch (\Exception $e) {
return array('error' => 1, 'msg' => $e->getMessage());
}
}
}