Fix crm arcadia job

This commit is contained in:
Jérémy Munsch 2022-08-23 07:52:35 +00:00 • committed by Vincent BRIDIER
parent a384d57492
commit be309f3766
4 changed files with 606 additions and 840 deletions

View file

@ -17,7 +17,8 @@
"titleBar.activeBackground": "#0f437e",
"titleBar.activeForeground": "#e7e7e7",
"titleBar.inactiveBackground": "#0f437e99",
"titleBar.inactiveForeground": "#e7e7e799"
"titleBar.inactiveForeground": "#e7e7e799",
"commandCenter.border": "#e7e7e799"
},
"peacock.remoteColor": "#0f437e"
}

View file

@ -11,6 +11,8 @@ use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Log;
use Illuminate\Validation\ValidationException;
use Kwaadpepper\ExceptionHandler\Exceptions\ExceptionHandler;
use LDC\LDCCRM\Enums\ArcadiaOrderType;
use LDC\LDCCRM\Models\ArcadiaMailDefault;
@ -26,7 +28,7 @@ class SendOrderToArchadia implements ShouldQueue
/**
* Create a new job instance.
*
* @param \App\Models\Order $order
* @return void
*/
public function __construct(Order $order)
@ -45,16 +47,17 @@ class SendOrderToArchadia implements ShouldQueue
$this->order->deliveryAddress : $this->order;
foreach ($this->order->sellItems as $sellItem) {
for ($i = 0; $i < $sellItem->pivot->quantity; $i++) {
// init CRM API
try {
// * init CRM API
app('crmAPI');
$mail = new ArcadiaMailDefault([
// mettre valeur dans .env
'operation' => env('BOUTIQUE_ARCHADIA_OP_CODE', 16),
// * mettre valeur dans .env
'operation' => \intval(env('BOUTIQUE_ARCHADIA_OP_CODE', 16)),
'support_code' => $sellItem->archadia_id,
'label_type_support' => $sellItem->name,
// format : DD/MM/YYYY
// * format : DD/MM/YYYY
'order_date' => Carbon::parse($this->order->created_at)->format('Y/m/d H:i:s'),
// format 9 numeric characters
// * format 9 numeric characters
'order_num' => $this->order->id,
'state_order' => $this->order->payementType->equals(OrderType::cb()) ?
ArcadiaOrderType::cb() : ArcadiaOrderType::check(),
@ -68,6 +71,9 @@ class SendOrderToArchadia implements ShouldQueue
'phone' => $deliver->phone
]);
$mail->send();
} catch (ValidationException $e) {
ExceptionHandler::sendExceptionByEmailStatic($e);
} //end try
}//end for
}//end foreach

View file

@ -20,7 +20,7 @@
"guzzlehttp/guzzle": "^7.4",
"htmlmin/htmlmin": "^8.0",
"kwaadpepper/enum": "^2.1",
"kwaadpepper/exception-handler": "^0.0.6",
"kwaadpepper/exception-handler": "^0.1.0",
"kwaadpepper/image-resizer": "^0.1.0",
"kwaadpepper/refresh-sitemap": "^0.0.1",
"kwaadpepper/serial-int-caster": "^1.0",

1387
composer.lock generated

File diff suppressed because it is too large Load diff