feat: add Shoppro payment status synchronization service
- Implemented ShopproPaymentStatusSyncService to handle payment status synchronization between Shoppro and Orderpro. - Added methods for resolving watched status codes, finding candidate orders, and syncing individual order payments. - Introduced ShopproStatusMappingRepository for managing status mappings between Shoppro and Orderpro. - Created ShopproStatusSyncService to facilitate synchronization of order statuses from Shoppro to Orderpro.
This commit is contained in:
@@ -538,6 +538,7 @@ final class OrdersController
|
||||
|
||||
private function shippingHtml(string $deliveryMethod, int $shipments, int $documents): string
|
||||
{
|
||||
$deliveryMethod = trim(html_entity_decode(strip_tags($deliveryMethod), ENT_QUOTES | ENT_HTML5, 'UTF-8'));
|
||||
$html = '<div class="orders-mini">';
|
||||
if ($deliveryMethod !== '' && !preg_match('/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i', $deliveryMethod)) {
|
||||
$html .= '<div class="orders-mini__delivery">' . htmlspecialchars($deliveryMethod, ENT_QUOTES, 'UTF-8') . '</div>';
|
||||
|
||||
@@ -420,9 +420,10 @@ final class OrdersRepository
|
||||
$addresses = [];
|
||||
}
|
||||
|
||||
$itemsMediaSql = $this->resolvedMediaUrlSql('oi');
|
||||
$itemsMediaSql = $this->resolvedMediaUrlSql('oi', 'o.source');
|
||||
$itemsStmt = $this->pdo->prepare('SELECT oi.*, ' . $itemsMediaSql . ' AS resolved_media_url
|
||||
FROM order_items oi
|
||||
INNER JOIN orders o ON o.id = oi.order_id
|
||||
WHERE oi.order_id = :order_id
|
||||
ORDER BY oi.sort_order ASC, oi.id ASC');
|
||||
$itemsStmt->execute(['order_id' => $orderId]);
|
||||
@@ -513,9 +514,10 @@ final class OrdersRepository
|
||||
|
||||
$placeholders = implode(',', array_fill(0, count($cleanIds), '?'));
|
||||
try {
|
||||
$resolvedMediaSql = $this->resolvedMediaUrlSql('oi');
|
||||
$resolvedMediaSql = $this->resolvedMediaUrlSql('oi', 'o.source');
|
||||
$sql = 'SELECT oi.order_id, oi.original_name, oi.quantity, ' . $resolvedMediaSql . ' AS media_url, oi.sort_order, oi.id
|
||||
FROM order_items oi
|
||||
INNER JOIN orders o ON o.id = oi.order_id
|
||||
WHERE oi.order_id IN (' . $placeholders . ')
|
||||
ORDER BY oi.order_id ASC, oi.sort_order ASC, oi.id ASC';
|
||||
$stmt = $this->pdo->prepare($sql);
|
||||
@@ -574,7 +576,7 @@ final class OrdersRepository
|
||||
. ')';
|
||||
}
|
||||
|
||||
private function resolvedMediaUrlSql(string $itemAlias): string
|
||||
private function resolvedMediaUrlSql(string $itemAlias, string $sourceAlias = '"allegro"'): string
|
||||
{
|
||||
if (!$this->canResolveMappedMedia()) {
|
||||
return 'COALESCE(NULLIF(TRIM(' . $itemAlias . '.media_url), ""), "")';
|
||||
@@ -587,7 +589,7 @@ final class OrdersRepository
|
||||
FROM product_channel_map pcm
|
||||
INNER JOIN sales_channels sc ON sc.id = pcm.channel_id
|
||||
INNER JOIN product_images pi ON pi.product_id = pcm.product_id
|
||||
WHERE LOWER(sc.code) = "allegro"
|
||||
WHERE LOWER(sc.code) = LOWER(' . $sourceAlias . ')
|
||||
AND (
|
||||
pcm.external_product_id = ' . $itemAlias . '.external_item_id
|
||||
OR pcm.external_product_id = ' . $itemAlias . '.source_product_id
|
||||
|
||||
Reference in New Issue
Block a user