<?php 
require_once dirname(__DIR__) . '/common.php';

$address_link = 'https://www.fastpax.me/api/v1/address';

//$customer = ['CityName'=>'Chouf',
//             'DistrictID'=>11,
//             'Bldg'=>'.',
//             'Street'=>'.',
//             'Floor'=>'.',
//             //             'Email'=>'.',
//             //             'NearbyLandmark'=>'.',
//             'Phone'=>'71144627',
//             'AddressTitle'=>'System Megara',
//             'Reference'=>'CUSTMEGARA',
//            ];
//$current_token = '3N87Ur9m_qIuLfOZHk7uqXpPwwoXHz7--4ItcpSHHYcwcib7HVtlMq2fZpsiVjg6AzYaZUYjDEGW9CWfT7AspFV11tCuIiwKo6I8EiGGOsaORaf7MK15JbEn2FTAtjwXFdK23SbpMu9wpLUF4DCx3t6f7F33Z5fOEJAYIrNzs6l7RKPWtYkR0xqxmVvmBtubSLK88PQifGMaNml5TN7dVK7jO57StJoD1fRC3dRWJxdusyPR1o9Xkn130rt8TRo6wCFcDA-kzTvt1wh4sW4aJBONM1xc8ec-ehGKbfJVUeXvlG7DyK4v-qdpfxrLfGL825GFQFAh6Vjw_T3yxRtSQTVAL4Io3n9R65_T8pJUQO8WbikeEcHjTPy6sVPH62PGHdaPaXnFSpxlmrSL9M6QbtDWZsfEnsNoTEACXVc8u-S7VpeZUOFXM3bFoJ2X-xBBwdEzlgdBT5DyptA2ZS6fHWgCtBIUQoyjHKMgJvex2gt27ruvrLRU6d466R3fawg6kQGVMZChbkywD_TmhBl43w';

//$customer = ['CityName'=>'Beirut Central District',
//             'DistrictID'=> 4,
//             'Bldg'=>'0',
//             'Street'=>'MAIN ROAD',
//             'Floor'=>'0',
//             'NearbyLandmark'=>'0',
//             'Email'=>'0',
//             'Phone'=>'76055537',
//             'AddressTitle'=>'System Jouri',
//             'Reference'=>'CUSTJOURI',
//            ];
//$current_token = 'uLnqBatizQcjIuQKeKvKvYP5imuMNpKG_zf5lsPzQ6b1KJ_WgVl2o2HccQ4nbCzigSc9HpxoNGnpbBO9Vn3p4cZ3eFI3L9-nslE6e7Z3MFmVzho1jWR2Xl-E4-4786qV18CmYUJNcaFW1MPG3_dYtKZSIcZlX-4BHLtO1U9ccWR4nJTPMDGN3Au7y0O6CzBjj5_lT5OrjhPZxNH9nZ4pXYybToFcykXv908Bgr6SYNBe4B7A1cu5-Exev5ac6yrMXJ-o4bMXrcMVi4WVorAT2AzgH2JzAMmNN0WojZU8ZHbD1kBEavkBS4JLF2btypN6u5sxbWZkYKffi6mzbzi_fcPqOB7EI5bonPiSy6SqBLr_m_9l5pqex9Ylqv8Y2qg-riHBhe-TAfo8jo3fTVYaKj9i1bhjEd27bauj8DGVzDlNfgSE_WZF7hgY0BAG0jCnIKynegL9E31pUsuaau9rt0Xq85isgOALqKKJMjouIM5xgrnC6vpi4sf_kYVG0BR_yrliQhhnqfUutJ6GMko-kMUQ2jLFCKwTvLbkjG73lrU';

//$customer = ['CityName'=>'Beirut Central District',
//             'DistrictID'=>4,
//             'Bldg'=>'*',
//             'Street'=>'MAIN ROAD',
//             'Floor'=>'*',
//             'NearbyLandmark'=>'*',
//             'Phone'=>'76885332',
//             'AddressTitle'=>'System K boutique',
//             'Reference'=>'CUSTKBOUTIQUE',
//            ];
//$current_token = '2Q0yLYW5w10XZDAXAS7bf497N42q7hBSOFB7_owQGRt1hnAWTWCu88qOwFpSrWPLahABstrusto4PtWq9hCRkldls66MQ_-nCSLNcgm--pwJcZeQGV0AkP3kkUUg0necTNYKGrMBQAtRDt6G2jU_zk8bl71N89BFtikJzBK7yteSbFk4Vx7PnA2p7H89KHxxIALV6aJ92qEZO3jb5s9vJteCJKe-VSlPQtytHXhJ40HxFoUGOlR3nvg2GgRU4kkE2fbx1aUjEee7gyEll6ni6cF3tz6RvYmafm2Dc1ZXoojGRix2LGBUT_GsRJsx7BazDT83-G7ib9w-V5zp1RT_dJ_s05Zqtqhnp758wztA1mzbUVU9T3rvjXiAEGxYY6Z3J6TrG-eHCMhdu6gYv-stk26zERSewi8yPLNgDCFy-0FDS6T4_g61Vu9OcMDuWWDfQHE17G1xxSPEGuVIp4LgJ5mNXWLc35Yl1Vn7U_yPaI1Qi5F4pjOsHhz6QSJZlp3mNPwJNz7yqkZukPEefnAr9136A';
//
//$customer = ['CityName'=>'Beirut Central District',
//             'DistrictID'=> 4,
//             'Bldg'=>'/',
//             'Street'=>'MAIN ROAD',
//             'Floor'=>'/',
//             'NearbyLandmark'=>'/',
//             'Email'=>'0',
//             'Phone'=>'70689703',
//             'AddressTitle'=>'System Lamaritta',
//             'Reference'=>'CUSTLAMARITTA',
//            ];
//$current_token = 'UP8ZpR9oeryjgQJGMe0jf6qkhF-fgREGL5G_U19z0kC8Jy5SprEeZJo-kUnBChQ1rodPhKEXiliiFuNQ5L-STgHsejM5BakUgzslds5mCDUNgoa6TkVqJr4-zl-FyAgU_wRx6m7mPW5Scy5FM4gBvfov3DvDk9TgCQzQUgrXCYp2bYWevcAIb4q3hRJx1eBriuuusKzsgo5sBq0ZTjJ_YghxRvY9GFeti8Hy58Uaj-522KAl6SU5RbovYJWQrqpwW1HWI1QDxPXjIwRxOjVh_M2F7h3ORC4BM5kdp68wMcqhBwcX5_K5d9Yc7RgK5tYlbN0IWb4lCsFXRRAxpxEGFgwTEPewo10aMwUpD6Rm6Ru4d6au18Vri8A8cdgNcC62ywjvdGYeUjcMHgmdiXE601Iapcrh-DX-1-mAzxkAMneTuLqokyeX5AeeKpa6CwpTuZ2QbNI0nZGhNp9X0Z0LMSb6L5ZUjkRme40MYK1QzVcuNnAHol78DsChtMMNdG_RsJigAxDINqt1Bnw8fUMYva3GfeNdoyf_yjh-vgyzkV0';
//die('k');
// $customers_added = array();
// $customers_updated = array();
// $error_message ='';
// $customers_not_added = $customers_not_updated = '';
// $address_exist =send_post($address_link.'/get',$customer,$current_token);
// $response_address_exist= json_decode($address_exist);
// if(empty($response_address_exist->Data) && $response_address_exist->Status == 0){
//     $address_add = send_post($address_link.'/create',$customer,$current_token);
//     $response_address_add = json_decode($address_add);
//     if($response_address_add->Status == 1){
//         $customers_added = $customer;
//     }else{
//         if(!empty($response_address_add->Data->Errors))
//             $error_message = implode("",$response_address_add->Data->Errors);
//         else
//             $error_message = $response_address_add->ErrorMessage;
//         $customers_not_added = $error_message.' (For Customer: '.$customer['AddressTitle'].')';
//     }
// }else{
//     $address_edit = send_post($address_link.'/edit',$customer,$current_token);
//     $response_address_edit = json_decode($address_edit);
//     if($response_address_edit->Status == 1){
//         $customers_updated = $customer;
//     }else{
//         if(!empty($response_address_edit->Data->Errors))
//             $error_message = implode("",$response_address_edit->Data->Errors);
//         else
//             $error_message = $response_address_edit->ErrorMessage;
//         $customers_not_updated = $error_message.' (For Customer: '.$customer['AddressTitle'].')';
//     }
// } 
// echo $customers_not_added.'=='.$customers_not_updated.'<br>';
// echo $error_message;
// print_r($customers_added);
// print_r($customers_updated);



$post_arr = array("grant_type"=>"password",
                 "username"=>"myrnazein@hotmail.com",
                 "password"=>"nana12345nana");
//$post_arr = array("grant_type"=>"password",
//                  "username"=>"manarina.namimo@gmail.com",
//                  "password"=>"nana12345nana");
//$post_arr = array("grant_type"=>"password",
//                  "username"=>"topmodel_2004_3@hotmail.com",
//                  "password"=>"nana12345nana");
// $post_arr = array("grant_type"=>"password",
//                   "username"=>"nanamimo.2505@gmail.com",
//                   "password"=>"nana12345nana");
 $current_url_token = 'https://www.fastpax.me/Token';


//$post_arr = array("grant_type"=>"password",
//                 "username"=>"mfashion@fastpax.me",
//                 "password"=>"xP5T6-)RKZ%S,`[M");
//$current_url_token = 'http://fastpax.me:8020/Token';
//
$token = send_post($current_url_token,$post_arr);
echo '<pre>';
print_r($token);
