/** * Get PayPro sale status from payment hash * Only usable on an WooCommerce API call */ public function getSaleStatusFromPaymentHashes($payment_hashes) { // Get status of this order from PayPro API $results = array(); foreach ($payment_hashes as $payment_hash) { $result = PayPro_WC_Plugin::$paypro_api->getSaleStatus($payment_hash); if ($result['errors']) { PayPro_WC_Plugin::debug(__CLASS__ . ': Failed to get sale status from PayPro API - message: ' . $result['message'] . ', payment_hash: ' . $payment_hash); } else { array_push($results, array('hash' => $payment_hash, 'status' => $result['data']['current_status'])); } } // Could not get status, so throw and log if (empty($results)) { header(' ', true, 500); PayPro_WC_Plugin::debug(__CLASS__ . ': Could not get the status for these payment hashes: ' . implode(', ', $payment_hashes)); exit; } return $this->determineSaleStatus($results); }
/** * Checks if the gateway is valid and ready for use */ protected function isValid() { if (!PayPro_WC_Plugin::$settings->apiKey() && $this->enabled === 'yes') { PayPro_WC_Plugin::debug($this->id . ': Cannot enable PayPro payment methods without setting the API key first.'); return false; } return true; }