예제 #1
0
 public function testCreate()
 {
     $shipmentLabel = new ShipmentLabel();
     $shipmentLabel->setExternalId('pl_af0ec9e7299a42b3af5adaa3e18ff7fy');
     $shipmentLabel->setResolution(300);
     $shipmentLabel->setSize('4x6');
     $shipmentLabel->setType('default');
     $shipmentLabel->setFileType('image/png');
     $shipmentLabel->setUrl('http://assets.example.com/file.png');
     $shipmentLabel->setPdfUrl('http://assets.example.com/file.pdf');
     $shipmentLabel->setEpl2Url('http://assets.example.com/file.epl2');
     $shipmentLabel->setZplUrl('http://assets.example.com/file.zpl');
     $this->assertEntityValid($shipmentLabel);
     $this->assertSame('pl_af0ec9e7299a42b3af5adaa3e18ff7fy', $shipmentLabel->getExternalId());
     $this->assertSame(300, $shipmentLabel->getResolution());
     $this->assertSame('4x6', $shipmentLabel->getSize());
     $this->assertSame('default', $shipmentLabel->getType());
     $this->assertSame('image/png', $shipmentLabel->getFileType());
     $this->assertSame('http://assets.example.com/file.png', $shipmentLabel->getUrl());
     $this->assertSame('http://assets.example.com/file.pdf', $shipmentLabel->getPdfUrl());
     $this->assertSame('http://assets.example.com/file.epl2', $shipmentLabel->getEpl2Url());
     $this->assertSame('http://assets.example.com/file.zpl', $shipmentLabel->getZplUrl());
 }
예제 #2
0
 public function getShipmentLabel()
 {
     $shipmentLabel = new ShipmentLabel();
     $shipmentLabel->setExternalId('pl_' . $this->getRandomToken());
     $shipmentLabel->setResolution(300);
     $shipmentLabel->setSize('4x6');
     $shipmentLabel->setType('default');
     $shipmentLabel->setFileType('image/png');
     $shipmentLabel->setUrl('http://assets.geteasypost.com/postage_labels/labels/0jvZJy.png');
     return $shipmentLabel;
 }
예제 #3
0
 private function getShipmentLabelFromEasyPostShipment($shipment)
 {
     $label = $shipment->postage_label;
     $shipmentLabel = new ShipmentLabel();
     $shipmentLabel->setExternalId($label->id);
     $shipmentLabel->setResolution($label->label_resolution);
     $shipmentLabel->setSize($label->label_size);
     $shipmentLabel->setType($label->label_type);
     $shipmentLabel->setUrl($label->label_url);
     $shipmentLabel->setFileType($label->label_file_type);
     $shipmentLabel->setPdfUrl($label->label_pdf_url);
     $shipmentLabel->setEpl2Url($label->label_epl2_url);
     $shipmentLabel->setZplUrl($label->zpl_url);
     return $shipmentLabel;
 }