/**
  * Review and Confirmation code.
  *
  * @since 1.8
  */
 static function pmpro_checkout_confirmed($pmpro_confirmed)
 {
     global $pmpro_msg, $pmpro_msgt, $pmpro_level, $current_user, $pmpro_review, $pmpro_paypal_token, $discount_code, $bemail;
     //PayPal Express Call Backs
     if (!empty($_REQUEST['review'])) {
         if (!empty($_REQUEST['PayerID'])) {
             $_SESSION['payer_id'] = $_REQUEST['PayerID'];
         }
         if (!empty($_REQUEST['paymentAmount'])) {
             $_SESSION['paymentAmount'] = $_REQUEST['paymentAmount'];
         }
         if (!empty($_REQUEST['currencyCodeType'])) {
             $_SESSION['currCodeType'] = $_REQUEST['currencyCodeType'];
         }
         if (!empty($_REQUEST['paymentType'])) {
             $_SESSION['paymentType'] = $_REQUEST['paymentType'];
         }
         $morder = new MemberOrder();
         $morder->getMemberOrderByPayPalToken($_REQUEST['token']);
         $morder->Token = $morder->paypal_token;
         $pmpro_paypal_token = $morder->paypal_token;
         if ($morder->Token) {
             if ($morder->Gateway->getExpressCheckoutDetails($morder)) {
                 $pmpro_review = true;
             } else {
                 $pmpro_msg = $morder->error;
                 $pmpro_msgt = "pmpro_error";
             }
         } else {
             $pmpro_msg = __("The PayPal Token was lost.", "pmpro");
             $pmpro_msgt = "pmpro_error";
         }
     } elseif (!empty($_REQUEST['confirm'])) {
         $morder = new MemberOrder();
         $morder->getMemberOrderByPayPalToken($_REQUEST['token']);
         $morder->Token = $morder->paypal_token;
         $pmpro_paypal_token = $morder->paypal_token;
         if ($morder->Token) {
             //set up values
             $morder->membership_id = $pmpro_level->id;
             $morder->membership_name = $pmpro_level->name;
             $morder->discount_code = $discount_code;
             $morder->InitialPayment = $pmpro_level->initial_payment;
             $morder->PaymentAmount = $pmpro_level->billing_amount;
             $morder->ProfileStartDate = date("Y-m-d") . "T0:0:0";
             $morder->BillingPeriod = $pmpro_level->cycle_period;
             $morder->BillingFrequency = $pmpro_level->cycle_number;
             $morder->Email = $bemail;
             //set up level var
             $morder->getMembershipLevel();
             $morder->membership_level = apply_filters("pmpro_checkout_level", $morder->membership_level);
             //tax
             $morder->subtotal = $morder->InitialPayment;
             $morder->getTax();
             if ($pmpro_level->billing_limit) {
                 $morder->TotalBillingCycles = $pmpro_level->billing_limit;
             }
             if (pmpro_isLevelTrial($pmpro_level)) {
                 $morder->TrialBillingPeriod = $pmpro_level->cycle_period;
                 $morder->TrialBillingFrequency = $pmpro_level->cycle_number;
                 $morder->TrialBillingCycles = $pmpro_level->trial_limit;
                 $morder->TrialAmount = $pmpro_level->trial_amount;
             }
             if ($morder->confirm()) {
                 $pmpro_confirmed = true;
             } else {
                 $pmpro_msg = $morder->error;
                 $pmpro_msgt = "pmpro_error";
             }
         } else {
             $pmpro_msg = __("The PayPal Token was lost.", "pmpro");
             $pmpro_msgt = "pmpro_error";
         }
     }
     if (!empty($morder)) {
         return array("pmpro_confirmed" => $pmpro_confirmed, "morder" => $morder);
     } else {
         return $pmpro_confirmed;
     }
 }
Exemplo n.º 2
0
     $morder->billing->name = $bfirstname . " " . $blastname;
     $morder->billing->street = trim($baddress1 . " " . $baddress2);
     $morder->billing->city = $bcity;
     $morder->billing->state = $bstate;
     $morder->billing->country = $bcountry;
     $morder->billing->zip = $bzipcode;
     $morder->billing->phone = $bphone;
     //$gateway = pmpro_getOption("gateway");
     $morder->gateway = $gateway;
     $morder->setGateway();
     //setup level var
     $morder->getMembershipLevel();
     $morder->membership_level = apply_filters("pmpro_checkout_level", $morder->membership_level);
     //tax
     $morder->subtotal = $morder->InitialPayment;
     $morder->getTax();
     //filter for order, since v2.0
     $morder = apply_filters("pmpro_checkout_order", $morder);
     $pmpro_processed = $morder->process();
     if (!empty($pmpro_processed)) {
         $pmpro_msg = __("Payment accepted.", "pmpro");
         $pmpro_msgt = "pmpro_success";
         $pmpro_confirmed = true;
     } else {
         $pmpro_msg = $morder->error;
         if (empty($pmpro_msg)) {
             $pmpro_msg = __("Unknown error generating account. Please contact us to set up your membership.", "pmpro");
         }
         $pmpro_msgt = "pmpro_error";
     }
 } else {