Пример #1
0
 /**
  * @param array $items
  * @return array
  * @throws \Exception
  */
 public function bulk($items)
 {
     if (!is_array($items)) {
         throw new \Exception('Items is not an array', 1466349189);
     }
     $schema = ['/MPItemFeed/MPItem' => ['sendItemsAs' => 'MPItem', 'includeWrappingTag' => false]];
     $a2x = new A2X($items, $schema);
     $xml = $a2x->asXml();
     $file = new PostFile('file', $xml, 'file.xml', ['Content-Type' => 'text/xml']);
     return $this->bulkUpdate(['file' => $file]);
 }
Пример #2
0
 /**
  * @param array $items
  * @return array
  * @throws \Exception
  */
 public function bulk($items)
 {
     if (!is_array($items)) {
         throw new \Exception('Items is not an array', 1466349195);
     }
     $schema = ['/PriceFeed/Price' => ['sendItemsAs' => 'Price', 'includeWrappingTag' => false], '/PriceFeed/Price/Price/pricingList/pricing' => ['attributes' => ['effectiveDate', 'expirationDate']], '/PriceFeed/Price/Price/pricingList/pricing/currentPrice/value' => ['attributes' => ['currency', 'amount']], '/PriceFeed/Price/Price/pricingList/pricing/comparisonPrice/value' => ['attributes' => ['currency', 'amount']], '/PriceFeed/Price/Price/pricingList/pricing/priceDisplayCode' => ['attributes' => ['submapType']]];
     $a2x = new A2X($items, $schema);
     $xml = $a2x->asXml();
     $file = new PostFile('file', $xml, 'file.xml', ['Content-Type' => 'text/xml']);
     return $this->bulkUpdate(['file' => $file]);
 }
Пример #3
0
 /**
  * Refund an order
  * @param string $purchaseOrderId
  * @param array $order
  * @return array
  * @throws \Exception
  */
 public function refund($purchaseOrderId, $order)
 {
     if (!is_numeric($purchaseOrderId)) {
         throw new \Exception("purchaseOrderId must be numeric", 1448480783);
     }
     $schema = ['/orderRefund' => ['namespace' => 'ns3', 'childNamespace' => 'ns3'], '/orderRefund/orderLines' => ['sendItemsAs' => 'orderLine'], '/orderRefund/orderLines/orderLine/refunds' => ['sendItemsAs' => 'refund'], '/orderRefund/orderLines/orderLine/refunds/refund/refundCharges' => ['sendItemsAs' => 'refundCharge'], '@namespaces' => ['ns3' => 'http://walmart.com/mp/v3/orders']];
     $a2x = new A2X($order, $schema);
     $xml = $a2x->asXml();
     return $this->refundOrder(['purchaseOrderId' => $purchaseOrderId, 'order' => $xml]);
 }