update email template
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Integrations\Whmcs\Writers;
|
||||
|
||||
use App\Integrations\Whmcs\DTOs\OrderItemData;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class OrderItemWriter
|
||||
{
|
||||
/**
|
||||
* Skips items whose order couldn't be resolved — order_items.order_id is NOT NULL.
|
||||
* Requires whmcs:sync-orders to have already run.
|
||||
*/
|
||||
public function write(OrderItemData $data): bool
|
||||
{
|
||||
if ($data->orderId === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
DB::table('order_items')->updateOrInsert(
|
||||
['legacy_id' => $data->legacyId],
|
||||
[
|
||||
'order_id' => $data->orderId,
|
||||
'product_id' => $data->productId,
|
||||
'product_pricing_id' => $data->productPricingId,
|
||||
'server_name' => $data->serverName,
|
||||
'domain_name' => $data->domainName,
|
||||
'billing_cycle' => $data->billingCycle,
|
||||
'months' => $data->months,
|
||||
'quantity' => $data->quantity,
|
||||
'price' => $data->price,
|
||||
'created_at' => $data->createdAt,
|
||||
'updated_at' => $data->updatedAt,
|
||||
]
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user