Anonymous
Проблемы с платежным адресом и названием компании, которые не отображаются в счете Quaderno
Сообщение
Anonymous » 14 окт 2024, 09:28
Я использую пакет Quaderno PHP Composer для создания счетов в своем приложении. Я правильно отправляю платежный адрес и название компании при создании счета, но они не отображаются в созданном счете. Ниже приведен соответствующий фрагмент кода:
Код: Выделить всё
require 'vendor/autoload.php';
class QuadernoService
{
private $apiKey;
private $apiUrl;
public function __construct()
{
$this->apiKey = QUADERNO_KEY;
$this->apiUrl = QUADERNO_URL;
QuadernoBase::init($this->apiKey, $this->apiUrl);
}
public function createInvoice($transactionDetails, $items = [])
{
$transaction = new QuadernoTransaction($transactionDetails);
$transaction->items = $items; // Assign items to the transaction
$transaction_data = $transaction->save();
$response = [
"invoice_number" => null,
"invoice_url" => null
];
if ($transaction_data) {
$response = [
"invoice_url" => str_replace('http://', 'https://', $transaction->pdf),
"invoice_number" => $transaction->number
];
}
return $response;
}
public function handleInvoiceCreation($transaction_data)
{
global $core;
$Customer = $core->get_row('customers', '*', "WHERE CID = " . $transaction_data['customer_id']);
$items = [
[
'description' => 'Linkingpress credits for guest posts and/or press releases',
'quantity' => 1,
'amount' => floatval($transaction_data['amount'])
]
];
$transactionDetails = [
'type' => 'sale',
'payment' => [
'method' => 'credit_card',
'processor' => $transaction_data['payment_method'],
'processor_id' => $transaction_data['transaction_id']
],
'currency' => 'USD',
'notes' => 'Description or notes here',
'company_name' => 'Your Business Name' // Company name
];
if ($Customer) {
$transactionDetails['customer'] = [
'first_name' => $Customer->firstname,
'last_name' => $Customer->lastname,
'email' => $Customer->email,
'billing_address' => [
'address1' => 'Street Name',
'city' => 'City Name',
'postal_code' => 'Postal Code',
'country' => 'Country Code'
]
];
}
// Create the invoice
$response = $this->createInvoice($transactionDetails, $items);
$transaction_data['invoice_url'] = $response['invoice_url'];
$transaction_data['invoice_number'] = $response['invoice_number'];
return $transaction_data;
}
}
Я отправил индекс платежного адреса, а также попробовал отправить платежный адрес внутри клиента. Но это не работает.
Подробнее здесь:
https://stackoverflow.com/questions/790 ... no-invoice
1728887318
Anonymous
Я использую пакет Quaderno PHP Composer для создания счетов в своем приложении. Я правильно отправляю платежный адрес и название компании при создании счета, но они не отображаются в созданном счете. Ниже приведен соответствующий фрагмент кода: [code] require 'vendor/autoload.php'; class QuadernoService { private $apiKey; private $apiUrl; public function __construct() { $this->apiKey = QUADERNO_KEY; $this->apiUrl = QUADERNO_URL; QuadernoBase::init($this->apiKey, $this->apiUrl); } public function createInvoice($transactionDetails, $items = []) { $transaction = new QuadernoTransaction($transactionDetails); $transaction->items = $items; // Assign items to the transaction $transaction_data = $transaction->save(); $response = [ "invoice_number" => null, "invoice_url" => null ]; if ($transaction_data) { $response = [ "invoice_url" => str_replace('http://', 'https://', $transaction->pdf), "invoice_number" => $transaction->number ]; } return $response; } public function handleInvoiceCreation($transaction_data) { global $core; $Customer = $core->get_row('customers', '*', "WHERE CID = " . $transaction_data['customer_id']); $items = [ [ 'description' => 'Linkingpress credits for guest posts and/or press releases', 'quantity' => 1, 'amount' => floatval($transaction_data['amount']) ] ]; $transactionDetails = [ 'type' => 'sale', 'payment' => [ 'method' => 'credit_card', 'processor' => $transaction_data['payment_method'], 'processor_id' => $transaction_data['transaction_id'] ], 'currency' => 'USD', 'notes' => 'Description or notes here', 'company_name' => 'Your Business Name' // Company name ]; if ($Customer) { $transactionDetails['customer'] = [ 'first_name' => $Customer->firstname, 'last_name' => $Customer->lastname, 'email' => $Customer->email, 'billing_address' => [ 'address1' => 'Street Name', 'city' => 'City Name', 'postal_code' => 'Postal Code', 'country' => 'Country Code' ] ]; } // Create the invoice $response = $this->createInvoice($transactionDetails, $items); $transaction_data['invoice_url'] = $response['invoice_url']; $transaction_data['invoice_number'] = $response['invoice_number']; return $transaction_data; } } [/code] Я отправил индекс платежного адреса, а также попробовал отправить платежный адрес внутри клиента. Но это не работает. Подробнее здесь: [url]https://stackoverflow.com/questions/79075581/issues-with-billing-address-and-company-name-not-displaying-on-quaderno-invoice[/url]