Remove outdated edge gateway object classes, add new agent implementation
Transitioned from obsolete gateway object classes (`edge_gateway_shell_action_jobs_o`, `edge_gateway_shell_events_o`, `edge_gateway_shell_sessions_o`, `edge_gateway_update_jobs_o`) to the new agent implementation (`edge-gateway-agent/agent.php`).
This commit is contained in:
+28
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace config;
|
||||
|
||||
use traits\module_config_variable;
|
||||
|
||||
class economic_transaction_draft_customer_number_c
|
||||
{
|
||||
use module_config_variable;
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
self::setupConfigVariable(
|
||||
'economic',
|
||||
'transactionDraftCustomerNumber',
|
||||
'int',
|
||||
false,
|
||||
null,
|
||||
'Customer number used for transaction drafts that must not export to e-conomic',
|
||||
'99999999',
|
||||
false,
|
||||
null
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -4,12 +4,14 @@ require_once WD . '/modules/economic/config/economic_payment_terms_c.php';
|
||||
require_once WD . '/modules/economic/config/economic_admin_fee_monthly_c.php';
|
||||
require_once WD . '/modules/economic/config/economic_admin_fee_order_c.php';
|
||||
require_once WD . '/modules/economic/config/economic_fee_product_id_c.php';
|
||||
require_once WD . '/modules/economic/config/economic_transaction_draft_customer_number_c.php';
|
||||
|
||||
use config\economic_invoice_layout_c;
|
||||
use config\economic_payment_terms_c;
|
||||
use config\economic_admin_fee_monthly_c;
|
||||
use config\economic_admin_fee_order_c;
|
||||
use config\economic_fee_product_id_c;
|
||||
use config\economic_transaction_draft_customer_number_c;
|
||||
use traits\module_config_t;
|
||||
|
||||
class economic_c
|
||||
@@ -21,6 +23,7 @@ class economic_c
|
||||
public economic_admin_fee_monthly_c $admin_fee_monthly;
|
||||
public economic_admin_fee_order_c $admin_fee_order;
|
||||
public economic_fee_product_id_c $fee_product_id;
|
||||
public economic_transaction_draft_customer_number_c $transaction_draft_customer_number;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@@ -30,12 +33,14 @@ class economic_c
|
||||
economic_payment_terms_c::class,
|
||||
economic_admin_fee_monthly_c::class,
|
||||
economic_admin_fee_order_c::class,
|
||||
economic_fee_product_id_c::class
|
||||
economic_fee_product_id_c::class,
|
||||
economic_transaction_draft_customer_number_c::class,
|
||||
]);
|
||||
$this->invoice_layout = new economic_invoice_layout_c();
|
||||
$this->payment_terms = new economic_payment_terms_c();
|
||||
$this->admin_fee_monthly = new economic_admin_fee_monthly_c();
|
||||
$this->admin_fee_order = new economic_admin_fee_order_c();
|
||||
$this->fee_product_id = new economic_fee_product_id_c();
|
||||
$this->transaction_draft_customer_number = new economic_transaction_draft_customer_number_c();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,14 @@ class stripe_endpoint_invoice
|
||||
return self::getClient()->invoices->retrieve($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws ApiErrorException
|
||||
*/
|
||||
public function void(string $id): Invoice
|
||||
{
|
||||
return self::getClient()->invoices->voidInvoice($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws ApiErrorException
|
||||
* @throws Exception
|
||||
@@ -53,13 +61,47 @@ class stripe_endpoint_invoice
|
||||
return $this->create(
|
||||
$line_items,
|
||||
$stripe_customer_id,
|
||||
[
|
||||
'order_id' => $order_id,
|
||||
'customer_id' => $stripe_customer_id
|
||||
]
|
||||
$this->buildOrderMetadata($order, $stripe_customer_id)
|
||||
);
|
||||
}
|
||||
|
||||
private function buildOrderMetadata(orders_o $order, string $stripe_customer_id): array
|
||||
{
|
||||
$metadata = [
|
||||
'order_id' => (string)$order->id,
|
||||
'customer_id' => (string)$order->customer_id->value(),
|
||||
'stripe_customer_id' => $stripe_customer_id,
|
||||
'department_id' => (string)$order->department_id->value(),
|
||||
];
|
||||
|
||||
$reference = trim((string)$order->reference->value());
|
||||
if ($reference !== '') {
|
||||
$metadata['reference'] = $reference;
|
||||
}
|
||||
|
||||
$po = trim((string)$order->po->value());
|
||||
if ($po !== '') {
|
||||
$metadata['po'] = $po;
|
||||
}
|
||||
|
||||
$reg1 = trim((string)$order->reg_1->value());
|
||||
if ($reg1 !== '') {
|
||||
$metadata['reg_1'] = $reg1;
|
||||
}
|
||||
|
||||
$reg2 = trim((string)$order->reg_2->value());
|
||||
if ($reg2 !== '') {
|
||||
$metadata['reg_2'] = $reg2;
|
||||
}
|
||||
|
||||
$reg3 = trim((string)$order->reg_3->value());
|
||||
if ($reg3 !== '') {
|
||||
$metadata['reg_3'] = $reg3;
|
||||
}
|
||||
|
||||
return $metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new payment link
|
||||
* @param stripe_line_items $line_items
|
||||
@@ -96,4 +138,4 @@ class stripe_endpoint_invoice
|
||||
return $invoice->finalizeInvoice();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user