Sisow_Gateway_Focum

The Woocommerce Sisow Payment Methods Sisow Gateway Focum class.

Defined (1)

The class is defined in the following location(s).

/includes/classes/Sisow/Gateway/Focum.php  
  1. class Sisow_Gateway_Focum extends Sisow_Gateway_Abstract 
  2. public static function NeedRedirect() { return false; } 
  3.  
  4. public static function getCode() 
  5. return "focum"; 
  6.  
  7. public static function getName() 
  8. return "Focum Achteraf Betalen"; 
  9.  
  10. public static function canRefund() 
  11. return false; 
  12.  
  13. public static function getWarning() 
  14. return array( 
  15. 'title' => __( 'Warning', 'woocommerce-sisow' ),  
  16. 'type' => 'title',  
  17. 'description' => __( 'An additional contract is required for this payment method, please contact <a href="mailto:sales@sisow.nl">sales@sisow.nl</a>.', 'woocommerce-sisow' ),  
  18. ); 
  19.  
  20. public function payment_fields() 
  21. $description = '<div class="woocommerce-billing-fields">'; 
  22. $description .= '<img src="' . plugins_url( 'Images/focum.png', dirname(__FILE__) ) . '" alt="'.$this->getName().'"/>'; 
  23. $description .= '<p>'; 
  24. $description .= __('Gender', 'woocommerce-sisow') . '<br/>'; 
  25. $description .= '<select name="focum_gender">'; 
  26. $description .= '<option value="">-- ' . __('Please Choose', 'woocommerce-sisow') . ' --</option>'; 
  27. $description .= '<option value="m">'.__('Male', 'woocommerce-sisow').'</option>'; 
  28. $description .= '<option value="f">'.__('Female', 'woocommerce-sisow').'</option>'; 
  29. $description .= '</select>'; 
  30. $description .= '</p>'; 
  31. $description .= '<p>'; 
  32. $description .= __('Phone', 'woocommerce-sisow') . '<br/>'; 
  33. $description .= '<input class="input-text" type="text" name="focum_phone"/>'; 
  34. $description .= '</p>'; 
  35. $description .= '<p>'; 
  36. $description .= __('Birthdate', 'woocommerce-sisow') . '<br/>'; 
  37. $description .= '<select name="focum_birthday_day">'; 
  38. $description .= '<option value="">-- ' . __('Day', 'woocommerce-sisow') . ' --</option>'; 
  39. for($i = 1;$i < 32; $i++) 
  40. $description .= '<option value="'.sprintf("%02d", $i).'">'.$i.'</option>'; 
  41. $description .= '</select>'; 
  42. $description .= '<select name="focum_birthday_month">'; 
  43. $description .= '<option value="">-- ' . __('Month', 'woocommerce-sisow') . ' --</option>'; 
  44. $description .= '<option value="01">'.__('January', 'woocommerce-sisow').'</option>'; 
  45. $description .= '<option value="02">'.__('February', 'woocommerce-sisow').'</option>'; 
  46. $description .= '<option value="03">'.__('March', 'woocommerce-sisow').'</option>'; 
  47. $description .= '<option value="04">'.__('April', 'woocommerce-sisow').'</option>'; 
  48. $description .= '<option value="05">'.__('May', 'woocommerce-sisow').'</option>'; 
  49. $description .= '<option value="06">'.__('June', 'woocommerce-sisow').'</option>'; 
  50. $description .= '<option value="07">'.__('July', 'woocommerce-sisow').'</option>'; 
  51. $description .= '<option value="08">'.__('August', 'woocommerce-sisow').'</option>'; 
  52. $description .= '<option value="09">'.__('September', 'woocommerce-sisow').'</option>'; 
  53. $description .= '<option value="10">'.__('October', 'woocommerce-sisow').'</option>'; 
  54. $description .= '<option value="11">'.__('November', 'woocommerce-sisow').'</option>'; 
  55. $description .= '<option value="12">'.__('December', 'woocommerce-sisow').'</option>'; 
  56. $description .= '</select>'; 
  57. $description .= '<select name="focum_birthday_year">'; 
  58. $description .= '<option value="">-- ' . __('Year', 'woocommerce-sisow') . ' --</option>'; 
  59. for($i = date("Y")-18;$i > date("Y") - 110; $i--) 
  60. $description .= '<option value="'.$i.'">'.$i.'</option>'; 
  61. $description .= '</select>'; 
  62. $description .= '</p>'; 
  63. $description .= '<p>'; 
  64. $description .= __('IBAN', 'woocommerce-sisow') . '<br/>'; 
  65. $description .= '<input class="input-text" type="text" name="focum_iban"/>'; 
  66. $description .= '</p>'; 
  67. $description .= '</div>'; 
  68. echo $description; 
  69.  
  70. public function validate_fields()  
  71. {  
  72. $validated = true; 
  73. if(empty($_POST['focum_gender'])) 
  74. wc_add_notice( __('Please select your gender', 'woocommerce-sisow'), 'error' ); 
  75. $validated = false;  
  76.  
  77. if(empty($_POST['focum_phone'])) 
  78. wc_add_notice( __('Please fill in your phonenumber', 'woocommerce-sisow'), 'error' ); 
  79. $validated = false;  
  80.  
  81. if(empty($_POST['focum_birthday_day']) || empty($_POST['focum_birthday_month']) || empty($_POST['focum_birthday_year'])) 
  82. wc_add_notice( __('Please select your birthdate', 'woocommerce-sisow'), 'error' ); 
  83. $validated = false;  
  84.  
  85. if(empty($_POST['focum_iban'])) 
  86. wc_add_notice( __('Please fill in your IBAN', 'woocommerce-sisow'), 'error' ); 
  87. $validated = false;  
  88.  
  89. return $validated;