MChaos

send php smart

Aug 4th, 2025
631
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.26 KB | None | 0 0
  1. $url = 'invoice';
  2.             $data_send = array();
  3.             $data_send['companyVatCode'] = $this->companyVatCode;
  4.             $data_send['issueDate'] = date('Y-m-d');
  5.             $data_send['seriesName'] = 'RO-SRV';
  6.  
  7.             $amount = number_format((int)$order['amount'] / 1.21, 2);
  8.  
  9.             if ($user_info['judet'] == 'Bucureşti'){
  10.                 $sector = ', '.$user_info['sector'];
  11.             } else {
  12.                 $sector = '';
  13.             }
  14.             if ($user_info['legal'] == 1) {
  15.                 $data_send['client'] = array(
  16.                     'name' => transliteration_text($user_info['companiei']),
  17.                     "vatCode" => $user_info['CUI'],
  18.                     'address' => transliteration_text($user_info['address']),
  19.                     'email' => $user_info['email'],
  20.                     'country' => "Romania",
  21.                     'county' => transliteration_text($user_info['judet']),
  22.                     'city' => transliteration_text($user_info['city']),
  23.                     'phone' => $user_info['phone'],
  24.                     "isTaxPayer" => true
  25.                 );
  26.             } else {
  27.                 $data_send['client'] = array(
  28.                     'name' => transliteration_text($user_info['name']),
  29.                     'email' => $user_info['email'],
  30.                     'address' => transliteration_text($user_info['address']),
  31.                     'country' => "Romania",
  32.                     'county' => transliteration_text($user_info['judet']),
  33.                     'city' => transliteration_text($user_info['city']),
  34.                     'phone' => $user_info['phone'],
  35.                     'vatCode' => "-",
  36.                     "isTaxPayer" => false
  37.                 );
  38.  
  39.             }
  40.  
  41.             $data_send['products'][] = array(
  42.                 "name" => 'Plata pentru serviciile de acces la stații de alimentare a bateriilor  vehiculelor electrice',
  43.                 "code" => 1,
  44.                 "measuringUnitName" => "buc",
  45.                 "currency" => "RON",
  46.                 "quantity" => 1,
  47.                 "price" => $amount,
  48.                 "taxPercentage" => 21
  49.             );
  50.  
  51.             $json_send = json_encode($data_send);
  52.  
  53.             $response = $this->curl_init($url, 'POST', $json_send);
Advertisement
Add Comment
Please, Sign In to add comment