示例#1
0
 /**
  * Displays the form for user redirection
  * @param  APP_Order $order   Order to process
  * @param  array $options     User inputted options
  * @return void
  */
 public static function create_form($order, $options, $return_url, $cancel_url)
 {
     $options = wp_parse_args($options, array('email_address' => ''));
     $fields = array(self::SELLER_EMAIL => $options['email_address'], self::ITEM_NAME => $order->get_description(), self::ITEM_NUMBER => $order->get_id(), self::CURRENCY_CODE => $order->get_currency(), self::RETURN_TEXT => sprintf(__('Continue to %s', APP_TD), get_bloginfo('name')), self::RETURN_URL => $return_url, self::CANCEL_URL => $cancel_url, self::NO_SHIPPING => 1, self::NO_NOTE => 1, self::RETURN_METHOD => self::RETURN_BY_GET, self::CHARSET => 'utf-8');
     if ($order->is_recurring()) {
         if (get_post_meta($order->get_id(), 'paypal_subscription_id', true)) {
             self::print_processing_script($order);
             return array();
         }
         $fields[self::TYPE] = self::SUBSCRIBE;
         $fields[self::RECURR_BILLING] = 1;
         $subscription_id = $order->get_id() . mt_rand(0, 1000);
         $fields[self::INVOICE] = $subscription_id;
         update_post_meta($order->get_id(), 'paypal_subscription_id', $subscription_id);
         $fields[self::RECURRING_AMOUNT] = $order->get_total();
         $recurring_period_info = self::get_recurring_period_info($order->get_recurring_period(), $order->get_recurring_period_type());
         $fields[self::RECURRING_PERIOD] = $recurring_period_info['recurring_period'];
         $fields[self::RECURRING_PERIOD_TYPE] = $recurring_period_info['recurring_period_type'];
     } else {
         $fields[self::TYPE] = self::BUY_NOW;
         $fields[self::AMOUNT] = $order->get_total();
     }
     if (!empty($options['ipn_enabled'])) {
         $fields[self::NOTIFY_URL] = APP_PayPal_IPN_Listener::get_listener_url();
     }
     $form = array('action' => APP_PayPal::get_request_url(), 'name' => 'paypal_payform', 'id' => 'create_listing');
     return array($form, $fields);
 }
示例#2
0
文件: test.php 项目: kalushta/darom
 /**
  * Adds general order sections to the fields displayed
  * See view_transaction()
  * @param  array $sections 	Sections already being displayed
  * @param  APP_Order $order Order being processed
  * @return array           	$sections with added sections
  */
 public function display_order($sections, $order)
 {
     $sections['General Information'] = array('ID' => $order->get_id());
     $sections['Money & Currency'] = array('Currency' => APP_Currencies::get_name($order->get_currency()) . ' (' . $order->get_currency() . ')', 'Total' => APP_Currencies::get_price($order->get_total(), $order->get_currency()));
     return $sections;
 }