protected function validatePackage(Package $package, RateAdapter $adapter)
 {
     $shipment = new Shipment();
     $shipment->setFromStateProvinceCode('CA')->setFromPostalCode('90401')->setFromCountryCode('US')->setFromIsResidential(true)->setToPostalCode('78703')->setToCountryCode('US')->setToIsResidential(true)->addPackage($package);
     $adapter->setShipment($shipment);
     $adapter->getRates();
 }
Beispiel #2
0
 public function setUp()
 {
     $s = new Shipment();
     $s->setFromStateProvinceCode('CA')->setFromPostalCode('90401')->setFromCountryCode('US')->setFromIsResidential(true)->setToPostalCode('78703')->setToCountryCode('US')->setToIsResidential(true);
     $p = new Package();
     $p->setWeight(3)->setWidth(9)->setLength(9)->setHeight(9);
     $s->addPackage($p);
     $this->shipment = $s;
 }
Beispiel #3
0
 public function setUp()
 {
     $ship = Ship::factory(['Standard Shipping' => ['ups' => ['03' => '1-5 business days']], 'Two-Day Shipping' => ['ups' => ['02' => '2 business days']], 'One-Day Shipping' => ['ups' => ['01' => 'next business day 10:30am', '13' => 'next business day by 3pm', '14' => 'next business day by 8am']]]);
     $this->approvedCodes = $ship->getApprovedCodes('ups');
     $package = new Package();
     $package->setWeight(3)->setWidth(9)->setLength(9)->setHeight(9);
     $this->shipment = new Shipment();
     $this->shipment->setFromStateProvinceCode('CA')->setFromPostalCode('90401')->setFromCountryCode('US')->setFromIsResidential(true)->setToPostalCode('78703')->setToCountryCode('US')->setToIsResidential(true)->addPackage($package);
 }
Beispiel #4
0
 public function setUp()
 {
     $ship = Ship::factory(['Standard Shipping' => ['fedex' => ['FEDEX_EXPRESS_SAVER' => '1-3 business days', 'FEDEX_GROUND' => '1-5 business days', 'GROUND_HOME_DELIVERY' => '1-5 business days']], 'Two-Day Shipping' => ['fedex' => ['FEDEX_2_DAY' => '2 business days']], 'One-Day Shipping' => ['fedex' => ['STANDARD_OVERNIGHT' => 'overnight']]]);
     $this->approvedCodes = $ship->getApprovedCodes('fedex');
     $package = new Package();
     $package->setWeight(3)->setWidth(9)->setLength(9)->setHeight(9);
     $this->shipment = new Shipment();
     $this->shipment->setFromStateProvinceCode('CA')->setFromPostalCode('90401')->setFromCountryCode('US')->setFromIsResidential(true)->setToPostalCode('78703')->setToCountryCode('US')->setToIsResidential(true)->addPackage($package);
 }
Beispiel #5
0
 /**
  * @throws \LogicException
  * To be called from validate() when packages have to have 3 dimensions and weight
  */
 protected function validatePackages()
 {
     foreach ($this->shipment->getPackages() as $package) {
         Validator::checkIfNull($package->getWeight(), 'weight');
         Validator::checkIfNull($package->getLength(), 'length');
         Validator::checkIfNull($package->getHeight(), 'height');
         Validator::checkIfNull($package->getWidth(), 'width');
     }
 }
Beispiel #6
0
 public function setUp()
 {
     $ship = Ship::factory(['Standard Shipping' => ['usps' => ['1' => '1-3 business days', '4' => '2-8 business days']]]);
     $this->approvedCodes = $ship->getApprovedCodes('usps');
     $package = new Package();
     $package->setWeight(3)->setWidth(9)->setLength(9)->setHeight(9);
     $this->shipment = new Shipment();
     $this->shipment->setFromStateProvinceCode('CA')->setFromPostalCode('90401')->setFromCountryCode('US')->setToPostalCode('78703')->setToCountryCode('US')->setToIsResidential(true)->addPackage($package);
 }