Esempio n. 1
0
 public function issue(WaybillRequest $request)
 {
     $data = $request->all();
     $client = Client::createFromArray($data);
     if (!$client) {
         return null;
     }
     /**
      * @var Speedy $speedy
      */
     $speedy = app('speedy');
     $speedy->user($client);
     $picking = Picking::createFromRequest($data);
     $waybill = $speedy->createBillOfLading($picking);
     if (!isset($waybill->return) || !$waybill->return) {
         throw new SpeedyException('Invalid bill of lading (BOL/waybill) detected.');
     }
     $waybill = BOL::createFromSoapResponse($waybill->return);
     return response()->json($waybill);
 }
Esempio n. 2
0
 public function createBillOfLading(Picking $picking)
 {
     $response = $this->call('createBillOfLading', ['sessionId' => $this->user->sessionId(), 'picking' => $picking->toArray()]);
     return $response;
 }