Esempio n. 1
0
 /**
  * Return the chosen payment details here for final confirmation. You probably don't need
  * to post anything in the form as it should be in your $_SESSION var already.
  *
  * @param array $cart. Contains the cart contents for the current blog, global cart if $mp->global_cart is true
  * @param array $shipping_info. Contains shipping info and email in case you need it
  */
 function confirm_payment_form($cart, $shipping_info)
 {
     global $mp;
     // Token MUST be set at this point
     if (!isset($_SESSION['simplifyToken'])) {
         $mp->cart_checkout_error(__('The Simplify Token was not generated correctly. Please go back and try again.', 'mp'));
         return false;
     }
     // Setup the Simplify API
     if (!class_exists('Simplify')) {
         require_once $mp->plugin_dir . "plugins-gateway/simplify-files/lib/Simplify.php";
     }
     Simplify::$publicKey = $this->publishable_key;
     Simplify::$privateKey = $this->private_key;
     try {
         $token = Simplify_CardToken::findCardToken($_SESSION['simplifyToken']);
     } catch (Exception $e) {
         $mp->cart_checkout_error(sprintf(__('%s. Please go back and try again.', 'mp'), $e->getMessage()));
         return false;
     }
     $content = '<table class="mp_cart_billing table table-striped table-bordered table-hover">';
     $content .= '<thead>';
     $content .= '<tr>';
     $content .= '<th>' . __('Billing Information:', 'mp') . '</th>';
     $content .= '<th align="right" class="align-right"><a href="' . mp_checkout_step_url('checkout') . '"> ' . __('Edit', 'mp') . '</a></th>';
     $content .= '</tr>';
     $content .= '</thead>';
     $content .= '<tbody>';
     $content .= '<tr>';
     $content .= '<td align="right" class="span4 align-right">' . __('Card Type:', 'mp') . '</td>';
     $content .= '<td>' . sprintf(__('%1$s', 'mp'), $token->card->type) . '</td>';
     $content .= '</tr>';
     $content .= '<tr>';
     $content .= '<td align="right" class="span4 align-right">' . __('Last 4 Digits:', 'mp') . '</td>';
     $content .= '<td>' . sprintf(__('%1$s', 'mp'), $token->card->last4) . '</td>';
     $content .= '</tr>';
     $content .= '<tr>';
     $content .= '<td align="right" class="span4 align-right">' . __('Expires:', 'mp') . '</td>';
     $content .= '<td>' . sprintf(__('%1$s/%2$s', 'mp'), $token->card->expMonth, $token->card->expYear) . '</td>';
     $content .= '</tr>';
     $content .= '</tbody>';
     $content .= '</table>';
     return $content;
 }