/** * Retrieves the payment details for an active escrow. * * @param object $order The Order object * @param array $options User inputted options * * @return array An assoaciative array with the payment details */ public function get_details(APP_Escrow_Order $order, array $options) { $pay_key = $order->get_data('pay_key'); $pp_adaptive_request = new APP_PayPal_Adaptive_Request($options); return $pp_adaptive_request->get_payment_details($order, $pay_key); }
/** * Retrieves details for an escrow order. * * @param APP_Escrow_Order $order The order object * * @return bool|mixed The details for the order or False if no details found */ function appthemes_get_escrow_details(APP_Escrow_Order $order) { $gateway_id = $order->get_gateway(); $gateway = APP_Gateway_Registry::get_gateway($gateway_id); if ($gateway && (APP_Gateway_Registry::is_gateway_enabled($gateway_id) || current_user_can('manage_options'))) { if (!$gateway instanceof APP_Escrow_Payment_Processor) { return false; } $options = APP_Gateway_Registry::get_gateway_options($gateway_id); return $gateway->get_details($order, $options); } else { return false; } }
protected function get_receivers(APP_Escrow_Order $order) { $receiver_list = array(); $receivers = $order->get_receivers(); if (empty($receivers)) { $this->fail_order(__('PayPal was unable to verify the payment receivers. Please contact site owner.', APP_TD)); $order->log(sprintf('The following error ocurred while trying to execute the payment: "%s"', 'Receivers list is empty')); return false; } // add the primary receiver - site owner $receivers[1] = $order->get_total(); // sort the receivers - primary receiver should be the first in the list ksort($receivers); $key = 0; foreach ($receivers as $user_id => $amount) { // primary receiver is the site owner if (0 == $key) { $paypal_email = $this->options['paypal_email']; } else { // email field name from the user personal settings $email_field = self::EMAIL_META_KEY; $user = get_user_by('id', $user_id); $paypal_email = get_user_option($email_field, $user_id); $order->log(sprintf(__('Added user \'%1$s\' with email \'%2$s\' as receiver', APP_TD), $user->display_name, $paypal_email)); } $receiver_list[$key] = array('email' => $paypal_email, 'amount' => (double) $amount, 'primary' => $key == 0); $key++; } return $receiver_list; }