コード例 #1
0
ファイル: Calculation.php プロジェクト: rolice/speedy
 public static function createFromSoapResponse($response)
 {
     $amounts = Amount::createFromSoapResponse($response->amounts);
     $takingDate = static::ParseDate($response->takingDate);
     $deadlineDelivery = static::ParseDate($response->deadlineDelivery);
     $partialDiscount = !!$response->partialDiscount;
     if (!$amounts instanceof Collection || !$takingDate || !$deadlineDelivery) {
         throw new SpeedyException('Invalid calculation result data detected.');
     }
     return new static($amounts, $takingDate, $deadlineDelivery, $partialDiscount);
 }
コード例 #2
0
ファイル: BOL.php プロジェクト: rolice/speedy
 public static function createFromSoapResponse($response)
 {
     $result = new static();
     $result->generatedParcels = ParcelInfo::createFromSoapResponse($response->generatedParcels);
     $result->amounts = Amount::createFromSoapResponse($response->amounts);
     $result->deadlineDelivery = static::ParseDate($result->deadlineDelivery);
     if (!$result->generatedParcels || $result->generatedParcels->isEmpty()) {
         throw new SpeedyException('Invalid bill of lading (BOL/waybill detected) - no parcel info found.');
     }
     if (!$result->amounts || !$result->deadlineDelivery) {
         throw new SpeedyException('Invalid bill of lading (BOL/waybill detected) - no amount or deadline found.');
     }
     return $result;
 }