diff --git a/app/PaymentDrivers/PayPalRestPaymentDriver.php b/app/PaymentDrivers/PayPalRestPaymentDriver.php index 5745ab86d725..37689580651b 100644 --- a/app/PaymentDrivers/PayPalRestPaymentDriver.php +++ b/app/PaymentDrivers/PayPalRestPaymentDriver.php @@ -170,9 +170,9 @@ class PayPalRestPaymentDriver extends BaseDriver $data['currency'] = $this->client->currency()->code; -// return render('gateways.paypal.ppcp.card', $data); +return render('gateways.paypal.ppcp.card', $data); -return render('gateways.paypal.pay', $data); +// return render('gateways.paypal.pay', $data); } diff --git a/lang/en/texts.php b/lang/en/texts.php index 63654d484928..ed11493f87b1 100644 --- a/lang/en/texts.php +++ b/lang/en/texts.php @@ -5320,6 +5320,11 @@ $lang = array( 'task_round_to_nearest' => 'Round To Nearest', 'bulk_updated' => 'Successfully updated data', 'bulk_update' => 'Bulk Update', + 'calculate' => 'Calculate', + 'sum' => 'Sum', + 'money' => 'Money', + 'web_app' => 'Web App', + 'desktop_app' => 'Desktop App', ); return $lang; diff --git a/lang/fr_CA/texts.php b/lang/fr_CA/texts.php index adecee4bb1b7..ee826a75d2c0 100644 --- a/lang/fr_CA/texts.php +++ b/lang/fr_CA/texts.php @@ -5297,6 +5297,26 @@ Lorsque les montant apparaîtront sur votre relevé, veuillez revenir sur cette 'local_domain_help' => 'Domaine EHLO (facultatif)', 'port_help' => 'ex. 25,587,465', 'host_help' => 'ex. smtp.gmail.com', + 'always_show_required_fields' => 'Permet l\'affichage des champs requis d\'un formulaire', + 'always_show_required_fields_help' => 'Affiche toujours les champs requis d\'un formulaire au paiement', + 'advanced_cards' => 'Cartes avancées', + 'activity_140' => 'État de compte envoyé à :client', + 'invoice_net_amount' => 'Montant net de la facture', + 'round_to_minutes' => 'Arrondir aux minutes', + '1_minute' => '1 minute', + '5_minutes' => '5 minutes', + '15_minutes' => '15 minutes', + '30_minutes' => '30 minutes', + '1_hour' => '1 heure', + '1_day' => '1 jour', + 'round_tasks' => 'Arrondir les tâches', + 'round_tasks_help' => 'Arrondir les intervales à la sauvegarde des tâches', + 'direction' => 'Direction', + 'round_up' => 'Arrondir à hausse', + 'round_down' => 'Arrondir à la baisse', + 'task_round_to_nearest' => 'Arrondir au plus près', + 'bulk_updated' => 'Les données ont été mises à jour', + 'bulk_update' => 'Mise à jour groupée', ); return $lang; diff --git a/lang/ja/texts.php b/lang/ja/texts.php index 9f046c23ceb4..dfec27c63c5c 100644 --- a/lang/ja/texts.php +++ b/lang/ja/texts.php @@ -700,7 +700,7 @@ $lang = array( 'total_invoiced' => 'Total Invoiced', 'open_balance' => 'Open Balance', 'verify_email' => 'Please visit the link in the account confirmation email to verify your email address.', - 'basic_settings' => 'Basic Settings', + 'basic_settings' => '基本設定', 'pro' => 'Pro', 'gateways' => 'ペイメントゲートウェイ', 'next_send_on' => 'Send Next: :date', @@ -1344,7 +1344,7 @@ $lang = array( 'auto_bill_payment_method_credit_card' => 'クレジットカード', 'auto_bill_payment_method_paypal' => 'PayPal アカウント', 'auto_bill_notification_placeholder' => 'この請求書は、期日にて登録されているクレジットカードに自動的に請求されます。', - 'payment_settings' => 'Payment Settings', + 'payment_settings' => '支払い設定', 'on_send_date' => '発送日', 'on_due_date' => '支払期日', @@ -5300,6 +5300,26 @@ $lang = array( 'local_domain_help' => 'EHLO domain (optional)', 'port_help' => 'ie. 25,587,465', 'host_help' => 'ie. smtp.gmail.com', + 'always_show_required_fields' => 'Allows show required fields form', + 'always_show_required_fields_help' => 'Displays the required fields form always at checkout', + 'advanced_cards' => 'Advanced Cards', + 'activity_140' => 'Statement sent to :client', + 'invoice_net_amount' => 'Invoice Net Amount', + 'round_to_minutes' => 'Round To Minutes', + '1_minute' => '1 Minute', + '5_minutes' => '5 Minutes', + '15_minutes' => '15 Minutes', + '30_minutes' => '30 Minutes', + '1_hour' => '1 Hour', + '1_day' => '1 Day', + 'round_tasks' => 'Round Tasks', + 'round_tasks_help' => 'Round time intervals when saving tasks', + 'direction' => 'Direction', + 'round_up' => 'Round Up', + 'round_down' => 'Round Down', + 'task_round_to_nearest' => 'Round To Nearest', + 'bulk_updated' => 'Successfully updated data', + 'bulk_update' => 'Bulk Update', ); return $lang; diff --git a/resources/js/clients/payments/square-credit-card.js b/resources/js/clients/payments/square-credit-card.js index ca8a153e9359..4242eae5d651 100644 --- a/resources/js/clients/payments/square-credit-card.js +++ b/resources/js/clients/payments/square-credit-card.js @@ -171,15 +171,10 @@ class SquareCreditCard { document.querySelector('input[name=token]').value = ''; }); - // let toggleWithToken = document.querySelector( - // '.toggle-payment-with-token' - // ); - - // if (!toggleWithToken) { document.getElementById('loader').classList.add('hidden'); document.getElementById('payment-list').classList.remove('hidden'); document.getElementById('toggle-payment-with-credit-card')?.click(); - // } + }); } diff --git a/tests/Integration/Einvoice/FACT1Test.php b/tests/Integration/Einvoice/FACT1Test.php index 11433b9beaa7..09364f5fbd5b 100644 --- a/tests/Integration/Einvoice/FACT1Test.php +++ b/tests/Integration/Einvoice/FACT1Test.php @@ -12,6 +12,8 @@ namespace Tests\Integration\Einvoice; use Tests\TestCase; +use Sabre\Xml\Reader; +use Sabre\Xml\Service; use Invoiceninja\Einvoice\Models\FACT1\Invoice; /** @@ -20,54 +22,177 @@ use Invoiceninja\Einvoice\Models\FACT1\Invoice; class FACT1Test extends TestCase { + public array $set = []; protected function setUp(): void { parent::setUp(); } - public function testValidationFact1() + +// public function testValidationFact1() +// { + +// $files = [ +// 'tests/Integration/Einvoice/samples/fact1.xml', +// ]; + +// foreach($files as $f) { + +// $xml = file_get_contents($f); + +// // Remove namespaces and prefixes +// $xmlWithoutNamespacesAndPrefixes = $this->removeNamespacesAndPrefixes($xml); + +// // Output the result +// nlog($xmlWithoutNamespacesAndPrefixes); + + + +// } + + + public function removeNamespacesFromArray($data) { - - $files = [ - 'tests/Integration/Einvoice/samples/fact1.xml', - ]; - - foreach($files as $f) { - - $xmlstring = file_get_contents($f); - -// nlog($xmlstring); - - $xml = simplexml_load_string($xmlstring, "SimpleXMLElement"); - $json = json_encode($xml); - $payload = json_decode($json, true); - - nlog($xml); - nlog($payload); - $validation_array = false; - try { - $rules = Invoice::getValidationRules($payload); - nlog($rules); - - $this->assertIsArray($rules); - - $payload = Invoice::from($payload)->toArray(); - nlog($payload); - $this->assertIsArray($payload); - - $validation_array = Invoice::validate($payload); - - $this->assertIsArray($validation_array); - - } catch(\Illuminate\Validation\ValidationException $e) { - - nlog($e->errors()); + if (is_array($data)) { + foreach ($data as &$item) { + if (isset($item['name'])) { + // Remove the namespace from the name + $item['name'] = preg_replace('/^\{\}(.+)/', '$1', $item['name']); + } + if (isset($item['value']) && is_array($item['value'])) { + // Recursively process child elements + $item['value'] = $this->removeNamespacesFromArray($item['value']); + } + if (isset($item['attributes'])) { + unset($item['attributes']); + // Process attributes if needed + // $item['attributes'] = array_map(function ($attr) { + // return preg_replace('/^\{\}(.+)/', '$1', $attr); + // }, $item['attributes']); + } } + } + return $data; + } - $this->assertIsArray($validation_array); + +function convertToKeyValue($data) +{ + $result = []; + foreach ($data as $item) { + // Remove namespace prefix if present + $name = preg_replace('/^\{\}(.+)/', '$1', $item['name']); + $result[$name] = $item['value']; + } + return $result; +} + + +public function keyValueDeserializer(Reader $reader) +{ + $values = []; + $reader->read(); + $reader->next(); + foreach ($reader->parseGetElements() as $element) { + // Strip the namespace prefix + echo "merp".PHP_EOL; + $name = preg_replace('/^\{\}.*/', '', $element['name']); + $values[$name] = $element['value']; + } + return $values; +} + + + public function testFactToArray() + { + + $xml = file_get_contents('tests/Integration/Einvoice/samples/fact1_no_prefixes.xml'); + $service = new Service(); + + // $service->elementMap = [ + // '{}' => 'Sabre\Xml\Deserializer\keyValue', + // ]; + + // $service->elementMap = [ + // '{}*' => function (Reader $reader) use ($service) { + // return $this->keyValueDeserializer($reader); + // } + // ]; + + + $result = $this->removeNamespacesFromArray($service->parse($xml)); + + + // Convert parsed XML to key-value array + if (isset($result['value']) && is_array($result['value'])) { + $keyValueArray = $this->convertToKeyValue($result['value']); + } else { + $keyValueArray = []; } + // Output the result + nlog($keyValueArray); + + + // nlog($cleanedArray); + nlog($service->parse($xml)); + } + + // Output the result + // ($xmlWithoutNamespaces); + + // $reader = new Reader(); + // $service = new Service(); + + // $service->elementMap = [ + // '*' => 'Sabre\Xml\Deserializer\keyValue', + // ]; + + // nlog($service->parse($xmlstring)); + + // $payload =''; + + // // $reader->xml($xmlstring); + // // $payload = $reader->parse(); + + // // nlog($payload); + // $validation_array = false; + // try { + // $rules = Invoice::getValidationRules($payload); + // nlog($rules); + + // $this->assertIsArray($rules); + + // $payload = Invoice::from($payload)->toArray(); + // nlog($payload); + // $this->assertIsArray($payload); + + // $validation_array = Invoice::validate($payload); + + // $this->assertIsArray($validation_array); + + // } catch(\Illuminate\Validation\ValidationException $e) { + + // nlog($e->errors()); + // } + + // $this->assertIsArray($validation_array); + + + // } + + private function extractName($name): string + { + + $pattern = '/\{[^{}]*\}([^{}]*)/'; + + if (preg_match($pattern, $name, $matches)) { + $extracted = $matches[1]; + return $extracted; + } + + return $name; } } \ No newline at end of file diff --git a/tests/Integration/Einvoice/samples/fact1_no_prefixes.xml b/tests/Integration/Einvoice/samples/fact1_no_prefixes.xml new file mode 100644 index 000000000000..137b1e191255 --- /dev/null +++ b/tests/Integration/Einvoice/samples/fact1_no_prefixes.xml @@ -0,0 +1,113 @@ + + + 2.1 + urn:cen.eu:en16931:2017#compliant#urn:efactura.mfinante.ro:CIUS-RO:1.0.1 + ABC 0020 + 2024-01-01 + 2024-01-15 + 384 + RON + RON + + + + 234234234 + + + This can be the full address , not just the street and street nr. + SECTOR2 + RO-B + + RO + + + + RO234234234 + + VAT + + + + Some Copany Name + J40/2222/2009 + + + Someone + 88282819832 + some@email.com + + + + + + + 646546549 + + + This can be the full address , not just the street and street nr. + SECTOR3 + RO-B + + RO + + + + Some Comapny + 646546549 + + + Someone + + some@email.com + + + + + 42 + + some account nr + Bank name + + + + 63.65 + + 335.00 + 63.65 + + S // this is a speciffic identifier for the VAT type + 19 + + VAT + + + + + + 335.00 + 335.00 + 398.65 + 0.00 + 398.65 + + + 1 + 1 // unitcode is a speciffic + identifier for the type of product + 335.00 + + Some Description + Some product + + S // this is a speciffic identifier for the VAT type + 19 + + VAT + + + + + 335 + + + \ No newline at end of file