/** * Send an order transaction to be analyzed by FControl. * @param Order $order Order to be publish. * @return PublishResponse Service response success true when adds on queue your transaction. */ public function publish(Order $order) { $order->setAuthentication(Authentication::createFromConfiguration($this->getConfiguration())); $order->setTest($this->getConfiguration()->isTest()); $response = $this->__soapCall('enfileirarTransacao9', array(array('pedido' => $order->toArray()))); return new PublishResponse($response); }
/** * It will simulate a send order transaction to be analyzed by FControl. * @param Order $order Order to be publish. * @return PublishResponse For Success Response, try to send Order EVEN Grand Total otherwise ODD Grand Total */ public function publish(Order $order) { $serviceResponse = new PublishFailed($order); if ($order->getGrandTotal() % 2 == 0) { $serviceResponse = new PublishSuccessful($order); } return new PublishResponse($serviceResponse); }
public function __construct() { $products = ProductCollection::createRandomProducts(1); parent::__construct(rand(1, 9999), new \DateTime('now'), $products->getGrandTotal(), new Buyer(), new Delivery(), PaymentCollection::createCreditCardPayment($products->getGrandTotal()), $products, new Status(Status::PENDING), true, Order::INTEGRATOR_CODE_UNKNOWN); $this->addExtraData(null); $this->addExtraData(null); $this->addExtraData(null); $this->addExtraData(null); $this->setSalesChannel('Internet'); $this->setFreightTotal(0); $this->setDeliveryType('Sedex'); $this->setDeliveryDate(new \DateTime('2013-08-29 00:00:00')); }