/** * @param \SimpleXMLElement $order * @param ShopifyOrderEntity $shopifyOrder * @return ErpOrderEntity */ public static function createFromShopifyOrder(\SimpleXMLElement $order, ShopifyOrderEntity $shopifyOrder) { $self = new self(); $self->orderId = (string) $order->OrderNumber; $self->shopifyOrderId = $shopifyOrder->getId(); return $self; }
/** * @param StoreEntity $store * @param ShopifyOrderEntity $order * @return ShopifyTransactionEntity|null */ public function getTransaction(StoreEntity $store, ShopifyOrderEntity $order) { $this->setSettings($store); $response = $this->client->getTransactions(['order_id' => $order->getId()]); $orderTransaction = null; if ($response['transactions']) { foreach ($response['transactions'] as $transaction) { if ($transaction['kind'] == ShopifyTransactionEntity::KIND_AUTHORIZATION || $transaction['kind'] == ShopifyTransactionEntity::KIND_CAPTURE) { $orderTransaction = ShopifyTransactionEntity::createFromTransactionResponse($transaction); $order->setTransaction($orderTransaction); break; } } } }