Beispiel #1
0
 /**
  * @param \XLite\Module\XC\PitneyBowes\Model\PBOrder    $pbOrder            Pitney Bowes order model
  * 
  * @return void
  */
 protected function createOrderHistoryEvent(\XLite\Module\XC\PitneyBowes\Model\PBOrder $pbOrder)
 {
     $createOrderResult = $pbOrder->getCreateOrderResponse();
     \XLite\Core\OrderHistory::getInstance()->registerEvent($this->getOrderId(), 'PB_SHIPPING', 'PitneyBowes shipping order created', array(), '', array(array('name' => 'Grand total', 'value' => $createOrderResult->order->total->value), array('name' => 'Order ID', 'value' => $pbOrder->getOrmus()), array('name' => 'Total transportation', 'value' => $createOrderResult->order->totalTransportation->total->value), array('name' => 'Total importation', 'value' => $createOrderResult->order->totalImportation->total->value), array('name' => 'Expire date', 'value' => $createOrderResult->expireDate), array('name' => 'Hub address', 'value' => $this->postprocessHubAddress($createOrderResult->shipToHub)), array('name' => 'Delivery time', 'value' => $this->postprocessDeliveryTime($createOrderResult->order))));
 }
 protected function getTransactionId()
 {
     $pbOrder = $this->inputData->getOrder()->getPbOrder();
     return $pbOrder ? $pbOrder->getTransactionId() : \XLite\Module\XC\PitneyBowes\Model\PBOrder::generateTransactionId();
 }
 /**
  * https://wiki.ecommerce.pb.com/display/TECH4/Confirm+Order
  * 
  * @param \XLite\Module\XC\PitneyBowes\Model\PBOrder
  * 
  * @return mixed
  */
 public function confirmOrder(\XLite\Module\XC\PitneyBowes\Model\PBOrder $inputData)
 {
     $url = static::getApiURL($this->config, 'checkout_api_endpoint') . '/orders/' . $inputData->getOrmus() . '/confirm';
     $request = new API\Request\ConfirmOrderRequest($url, $inputData);
     $inputMapper = new Mapper\ConfirmOrder\InputMapper($this->config);
     $request->setInputMapper($inputMapper);
     $request->setOutputMapper(new Mapper\ConfirmOrder\OutputMapper($this->config));
     $auth = $this->getAuth();
     $request->setAuth($auth['type'], $auth['value']);
     $request->sendRequest();
     \XLite\Module\XC\PitneyBowes\Model\Shipping\Processor\PitneyBowes::logDebug('confirmOrder API called with: ' . PHP_EOL . 'URL: ' . $url . PHP_EOL . 'Request: ' . $request->getRawRequest() . PHP_EOL . 'Response: ' . $request->getRawResponse() . PHP_EOL);
     return $request->getResponse();
 }