getPsOrders($paypalOrder); if (empty($psOrders)) { return false; } /* @var $psOrder \Order*/ foreach ($psOrders as $psOrder) { if (empty($psOrder->getHistory(\Context::getContext()->language->id, $idStatus)) == false) { continue; } if (in_array($idStatus, array((int)\Configuration::get('PS_OS_REFUND'), (int)\Configuration::get('PAYPAL_OS_REFUNDED_PAYPAL')))) { $paypalOrder->payment_status = 'refunded'; $paypalOrder->save(); } $psOrder->setCurrentState($idStatus); } return true; } /** * @param $paypalOrder \PaypalOrder object * @return \PaypalCapture object */ public function getCapture($paypalOrder) { $collection = new \PrestaShopCollection('PaypalCapture'); $collection->where('id_paypal_order', '=', $paypalOrder->id); return $collection->getFirst(); } /** * @param $transactionId string id of the Prestashop Customer object * @return \PaypalOrder */ public function getPaypalOrderByTransaction($transactionId) { $collection = new \PrestaShopCollection('PaypalOrder'); $collection->where('id_transaction', '=', $transactionId); return $collection->getFirst(); } /** * @param $paypalOrder \PaypalOrder object * @return array of the Order objects */ public function getPsOrders($paypalOrder) { $collection = new \PrestaShopCollection('Order'); $collection->where('id_cart', '=', $paypalOrder->id_cart); return $collection->getResults(); } }