[wp-trac] [WordPress Trac] #38884: Wordpress Payment gateway add on form , how to add form into list or else how to submit form to next step for payment

WordPress Trac noreply at wordpress.org
Mon Nov 21 07:59:49 UTC 2016


#38884: Wordpress Payment gateway add on form , how to add form into list or else
how to submit form to next step for payment
----------------------------+-----------------------------
 Reporter:  krshnkrishna49  |      Owner:
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  HTTP API        |    Version:  4.6.1
 Severity:  normal          |   Keywords:
  Focuses:                  |
----------------------------+-----------------------------
 The blow code in my payment.php file and I am taking data from config in
 admin using filter in wordpress..

 {{{
  function wpjb_payment_clickandpledge($list,$html) {
       global $wpjobboard;
      global $gclass;
       global $html;
       include_once dirname(__FILE__)."/clickandpledge_payment.class.php";
       $cnp = new Payment_ClickandPledge();
       $list[$cnp->getEngine()] = get_class($cnp);
       return $list;
     }
  add_filter('wpjb_payments_list',  'wpjb_payment_clickandpledge');
 }}}

 In code add_filter function used to get payment gateway list enabled in
 admin area..in that my custom gateway also display ..but now in that after
 details i need form to enter payment details like credit or other payments
 , I have one class file which is having my form and it is assigned to
 $html variable inside the function called function render() ...Now i want
 to add my $html to
 {{{
 add_filter('wpjb_payments_list', 'wpjb_payment_clickandpledge');
 }}}
  for this hooks how can do this below is my class file


 {{{
   class Payment_ClickandPledge extends Wpjb_Payment_Abstract{
          public function render() {
         $data = $this->_data;$id = $this->_data->id; $availableCurrencies
 = array();$paymentMethods = array();
         $merchant = $this->getMerchant();
          if(isset($merchant['wpjobboard_clickandpledge_usdaccount']) &&
 $merchant['wpjobboard_clickandpledge_usdaccount'] != '')
          array_push($availableCurrencies, 'USD');
         if(isset($merchant['wpjobboard_clickandpledge_euraccount']) &&
 $merchant['wpjobboard_clickandpledge_euraccount'] != '')
                       array_push($availableCurrencies, 'EUR');
 if(isset($merchant['wpjobboard_clickandpledge_cadaccount']) &&
 $merchant['wpjobboard_clickandpledge_cadaccount'] != '')
                       array_push($availableCurrencies, 'CAD');
 if(isset($merchant['wpjobboard_clickandpledge_gbpaccount']) &&
 $merchant['wpjobboard_clickandpledge_gbpaccount'] != '')
                       array_push($availableCurrencies, 'GBP');
 if(isset($merchant['wpjobboard_clickandpledge_hkdaccount']) &&
 $merchant['wpjobboard_clickandpledge_hkdaccount'] != '')
                       array_push($availableCurrencies, 'HKD');
                       $selectedCurrency = $this->_data->payment_currency;
                       if(in_array($selectedCurrency,$availableCurrencies))
 {
   if(isset($merchant['wpjobboard_clickandpledge_Paymentmethods']) &&
 count($merchant['wpjobboard_clickandpledge_Paymentmethods']) > 0) {
 foreach($merchant['wpjobboard_clickandpledge_Paymentmethods'] as $method)
 {
   if($method == 'CreditCard')
                                     $paymentMethods[$method] = 'Credit
 Card';
                                     if($method == 'eCheck')
                                     $paymentMethods[$method] = 'eCheck';
                                     if($method == 'PurchaseOrder')
                                     $paymentMethods[$method] = 'Purchase
 Order';
                                     if($method == 'Invoice')
                                     $paymentMethods[$method] = 'Invoice';
                         }}else { $paymentMethods['CreditCard'] = 'Credit
 Card';
                                 $paymentMethods['eCheck'] = 'eCheck';
                                 $paymentMethods['PurchaseOrder'] =
 'Purchase Order';
 $paymentMethods['Invoice'] = 'Invoice';  }
                       $defaultpayment = 'CreditCard';
 if($merchant['wpjobboard_clickandpledge_DefaultpaymentMethod'] != '')
                       $defaultpayment =
 $merchant['wpjobboard_clickandpledge_DefaultpaymentMethod'];
                       $ajaxurl = admin_url("admin-ajax.php");
                        $html = ' <script type="text/javascript">
                   var WPJB_PAYMENT_ID = '.$id.'; if (typeof ajaxurl ===
 "undefined") { ajaxurl = "'.$ajaxurl.'";  }
                 </script><form action="" method="POST" id="payment-
 form"><h3>'.__("Click & Pledge", "wpjobboard").'</h3>
         <div class="payment-errors"></div><div class="htmlholder">  ';
         if(count($paymentMethods) > 0) {$html .= '<span
 style="width:980px" id="payment_methods">';foreach($paymentMethods as
 $pkey => $pval) {
         if($pkey == $defaultpayment) {
         $html .= '<input type="radio"
 id="cnp_payment_method_selection_'.$pkey.'"
 name="cnp_payment_method_selection" class="cnp_payment_method_selection"
 style="margin: 0 0 0 0;" value="'.$pkey.'"
 checked>&nbsp<b>'.$pval.'</b>   ';
         } else {$html .= '<input type="radio"
 id="cnp_payment_method_selection_'.$pkey.'"
 name="cnp_payment_method_selection" class="cnp_payment_method_selection"
 style="margin: 0 0 0 0;"
 value="'.$pkey.'"> <b>'.$pval.'</b>   ';
         }}$html .= '</span>';}
          $cdivdisplay = ($defaultpayment == 'CreditCard') ? 'block' :
 'none';$recurringhtml = '';
 $merchant['wpjobboard_clickandpledge_isRecurring'].'############';
          if(isset($merchant['wpjobboard_clickandpledge_isRecurring']) &&
 $merchant['wpjobboard_clickandpledge_isRecurring'] == 1) {
         if($merchant['wpjobboard_clickandpledge_RecurringLabel'] != '') {
             $recurringhtml .= '<br><div class="form-row"
 id="clickandpledge_isRecurring_div"><label>
 <span>'.__($merchant['wpjobboard_clickandpledge_RecurringLabel'],
 "wpjobboard").'</span> <input type="checkbox"
 name="clickandpledge_isRecurring"
 id="clickandpledge_isRecurring"/></label></div>';} else {
         $recurringhtml .= '<br><div class="form-row"
 id="clickandpledge_isRecurring_div"><label><span>'.__('Is this Recurring
 Payment?', "wpjobboard").'</span><input type="checkbox"
 name="clickandpledge_isRecurring"
 id="clickandpledge_isRecurring"/></label>
         </div>';}$RecurringMethod = array();
 if(isset($merchant['wpjobboard_clickandpledge_RecurringMethod_Subscription'])
 &&
 is_array($merchant['wpjobboard_clickandpledge_RecurringMethod_Subscription'])
 &&
 count($merchant['wpjobboard_clickandpledge_RecurringMethod_Subscription'])
 > 0) {   array_push($RecurringMethod, 'Subscription');}
 if(isset($merchant['wpjobboard_clickandpledge_RecurringMethod_Installment'])
 &&
 is_array($merchant['wpjobboard_clickandpledge_RecurringMethod_Installment'])
 &&
 count($merchant['wpjobboard_clickandpledge_RecurringMethod_Installment'])
 > 0) {
          array_push($RecurringMethod, 'Installment');}
         if(count($RecurringMethod) == 0) {array_push($RecurringMethod,
 'Subscription');
         array_push($RecurringMethod,
 'Installment');}if(count($RecurringMethod) > 0) {
         if(count($RecurringMethod) == 1) {$recurringhtml .= '<input
 type="hidden" name="clickandpledge_RecurringMethod"
 id="clickandpledge_RecurringMethod" value="'.$RecurringMethod[0].'">';
         } else {$recurringhtml .= '<br><div class="form-row"
 id="clickandpledge_RecurringMethod_div"><label>
         <span>'.__("Recurring Method", "wpjobboard").'</span>
          <select id="clickandpledge_RecurringMethod"
 name="clickandpledge_RecurringMethod">';
         foreach ($RecurringMethod as $r) {$recurringhtml .= '<option
 value="'.$r.'">'.$r.'</option>';}
         $recurringhtml .= '</select></label> </div>';}} else {
         $recurringhtml .= '<div class="form-row"
 id="clickandpledge_RecurringMethod_div"><label>
         <span>'.__("Recurring Method", "wpjobboard").'</span>
         <select id="clickandpledge_RecurringMethod"
 name="clickandpledge_RecurringMethod">
         <option value="Subscription">Subscription</option>
         <option value="Installment">Installment</option></select></label>
 </div>';}
       if(isset($merchant['wpjobboard_clickandpledge_indefinite']) &&
 is_array($merchant['wpjobboard_clickandpledge_indefinite']) &&
 count($merchant['wpjobboard_clickandpledge_indefinite']) > 0) {
                         $recurringhtml .= '<br><div class="form-row"
 id="clickandpledge_indefinite_div">
         <label><span>'.__("Indefinite Recurring", "wpjobboard").'</span>
         <input type="checkbox" name="clickandpledge_indefinite"
 id="clickandpledge_indefinite"/></label></div>';}
   if(isset($merchant['wpjobboard_clickandpledge_Periodicity']) &&
 is_array($merchant['wpjobboard_clickandpledge_Periodicity']) &&
 count($merchant['wpjobboard_clickandpledge_Periodicity']) > 0) {
  $recurringhtml .= '<br><div class="form-row"
 id="clickandpledge_Periodicity_div">
         <label><span>'.__("Every", "wpjobboard").'</span> <select
 id="clickandpledge_Periodicity" name="clickandpledge_Periodicity">';
         foreach ($merchant['wpjobboard_clickandpledge_Periodicity'] as $r)
 {$recurringhtml .= '<option value="'.$r.'">'.$r.'</option>';
         }  $recurringhtml .= '</select></label> <span
 id="clickandpledge_Installment_div"><input type="text"
 name="clickandpledge_Installment" id="clickandpledge_Installment"
 class="required" title="Installments" style="width:100px;"
 maxlength="3"/> <font color="#FF0000">*</font> payments</span>
         </div>
 <script>jQuery("#clickandpledge_Installment").keypress(function(e) {
         var a = [];var k = e.which;for (i = 48; i < 58; i++) a.push(i);if
 (!(a.indexOf(k)>=0))e.preventDefault();
         });</script>';} else {$Periodicity = array();$Periodicity['Week']
 = 'Week';$Periodicity['2 Weeks']    = '2 Weeks';
         $Periodicity['2 Months']    = '2 Months';$Periodicity['Quarter']
 = 'Quarter';
         $Periodicity['6 Months']    = '6 Months';
          $Periodicity['Year']       = 'Year';
         $recurringhtml .= '<br><div class="form-row"
 id="clickandpledge_Periodicity_div">
         <label><span>'.__("Every", "wpjobboard").'</span> <select
 id="clickandpledge_Periodicity" name="clickandpledge_Periodicity">';
         foreach ($Periodicity as $k => $v) {
   $recurringhtml .= '<option value="'.$k.'">'.$v.'</option>';
                                 }
                                 $recurringhtml .= '</select>
                                 </label> 
                                 <span
 id="clickandpledge_Installment_div"><input type="text"
 name="clickandpledge_Installment" id="clickandpledge_Installment"
 class="required" title="Installments" style="width:100px;"
 maxlength="3"/> <font color="#FF0000">*</font> payments</span> </div>
                               ';  }        }
                          $clickandpledgename_CreditCard = '<div class
 ="form-row cnp_payment_style" >  <label>
    <span>'.__("Name <font color='red'>*</font>",
 "wpjobboard").'</span>
 <input type="text" size="20" data-clickandpledge="number"
 name="clickandpledge_FirstName_CreditCard"
 id="clickandpledge_FirstName_CreditCard" class="required NameOnCard"
 placeholder="First Name"/><input type="text" size="20" data-
 clickandpledge="number" name="clickandpledge_LastName_CreditCard"
 id="clickandpledge_LastName_CreditCard" class="required NameOnCard"
 placeholder="Last Name"/>  </label></div> ';
 $clickandpledgename_eCheck = '<div class="form-row cnp_payment_style" >
 <label> <span>'.__("Name <font color='red'>*</font>",
 "wpjobboard").'</span><input type="text" size="20" data-
 clickandpledge="number" name="clickandpledge_FirstName_eCheck"
 id="clickandpledge_FirstName_eCheck" class="required NameOnCard"
 placeholder="First Name"/>
 <input type="text" size="20" data-clickandpledge="number"
 name="clickandpledge_LastName_eCheck" id="clickandpledge_LastName_eCheck"
 class="required NameOnCard" placeholder="Last Name"/></label>  </div>   ';
                           $clickandpledgename_Invoice = '<div class="form-
 row cnp_payment_style" ><label> <span>'.__("Name <font
 color='red'>*</font>", "wpjobboard").'</span><input type="text" size="20"
 data-clickandpledge="number" name="clickandpledge_FirstName_Invoice"
 id="clickandpledge_FirstName_Invoice" class="required NameOnCard"
 placeholder="First Name"/>
                               <input type="text" size="20" data-
 clickandpledge="number" name="clickandpledge_LastName_Invoice"
 id="clickandpledge_LastName_Invoice" class="required NameOnCard"
 placeholder="Last Name"/> </label> </div> ';
                           $clickandpledgename_PO = '<div class="form-row
 cnp_payment_style" ><label>
                               <span>'.__("Name <font
 color='red'>*</font>", "wpjobboard").'</span> <input type="text" size="20"
 data-clickandpledge="number" name="clickandpledge_FirstName_PO"
 id="clickandpledge_FirstName_PO" class="required NameOnCard"
 placeholder="First Name"/>
                               <input type="text" size="20" data-
 clickandpledge="number" name="clickandpledge_LastName_PO"
 id="clickandpledge_LastName_PO" class="required NameOnCard"
 placeholder="Last Name"/> </label> </div> ';
              $html .= '<div style="display:'.$cdivdisplay.'"
 id="cnp_CreditCard_div">';
                          $html .= $clickandpledgename_CreditCard;
                           $html .= '<div class="form-row">
                             <label>
                               <span>'.__("Name On Card <font
 color='red'>*</font>", "wpjobboard").'</span>
                               <input type="text" size="20" data-
 clickandpledge="number" name="clickandpledge_nameOnCard"
 id="clickandpledge_nameOnCard" class="required NameOnCard"
 placeholder="Name On Card"/></label> </div><div class="form-row">  <label>
                               <span>'.__("Card Number <font
 color='red'>*</font>", "wpjobboard").'</span>
                               <input type="text" size="20" data-
 clickandpledge="number" name="clickandpledge_cardNumber"
 id="clickandpledge_cardNumber" class="required creditcard"
 placeholder="Card Number"/></label> </div>  <div class="form-row"><label>
                               <span>'.__("CVV <font
 color='red'>*</font>", "wpjobboard").'</span>
                               <input type="text" size="4" data-
 clickandpledge="cvc" maxlength="4" name="clickandpledge_cvc"
 id="clickandpledge_cvc" class="required Cvv2" placeholder="CVV"/>
  </label>  </div><div class="form-row">
                             <label><span>'.__("Expiration
 (MM/YYYY) <font color='red'>*</font>", "wpjobboard").'</span></label>
                             <select name="clickandpledge_cardExpMonth"
 id="clickandpledge_cardExpMonth"
 class="required">'.$this->getMonths().'</select> <span> / </span>
                             <select name="clickandpledge_cardExpYear"
 id="clickandpledge_cardExpYear" class="required" data-clickandpledge="exp-
 year">'.$this->getYears().'</select> </div>';
                         $html .= $recurringhtml;
                         $html .= '</div>'; //CreditCard Div End
                         $eCheckdivdisplay = ($defaultpayment == 'eCheck')
 ? 'block' : 'none';
   $recurringhtml_eCheck = '';
           if(isset($merchant['wpjobboard_clickandpledge_isRecurring']) &&
 $merchant['wpjobboard_clickandpledge_isRecurring'] == 1) {
   if($merchant['wpjobboard_clickandpledge_RecurringLabel'] != '') {
                                 $recurringhtml_eCheck .= '<br><div class
 ="form-row" id="clickandpledge_isRecurring_div_eCheck">
                                 <label>
 <span>'.__($merchant['wpjobboard_clickandpledge_RecurringLabel'],
 "wpjobboard").'</span>  <input type="checkbox"
 name="clickandpledge_isRecurring_eCheck"
 id="clickandpledge_isRecurring_eCheck"/> </label> </div>';
       } else {
                             $recurringhtml_eCheck .= '<br><div class
 ="form-row" id="clickandpledge_isRecurring_div_eCheck"> <label>
   <span>'.__('Is this Recurring Payment?', "wpjobboard").'</span>
                                   <input type="checkbox"
 name="clickandpledge_isRecurring_eCheck"
 id="clickandpledge_isRecurring_eCheck"/>  </label> </div>'; }
                             $RecurringMethod = array();
 If(isset($merchant['wpjobboard_clickandpledge_RecurringMethod_Subscription'])
 &&
 is_array($merchant['wpjobboard_clickandpledge_RecurringMethod_Subscription'])
 &&
 count($merchant['wpjobboard_clickandpledge_RecurringMethod_Subscription'])
 > 0) {  array_push($RecurringMethod, 'Subscription');  }
 if(isset($merchant['wpjobboard_clickandpledge_RecurringMethod_Installment'])
 &&
 is_array($merchant['wpjobboard_clickandpledge_RecurringMethod_Installment'])
 &&
 count($merchant['wpjobboard_clickandpledge_RecurringMethod_Installment'])
 > 0) {
                                 array_push($RecurringMethod,
 'Installment');
                             }  if(count($RecurringMethod) == 0) {
                                 array_push($RecurringMethod,
 'Subscription');
                                 array_push($RecurringMethod,
 'Installment');
                             } if(count($RecurringMethod) > 0) {
                                 if(count($RecurringMethod) == 1) {
                                     $recurringhtml_eCheck .= '<input
 type="hidden" name="clickandpledge_RecurringMethod_eCheck"
 id="clickandpledge_RecurringMethod_eCheck"
 value="'.$RecurringMethod[0].'">';
 } else {$recurringhtml_eCheck .= '<br><div class="form-row"
 id="clickandpledge_RecurringMethod_div_eCheck"><label>
                                   <span>'.__("Recurring Method",
 "wpjobboard").'</span> <select id="clickandpledge_RecurringMethod_eCheck"
 name="clickandpledge_RecurringMethod_eCheck">';
                                 foreach ($RecurringMethod as $r) {
                                     $recurringhtml_eCheck .= '<option
 value="'.$r.'">'.$r.'</option>';  }
           $recurringhtml_eCheck .= '</select></label></div>'; } } else {
                                 $recurringhtml_eCheck .= '<div class
 ="form-row" id="clickandpledge_RecurringMethod_div_eCheck">  <label>
                                   <span>'.__("Recurring Method",
 "wpjobboard").'</span><select id="clickandpledge_RecurringMethod_eCheck"
 name="clickandpledge_RecurringMethod_eCheck"> <option
 value="Subscription">Subscription</option> <option
 value="Installment">Installment</option> </select></label>  </div>';}
 if(isset($merchant['wpjobboard_clickandpledge_indefinite']) &&
 is_array($merchant['wpjobboard_clickandpledge_indefinite']) &&
 count($merchant['wpjobboard_clickandpledge_indefinite']) > 0) {
                         $recurringhtml_eCheck .= '<br><div class="form-
 row" id="clickandpledge_indefinite_div_eCheck"> <label>
 <span>'.__("Indefinite Recurring", "wpjobboard").'</span><input
 type="checkbox" name="clickandpledge_indefinite_eCheck"
 id="clickandpledge_indefinite_eCheck"/></label>  </div>';  }
       if(isset($merchant['wpjobboard_clickandpledge_Periodicity']) &&
 is_array($merchant['wpjobboard_clickandpledge_Periodicity']) &&
 count($merchant['wpjobboard_clickandpledge_Periodicity']) > 0) {
   $recurringhtml_eCheck .= '<br><div class="form-row"
 id="clickandpledge_Periodicity_div_eCheck"><label>
  <span>'.__("Every", "wpjobboard").'</span><select
 id="clickandpledge_Periodicity_eCheck"
 name="clickandpledge_Periodicity_eCheck">'; foreach
 ($merchant['wpjobboard_clickandpledge_Periodicity'] as $r) {
  $recurringhtml_eCheck .= '<option value="'.$r.'">'.$r.'</option>'; }
 $recurringhtml_eCheck .= '</select></label>  <span
 id="clickandpledge_Installment_div_eCheck"><input type="text"
 name="clickandpledge_Installment_eCheck"
 id="clickandpledge_Installment_eCheck" class="required"
 title="Installments" style="width:100px;" maxlength="3"/> <font
 color="#FF0000">*</font> payments</span></div> ';  } else {
  $Periodicity = array();  $Periodicity['Week']        = 'Week';
  $Periodicity['2 Weeks'] = '2 Weeks'; $Periodicity['Month']       =
 'Month'; $Periodicity['2 Months']    = '2 Months'; $Periodicity['Quarter']
 = 'Quarter';
 $Periodicity['6 Months']    = '6 Months'; $Periodicity['Year']        =
 'Year';
  $recurringhtml_eCheck .= '<br><div class="form-row"
 id="clickandpledge_Periodicity_div_eCheck"> <label> <span>'.__("Every",
 "wpjobboard").'</span><select id="clickandpledge_Periodicity_eCheck"
 name="clickandpledge_Periodicity_eCheck">'; foreach ($Periodicity as $k =>
 $v) {
                                     $recurringhtml_eCheck .= '<option
 value="'.$k.'">'.$v.'</option>';} $recurringhtml_eCheck .=
 '</select></label> <span
 id="clickandpledge_Installment_div_eCheck"><input type="text"
 name="clickandpledge_Installment_eCheck"
 id="clickandpledge_Installment_eCheck" class="required"
 title="Installments" style="width:100px;" maxlength="3"/> <font
 color="#FF0000">*</font> payments</span></div> ';}     }
                         $html .= '<div
 style="display:'.$eCheckdivdisplay.'" id="cnp_eCheck_div">'; $html .=
 $clickandpledgename_eCheck; $html .= '
                         <div class="form-row"> <label> <span>'.__("Routing
 Number <font color='red'>*</font>", "wpjobboard").'</span>
                               <input type="text" data-
 clickandpledge="number" name="clickandpledge_echeck_RoutingNumber"
 id="clickandpledge_echeck_RoutingNumber" class="required RoutingNumber"
 placeholder="Routing Number"/> </label></div><div class="form-row">
 <label>
                               <span>'.__("Check Number <font
 color='red'>*</font>", "wpjobboard").'</span>
                               <input type="text" data-
 clickandpledge="number" name="clickandpledge_echeck_CheckNumber"
 id="clickandpledge_echeck_CheckNumber" class="required CheckNumber"
 placeholder="Check Number"/> </label> </div><div class="form-
 row"><label><span>'.__("Account Number <font color='red'>*</font>",
 "wpjobboard").'</span> <input type="text" data-clickandpledge="number"
 name="clickandpledge_echeck_AccountNumber"
 id="clickandpledge_echeck_AccountNumber" class="required AccountNumber"
 placeholder="Account Number"/></label></div><div class="form-row"><label>
                               <span>'.__("Retype Account Number <font
 color='red'>*</font>", "wpjobboard").'</span>
                               <input type="text" data-
 clickandpledge="number" name="clickandpledge_echeck_retypeAccountNumber"
 id="clickandpledge_echeck_retypeAccountNumber" class="required
 AccountNumber" placeholder="Retype Account Number"/></label></div>
             <div class="form-row"><label>
             <span>'.__("Account Type <font color='red'>*</font>",
 "wpjobboard").'</span> <select name="clickandpledge_echeck_AccountType"
 id="clickandpledge_echeck_AccountType" title="Account Type">
             <option value="SavingsAccount">SavingsAccount</option>
             <option
 value="CheckingAccount">CheckingAccount</option></select></label></div>
 <div class="form-row"><label><span>'.__("Check Type <font
 color='red'>*</font>", "wpjobboard").'</span> <select
 name="clickandpledge_echeck_CheckType"
 id="clickandpledge_echeck_CheckType" title="Check Type">
             <option value="Company">Company</option>
             <option value="Personal">Personal</option>
 </select></label></div>
              <div class="form-row"><label><span>'.__("Name on
 Account <font color='red'>*</font>", "wpjobboard").'</span><input
 type="text" data-clickandpledge="number"
 name="clickandpledge_echeck_NameOnAccount"
 id="clickandpledge_echeck_NameOnAccount" class="required AccountNumber"
 placeholder="Name on Account"/></label> </div>
             <div class="form-row"><label> <span>'.__("Type of
 ID <font color='red'>*</font>", "wpjobboard").'</span>
                               <select name="clickandpledge_echeck_IdType"
 id="clickandpledge_echeck_IdType" title="Type of ID">
                                     <option value="Driver">Driver</option>
                                     <option
 value="Military">Military</option>
             <option value="State">State</option> </select></label></div>';
             $html .= $recurringhtml_eCheck;$html .= '</div>'; //eCheck Div
 End
             $Invoicedivdisplay = ($defaultpayment == 'Invoice') ? 'block'
 : 'none';
             $html .= '<div style="display:'.$Invoicedivdisplay.'"
 id="cnp_Invoice_div">';
             $html .= $clickandpledgename_Invoice;
             $html .= '<div class="form-row"><label>
             <span>'.__("Invoice Number", "wpjobboard").'</span>
             <input type="text" data-clickandpledge="number"
 name="clickandpledge_Invoice_InvoiceNumber"
 id="clickandpledge_Invoice_InvoiceNumber" class="InvoiceCheckNumber"
 placeholder="Invoice Number"/></label> </div>';
             $html .= '</div>'; //Invoice Div End
             $PurchaseOrderdivdisplay = ($defaultpayment ==
 'PurchaseOrder') ? 'block' : 'none';
             $html .= '<div style="display:'.$PurchaseOrderdivdisplay.'"
 id="cnp_PurchaseOrder_div">';
             $html .= $clickandpledgename_PO;
             $html .= '<div class="form-row"><label>
             <span>'.__("Purchase Order Number", "wpjobboard").'</span>
              <input type="text" data-clickandpledge="number"
 name="clickandpledge_PurchaseOrder_OrderNumber"
 id="clickandpledge_PurchaseOrder_OrderNumber" class="PurchaseOrderNumber"
 placeholder="Purchase Order Number"/>
             </label> </div>';
             $html .= '</div>'; //PurchaseOrder Div End
             $listing_id = '';
             if(isset($_POST['listing']) && $_POST['listing'] != '')
             $listing_id = $_POST['listing'];
             elseif(isset($_POST['listing_type']) && $_POST['listing_type']
 != '')
             $listing_id = $_POST['listing_type'];
             $varArray =
 array('clickandpledge_AccountID'=>$merchant['wpjobboard_clickandpledge_'.$selectedCurrency.'_AccountID'],
 'clickandpledge_AccountGuid'=>$merchant['wpjobboard_clickandpledge_'.$selectedCurrency.'_AccountGuid'],'clickandpledge_OrderMode'
 => $merchant['wpjobboard_clickandpledge_'.$selectedCurrency.'_OrderMode'],
                                 'clickandpledge_Amount' =>
 $this->_data->payment_sum+$this->_data->payment_discount,
 'clickandpledge_Discount' => $this->_data->payment_discount,
 'clickandpledge_OrganizationInformation' =>
 htmlspecialchars($merchant['wpjobboard_clickandpledge_OrganizationInformation']),'clickandpledge_TermsCondition'
 =>
 htmlspecialchars($merchant['wpjobboard_clickandpledge_TermsCondition']),
                                 'clickandpledge_email_customer' =>
 (is_array($merchant['wpjobboard_clickandpledge_emailcustomer']) &&
 count($merchant['wpjobboard_clickandpledge_emailcustomer']) > 0) ?
 $merchant['wpjobboard_clickandpledge_emailcustomer'][0] : '',
 'clickandpledge_maxrecurrings_Subscription' =>
 $merchant['wpjobboard_clickandpledge_maxrecurrings_Subscription'],
                                 'clickandpledge_maxrecurrings_Installment'
 => $merchant['wpjobboard_clickandpledge_maxrecurrings_Installment'],
                                 'clickandpledge_listing_id' =>
 $listing_id,
                                 'clickandpledge_coupon_code' =>
 (isset($_POST['coupon'])) ? $_POST['coupon'] : '',
                             );
                             foreach($varArray as $k=>$v)
                             {
                                 $html.= '<input type="hidden"
 name="'.$k.'" id="'.$k.'" value="'.$v.'" />';
                             }
                           $html .= '<button type="submit">'.__("Submit
 Payment", "wpjobboard").'</button></div></form>';} else {
             if(count($availableCurrencies) > 0) {
             $html = 'Selected currency <b>'.$selectedCurrency.'</b> not
 supported by Click & Pledge. We are supporting <b>'.implode(',',
 $availableCurrencies).'</b> only. Please contact administrator.';} else {
             $html = 'Selected currency <b>'.$selectedCurrency.'</b> not
 supported by Click & Pledge. Please contact administrator.';
             }}return $html;        }
                      public function getMonths() {
                         $str = ''; for ($i = 1; $i <= 12; $i++) {
                             if(date('m') == sprintf('%02d', $i)) {
                             $str .= '<option value="'.sprintf('%02d',
 $i).'" selected>'.sprintf('%02d', $i).' ('.strftime('%B', mktime(0, 0, 0,
 $i, 1, 2000)).')</option>';
                             } else {
                             $str .= '<option value="'.sprintf('%02d',
 $i).'">'.sprintf('%02d', $i).' ('.strftime('%B', mktime(0, 0, 0, $i, 1,
 2000)).')</option>';
    }       }return $str; } public function getYears() {       $str = '';
                          for ($i = date('Y'); $i < date('Y') + 11; $i++) {
                             $str .= '<option value="'.strftime('%Y',
 mktime(0, 0, 0, 1, 1, $i)).'">'.strftime('%Y', mktime(0, 0, 0, 1, 1,
 $i)).'</option>';
                         }
                         return $str; }
                      public function number_format($number, $decimals =
 2,$decsep = '', $ths_sep = '') {
             $parts = explode('.', $number);
             if(count($parts) > 1) {
             return $parts[0].'.'.substr($parts[1],0,$decimals);
             } else {return $number;}} }
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38884>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list