Feature: Add ACS courier integration
ACS rate driver (live price quotes via ACS_Price_Calculation, cached postcode-to-station lookups) and fulfillment service (voucher creation, label printing, end-of-day pickup manifest). Adds a per-rate pricing_mode column so admins can choose live API pricing vs. a fixed price on ACS-driven shipping rates, surfaced via a custom Rates page.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Core\Shipping\Carriers\Acs;
|
||||
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class AcsClient
|
||||
{
|
||||
public function __construct(private readonly array $config) {}
|
||||
|
||||
public function call(string $alias, array $parameters = []): AcsResponse
|
||||
{
|
||||
$response = Http::withHeaders([
|
||||
'AcsApiKey' => $this->config['api_key'],
|
||||
])
|
||||
->timeout($this->config['timeout'])
|
||||
->post($this->config['base_url'], [
|
||||
'ACSAlias' => $alias,
|
||||
'ACSInputParameters' => array_merge($this->credentialParams(), $parameters),
|
||||
]);
|
||||
|
||||
return AcsResponse::fromHttpResponse($response);
|
||||
}
|
||||
|
||||
private function credentialParams(): array
|
||||
{
|
||||
return [
|
||||
'Company_ID' => $this->config['company_id'],
|
||||
'Company_Password' => $this->config['company_password'],
|
||||
'User_ID' => $this->config['user_id'],
|
||||
'User_Password' => $this->config['user_password'],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user