public function createOrder Vaimo_Konga_Model_Sa les_Order order array

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
public function createOrder(Vaimo_Konga_Model_Sales_Order $order, array $offers)
{
$billingAddress = $order->getBillingAddress();
$shippingAddress = $order->getShippingAddress();
$data = array(
'commercial_id' => $order->getIncrementId(),
'customer' => array(
'billing_address' => array(
'city' => $billingAddress->getCity(),
'country' => $billingAddress->getCountry(),
'firstname' => $billingAddress->getFirstname(),
'lastname' => $billingAddress->getLastname(),
'phone' => $billingAddress->getTelephone(),
'street_1' => $billingAddress->getStreet1(),
'street_2' => $billingAddress->getRegionCode(),
'zip_code' => Mage::getModel('dropshipareas/area')
->load($billingAddress->getArea())
->getName(),
),
'customer_id' => $order->getCustomerId(),
'email' => $order->getCustomerEmail(),
'firstname' => $order->getCustomerFirstname(),
'lastname' => $order->getCustomerLastname(),
'shipping_address' => array(
'city' => $shippingAddress->getCity(),
'country' => $shippingAddress->getCountry(),
'firstname' => $shippingAddress->getFirstname(),
'lastname' => $shippingAddress->getLastname(),
'phone' => $shippingAddress->getTelephone(),
'street_1' => $shippingAddress->getStreet1(),
'street_2' => $shippingAddress->getRegionCode(),
'zip_code' => Mage::getModel('dropshipareas/area')
->load($shippingAddress->getArea())
->getName(),
'internal_additional_info' => $shippingAddress->getLandmark()
)
),
'offers' => $offers,
'scored' => 'true',
'shipping_zone_code' => $shippingAddress->getRegionId(),
'payment_info' => array(
'payment_type' => $this->getMiraklPaymentStatus($order)
)
);
return $this->_getAdapter()
->setApiCode('OR01')
->setParams($data)
->execute();
}