| 1 | <?php
|
|---|
| 2 | /*
|
|---|
| 3 | Plugin Name: Click & Pledge WPJobBoard
|
|---|
| 4 | Plugin URI: http://manual.clickandpledge.com/WPJobBoard.html
|
|---|
| 5 | Description: This plugin is to integrate WPJobBoard Click & Pledge Payment system. Please contact Click & Pledge for assistance, support@clickpledge.com
|
|---|
| 6 | Author: Kamran Razvan
|
|---|
| 7 | Version: 1.0.0
|
|---|
| 8 | Author URI: http://manual.clickandpledge.com/
|
|---|
| 9 | */
|
|---|
| 10 | require_once dirname(__FILE__) . '/clickandpledge_admin_controll.php';
|
|---|
| 11 | class Payment_ClickandPledge extends Wpjb_Payment_Abstract
|
|---|
| 12 | {
|
|---|
| 13 |
|
|---|
| 14 | function wpjb_payment_clickandpledge($list) {
|
|---|
| 15 | global $wpjobboard;
|
|---|
| 16 |
|
|---|
| 17 | //include_once dirname(__FILE__)."/clickandpledge_payment.class.php";
|
|---|
| 18 | $cnp = new Payment_ClickandPledge();
|
|---|
| 19 | //$cnpform = $cnp->render();
|
|---|
| 20 |
|
|---|
| 21 | // registers new payment method
|
|---|
| 22 | $list[$cnp->getEngine()] = get_class($cnp);
|
|---|
| 23 | // echo $cnpform;
|
|---|
| 24 | return $list;
|
|---|
| 25 | }
|
|---|
| 26 | add_filter('wpjb_payments_list', 'wpjb_payment_clickandpledge');
|
|---|
| 27 |
|
|---|
| 28 | var $responsecodes = array();
|
|---|
| 29 | public function __construct(Wpjb_Model_Payment $data = null)
|
|---|
| 30 | {
|
|---|
| 31 | $this->_data = $data;
|
|---|
| 32 | add_action('wp_ajax_clickandpledge_transaction', array(
|
|---|
| 33 | __CLASS__,
|
|---|
| 34 | 'clickandpledge_transaction'
|
|---|
| 35 | ));
|
|---|
| 36 | add_action('wp_ajax_nopriv_clickandpledge_transaction', array(
|
|---|
| 37 | __CLASS__,
|
|---|
| 38 | 'clickandpledge_transaction'
|
|---|
| 39 | ));
|
|---|
| 40 |
|
|---|
| 41 | $this->responsecodes = array(
|
|---|
| 42 | 2054 => 'Total amount is wrong',
|
|---|
| 43 | 2055 => 'AccountGuid is not valid',
|
|---|
| 44 | 2056 => 'AccountId is not valid',
|
|---|
| 45 | 2057 => 'Username is not valid',
|
|---|
| 46 | 2058 => 'Password is not valid',
|
|---|
| 47 | 2059 => 'Invalid recurring parameters',
|
|---|
| 48 | 2060 => 'Account is disabled',
|
|---|
| 49 | 2101 => 'Cardholder information is null',
|
|---|
| 50 | 2102 => 'Cardholder information is null',
|
|---|
| 51 | 2103 => 'Cardholder information is null',
|
|---|
| 52 | 2104 => 'Invalid billing country',
|
|---|
| 53 | 2105 => 'Credit Card number is not valid',
|
|---|
| 54 | 2106 => 'Cvv2 is blank',
|
|---|
| 55 | 2107 => 'Cvv2 length error',
|
|---|
| 56 | 2108 => 'Invalid currency code',
|
|---|
| 57 | 2109 => 'CreditCard object is null',
|
|---|
| 58 | 2110 => 'Invalid card type ',
|
|---|
| 59 | 2111 => 'Card type not currently accepted',
|
|---|
| 60 | 2112 => 'Card type not currently accepted',
|
|---|
| 61 | 2210 => 'Order item list is empty',
|
|---|
| 62 | 2212 => 'CurrentTotals is null',
|
|---|
| 63 | 2213 => 'CurrentTotals is invalid',
|
|---|
| 64 | 2214 => 'TicketList lenght is not equal to quantity',
|
|---|
| 65 | 2215 => 'NameBadge lenght is not equal to quantity',
|
|---|
| 66 | 2216 => 'Invalid textonticketbody',
|
|---|
| 67 | 2217 => 'Invalid textonticketsidebar',
|
|---|
| 68 | 2218 => 'Invalid NameBadgeFooter',
|
|---|
| 69 | 2304 => 'Shipping CountryCode is invalid',
|
|---|
| 70 | 2305 => 'Shipping address missed',
|
|---|
| 71 | 2401 => 'IP address is null',
|
|---|
| 72 | 2402 => 'Invalid operation',
|
|---|
| 73 | 2501 => 'WID is invalid',
|
|---|
| 74 | 2502 => 'Production transaction is not allowed. Contact support for activation.',
|
|---|
| 75 | 2601 => 'Invalid character in a Base-64 string',
|
|---|
| 76 | 2701 => 'ReferenceTransaction Information Cannot be NULL',
|
|---|
| 77 | 2702 => 'Invalid Refrence Transaction Information',
|
|---|
| 78 | 2703 => 'Expired credit card',
|
|---|
| 79 | 2805 => 'eCheck Account number is invalid',
|
|---|
| 80 | 2807 => 'Invalid payment method',
|
|---|
| 81 | 2809 => 'Invalid payment method',
|
|---|
| 82 | 2811 => 'eCheck payment type is currently not accepted',
|
|---|
| 83 | 2812 => 'Invalid check number',
|
|---|
| 84 | 1001 => 'Internal error. Retry transaction',
|
|---|
| 85 | 1002 => 'Error occurred on external gateway please try again',
|
|---|
| 86 | 2001 => 'Invalid account information',
|
|---|
| 87 | 2002 => 'Transaction total is not correct',
|
|---|
| 88 | 2003 => 'Invalid parameters',
|
|---|
| 89 | 2004 => 'Document is not a valid xml file',
|
|---|
| 90 | 2005 => 'OrderList can not be empty',
|
|---|
| 91 | 3001 => 'Invalid RefrenceTransactionID',
|
|---|
| 92 | 3002 => 'Invalid operation for this transaction',
|
|---|
| 93 | 4001 => 'Fraud transaction',
|
|---|
| 94 | 4002 => 'Duplicate transaction',
|
|---|
| 95 | 5001 => 'Declined (general)',
|
|---|
| 96 | 5002 => 'Declined (lost or stolen card)',
|
|---|
| 97 | 5003 => 'Declined (fraud)',
|
|---|
| 98 | 5004 => 'Declined (Card expired)',
|
|---|
| 99 | 5005 => 'Declined (Cvv2 is not valid)',
|
|---|
| 100 | 5006 => 'Declined (Insufficient fund)',
|
|---|
| 101 | 5007 => 'Declined (Invalid credit card number)'
|
|---|
| 102 | );
|
|---|
| 103 | }
|
|---|
| 104 | function get_user_ip()
|
|---|
| 105 | {
|
|---|
| 106 | $ipaddress = '';
|
|---|
| 107 | if (isset($_SERVER['HTTP_CLIENT_IP']))
|
|---|
| 108 | $ipaddress = $_SERVER['HTTP_CLIENT_IP'];
|
|---|
| 109 | else if (isset($_SERVER['HTTP_X_FORWARDED_FOR']))
|
|---|
| 110 | $ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
|---|
| 111 | else if (isset($_SERVER['HTTP_X_FORWARDED']))
|
|---|
| 112 | $ipaddress = $_SERVER['HTTP_X_FORWARDED'];
|
|---|
| 113 | else if (isset($_SERVER['HTTP_FORWARDED_FOR']))
|
|---|
| 114 | $ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
|
|---|
| 115 | else if (isset($_SERVER['HTTP_FORWARDED']))
|
|---|
| 116 | $ipaddress = $_SERVER['HTTP_FORWARDED'];
|
|---|
| 117 | else
|
|---|
| 118 | $ipaddress = $_SERVER['REMOTE_ADDR'];
|
|---|
| 119 | $parts = explode(',', $ipaddress);
|
|---|
| 120 | if (count($parts) > 1)
|
|---|
| 121 | $ipaddress = $parts[0];
|
|---|
| 122 | return $ipaddress;
|
|---|
| 123 | }
|
|---|
| 124 |
|
|---|
| 125 | function safeString($str, $length = 1, $start = 0)
|
|---|
| 126 | {
|
|---|
| 127 | $str = preg_replace('/\x03/', '', $str); //Remove new line characters
|
|---|
| 128 | return substr(htmlspecialchars(($str)), $start, $length);
|
|---|
| 129 | }
|
|---|
| 130 |
|
|---|
| 131 | public function clickandpledge_transaction()
|
|---|
| 132 | {
|
|---|
| 133 | $post = $_POST;
|
|---|
| 134 | global $wpdb;
|
|---|
| 135 | $orderplacedcheck = $wpdb->get_row('SELECT * FROM ' . $wpdb->prefix . 'wpjb_payment WHERE id = ' . $post['id'], OBJECT);
|
|---|
| 136 | if ($orderplacedcheck) {
|
|---|
| 137 | $post['object_id'] = $orderplacedcheck->object_id;
|
|---|
| 138 | $post['object_type'] = $orderplacedcheck->object_type;
|
|---|
| 139 |
|
|---|
| 140 | $classObject = new Payment_ClickandPledge();
|
|---|
| 141 | $strParam = $classObject->buildXML($post);
|
|---|
| 142 | $connect = array(
|
|---|
| 143 | 'soap_version' => SOAP_1_1,
|
|---|
| 144 | 'trace' => 1,
|
|---|
| 145 | 'exceptions' => 0
|
|---|
| 146 | );
|
|---|
| 147 | $client = new SoapClient('https://paas.cloud.clickandpledge.com/paymentservice.svc?wsdl', $connect);
|
|---|
| 148 | $soapParams = array(
|
|---|
| 149 | 'instruction' => $strParam
|
|---|
| 150 | );
|
|---|
| 151 | $response = $client->Operation($soapParams);
|
|---|
| 152 | $params = array();
|
|---|
| 153 | if (($response === FALSE)) {
|
|---|
| 154 | $params['error'] = 'Connection to payment gateway failed - no data returned.';
|
|---|
| 155 | $params['ResultCode'] = '99999';
|
|---|
| 156 | $params['status'] = 'Fail';
|
|---|
| 157 | } else {
|
|---|
| 158 | $ResultCode = $response->OperationResult->ResultCode;
|
|---|
| 159 | $transation_number = $response->OperationResult->TransactionNumber;
|
|---|
| 160 | $VaultGUID = $response->OperationResult->VaultGUID;
|
|---|
| 161 |
|
|---|
| 162 | if ($ResultCode == '0') {
|
|---|
| 163 | $response_message = $response->OperationResult->ResultData;
|
|---|
| 164 | //Success
|
|---|
| 165 | $params['TransactionNumber'] = $VaultGUID;
|
|---|
| 166 | $params['trxn_result_code'] = $response_message;
|
|---|
| 167 | $params['status'] = 'Success';
|
|---|
| 168 | $params['ResultCode'] = $ResultCode;
|
|---|
| 169 | } else {
|
|---|
| 170 | if (in_array($ResultCode, array(
|
|---|
| 171 | 2051,
|
|---|
| 172 | 2052,
|
|---|
| 173 | 2053
|
|---|
| 174 | ))) {
|
|---|
| 175 | $AdditionalInfo = $response->OperationResult->AdditionalInfo;
|
|---|
| 176 | } else {
|
|---|
| 177 | if (isset($classObject->responsecodes[$ResultCode])) {
|
|---|
| 178 | $AdditionalInfo = $classObject->responsecodes[$ResultCode];
|
|---|
| 179 | } else {
|
|---|
| 180 | $AdditionalInfo = 'Unknown error';
|
|---|
| 181 | }
|
|---|
| 182 | }
|
|---|
| 183 | $params['error'] = $AdditionalInfo;
|
|---|
| 184 | $params['ResultCode'] = $ResultCode;
|
|---|
| 185 | $params['status'] = 'Fail';
|
|---|
| 186 | }
|
|---|
| 187 | }
|
|---|
| 188 | echo json_encode($params);
|
|---|
| 189 | die();
|
|---|
| 190 | }
|
|---|
| 191 | }
|
|---|
| 192 |
|
|---|
| 193 | public function buildXML($post)
|
|---|
| 194 | {
|
|---|
| 195 | $params = $post;
|
|---|
| 196 |
|
|---|
| 197 | $dom = new DOMDocument('1.0', 'UTF-8');
|
|---|
| 198 | $root = $dom->createElement('CnPAPI', '');
|
|---|
| 199 | $root->setAttribute("xmlns", "urn:APISchema.xsd");
|
|---|
| 200 | $root = $dom->appendChild($root);
|
|---|
| 201 |
|
|---|
| 202 | $version = $dom->createElement("Version", "1.5");
|
|---|
| 203 | $version = $root->appendChild($version);
|
|---|
| 204 |
|
|---|
| 205 | $engine = $dom->createElement('Engine', '');
|
|---|
| 206 | $engine = $root->appendChild($engine);
|
|---|
| 207 |
|
|---|
| 208 | $application = $dom->createElement('Application', '');
|
|---|
| 209 | $application = $engine->appendChild($application);
|
|---|
| 210 |
|
|---|
| 211 | $applicationid = $dom->createElement('ID', 'CnP_WPJobBoard_WordPress');
|
|---|
| 212 | $applicationid = $application->appendChild($applicationid);
|
|---|
| 213 |
|
|---|
| 214 | $applicationname = $dom->createElement('Name', 'CnP_WPJobBoard_WordPress');
|
|---|
| 215 | $applicationid = $application->appendChild($applicationname);
|
|---|
| 216 |
|
|---|
| 217 | $applicationversion = $dom->createElement('Version', '1.0.0.20150604');
|
|---|
| 218 | $applicationversion = $application->appendChild($applicationversion);
|
|---|
| 219 |
|
|---|
| 220 | $request = $dom->createElement('Request', '');
|
|---|
| 221 | $request = $engine->appendChild($request);
|
|---|
| 222 |
|
|---|
| 223 | $operation = $dom->createElement('Operation', '');
|
|---|
| 224 | $operation = $request->appendChild($operation);
|
|---|
| 225 |
|
|---|
| 226 | $operationtype = $dom->createElement('OperationType', 'Transaction');
|
|---|
| 227 | $operationtype = $operation->appendChild($operationtype);
|
|---|
| 228 |
|
|---|
| 229 | if ($this->get_user_ip() != '') {
|
|---|
| 230 | $ipaddress = $dom->createElement('IPAddress', $this->get_user_ip());
|
|---|
| 231 | $ipaddress = $operation->appendChild($ipaddress);
|
|---|
| 232 | }
|
|---|
| 233 |
|
|---|
| 234 | $httpreferrer = $dom->createElement('UrlReferrer', htmlentities($_SERVER['HTTP_REFERER']));
|
|---|
| 235 | $httpreferrer = $operation->appendChild($httpreferrer);
|
|---|
| 236 |
|
|---|
| 237 | $authentication = $dom->createElement('Authentication', '');
|
|---|
| 238 | $authentication = $request->appendChild($authentication);
|
|---|
| 239 |
|
|---|
| 240 | $accounttype = $dom->createElement('AccountGuid', $params['clickandpledge_AccountGuid']);
|
|---|
| 241 | $accounttype = $authentication->appendChild($accounttype);
|
|---|
| 242 |
|
|---|
| 243 | $accountid = $dom->createElement('AccountID', $params['clickandpledge_AccountID']);
|
|---|
| 244 | $accountid = $authentication->appendChild($accountid);
|
|---|
| 245 |
|
|---|
| 246 | $order = $dom->createElement('Order', '');
|
|---|
| 247 | $order = $request->appendChild($order);
|
|---|
| 248 |
|
|---|
| 249 | if ($params['clickandpledge_OrderMode'] == 'test') {
|
|---|
| 250 | $orderMode = 'Test';
|
|---|
| 251 | } else {
|
|---|
| 252 | $orderMode = 'Production';
|
|---|
| 253 | }
|
|---|
| 254 | $ordermode = $dom->createElement('OrderMode', $orderMode);
|
|---|
| 255 | $ordermode = $order->appendChild($ordermode);
|
|---|
| 256 |
|
|---|
| 257 | global $wpdb;
|
|---|
| 258 | $paymentdetails = $wpdb->get_row('SELECT * FROM ' . $wpdb->prefix . 'wpjb_payment WHERE id = ' . $params['id'], OBJECT);
|
|---|
| 259 | //Object Type:1-wpjb_job, 2 - wpjb_resume, 3 - wpjb_membership
|
|---|
| 260 | $orderdetails = array();
|
|---|
| 261 | $orderdetails['BillingEmail'] = $paymentdetails->email;
|
|---|
| 262 | $orderdetails['CustomFields'] = array();
|
|---|
| 263 | $order_custom_fields = $wpdb->get_results('SELECT * FROM ' . $wpdb->prefix . 'wpjb_meta meta INNER JOIN ' . $wpdb->prefix . 'wpjb_meta_value meta_value ON meta.id=meta_value.meta_id WHERE meta.meta_type=3 AND meta_value.object_id = ' . $params['object_id'] . ' ORDER BY meta_value.meta_id ASC', OBJECT);
|
|---|
| 264 | if (count($order_custom_fields) > 0) {
|
|---|
| 265 | $oldname = $strval = '';
|
|---|
| 266 | $fieldindex = 0;
|
|---|
| 267 | foreach ($order_custom_fields as $single_row) {
|
|---|
| 268 | $fieldindex++;
|
|---|
| 269 | if ($oldname == '')
|
|---|
| 270 | $oldname = $single_row->name;
|
|---|
| 271 | if ($oldname != $single_row->name) {
|
|---|
| 272 | $orderdetails['CustomFields'][$oldname] = substr($strval, 0, -1);
|
|---|
| 273 | $strval = '';
|
|---|
| 274 | }
|
|---|
| 275 | if (count($order_custom_fields) == $fieldindex) {
|
|---|
| 276 | $orderdetails['CustomFields'][$single_row->name] = $single_row->value;
|
|---|
| 277 | }
|
|---|
| 278 | $strval .= $single_row->value . ',';
|
|---|
| 279 | $oldname = $single_row->name;
|
|---|
| 280 | }
|
|---|
| 281 | }
|
|---|
| 282 | if (isset($post['clickandpledge_listing_id']) && $post['clickandpledge_listing_id'] != '') {
|
|---|
| 283 | $parts = explode('_', $post['clickandpledge_listing_id']);
|
|---|
| 284 | if (count($parts) == 3) {
|
|---|
| 285 | $listid = $parts[2];
|
|---|
| 286 | if ($listid != '') {
|
|---|
| 287 | $listrow = $wpdb->get_row('SELECT * FROM ' . $wpdb->prefix . 'wpjb_pricing WHERE id = ' . $listid, OBJECT);
|
|---|
| 288 | if ($listrow != '') {
|
|---|
| 289 | $orderdetails['CustomFields']['Listing Type'] = $listrow->title;
|
|---|
| 290 | }
|
|---|
| 291 | }
|
|---|
| 292 | }
|
|---|
| 293 | }
|
|---|
| 294 | if ($params['object_type'] == 1) {
|
|---|
| 295 | $orderplaced = $wpdb->get_row('SELECT * FROM ' . $wpdb->prefix . 'wpjb_job WHERE id = ' . $params['object_id'], OBJECT);
|
|---|
| 296 | $orderdetails['ItemName'] = 'Job: ' . $orderplaced->job_title;
|
|---|
| 297 | if ($orderplaced->job_description != '')
|
|---|
| 298 | $orderdetails['CustomFields']['Description'] = $orderplaced->job_description;
|
|---|
| 299 | if ($orderplaced->job_country != '') {
|
|---|
| 300 | $countries = Wpjb_List_Country::getAll();
|
|---|
| 301 | if (count($countries) > 0) {
|
|---|
| 302 | foreach ($countries as $country) {
|
|---|
| 303 | if ($country['code'] == $orderplaced->job_country)
|
|---|
| 304 | $orderdetails['CustomFields']['Job Country'] = $country['name'];
|
|---|
| 305 | }
|
|---|
| 306 | }
|
|---|
| 307 |
|
|---|
| 308 | }
|
|---|
| 309 | if ($orderplaced->job_state != '')
|
|---|
| 310 | $orderdetails['CustomFields']['Job State'] = $orderplaced->job_state;
|
|---|
| 311 | if ($orderplaced->job_zip_code != '')
|
|---|
| 312 | $orderdetails['CustomFields']['Job Zip-Code'] = $orderplaced->job_zip_code;
|
|---|
| 313 | if ($orderplaced->job_city != '')
|
|---|
| 314 | $orderdetails['CustomFields']['Job City'] = $orderplaced->job_city;
|
|---|
| 315 | if ($orderplaced->company_name != '')
|
|---|
| 316 | $orderdetails['CustomFields']['Company Name'] = $orderplaced->company_name;
|
|---|
| 317 | if ($orderplaced->company_email != '')
|
|---|
| 318 | $orderdetails['CustomFields']['Contact Email'] = $orderplaced->company_email;
|
|---|
| 319 | if ($orderplaced->company_url != '')
|
|---|
| 320 | $orderdetails['CustomFields']['Website'] = $orderplaced->company_url;
|
|---|
| 321 |
|
|---|
| 322 | $job = new Wpjb_Model_Job($params['object_id']);
|
|---|
| 323 | if (isset($job->getTag()->type) && is_array($job->getTag()->type)) {
|
|---|
| 324 | foreach ($job->getTag()->type as $type) {
|
|---|
| 325 | $orderdetails['CustomFields']['Job Type'] = $type->title;
|
|---|
| 326 | }
|
|---|
| 327 | }
|
|---|
| 328 | if (isset($job->tag->category) && is_array($job->tag->category)) {
|
|---|
| 329 | foreach ($job->tag->category as $cat) {
|
|---|
| 330 | $orderdetails['CustomFields']['Category'] = $cat->title;
|
|---|
| 331 | }
|
|---|
| 332 | }
|
|---|
| 333 |
|
|---|
| 334 | } else if ($params['object_type'] == 2) { //Resume
|
|---|
| 335 | $orderplaced = $wpdb->get_row('SELECT * FROM ' . $wpdb->prefix . 'wpjb_resume r INNER JOIN ' . $wpdb->prefix . 'posts p ON r.post_id = p.id WHERE r.id = ' . $params['object_id'], OBJECT);
|
|---|
| 336 | if ($orderplaced) {
|
|---|
| 337 | if ($orderplaced->post_title != '') {
|
|---|
| 338 | $orderdetails['ItemName'] = 'Resume: ' . $orderplaced->post_title;
|
|---|
| 339 | } else {
|
|---|
| 340 | $orderdetails['ItemName'] = 'Single Resume Access';
|
|---|
| 341 | }
|
|---|
| 342 | } else {
|
|---|
| 343 | $orderdetails['ItemName'] = 'Single Resume Access';
|
|---|
| 344 | }
|
|---|
| 345 | } else if ($params['object_type'] == 3) { //Membership
|
|---|
| 346 | $orderplaced = $wpdb->get_row('SELECT * FROM ' . $wpdb->prefix . 'wpjb_membership WHERE id = ' . $params['object_id'], OBJECT);
|
|---|
| 347 | if ($orderplaced->package_id != '') {
|
|---|
| 348 | $package = $wpdb->get_row('SELECT * FROM ' . $wpdb->prefix . 'wpjb_pricing WHERE id = ' . $orderplaced->package_id, OBJECT);
|
|---|
| 349 | $orderdetails['ItemName'] = 'Membership: ' . $package->title;
|
|---|
| 350 | } else {
|
|---|
| 351 | $orderdetails['ItemName'] = 'Employer Membership Package';
|
|---|
| 352 | }
|
|---|
| 353 | }
|
|---|
| 354 | $UnitPriceCalculate = $TotalDiscountCalculate = 0;
|
|---|
| 355 |
|
|---|
| 356 | $cardholder = $dom->createElement('CardHolder', '');
|
|---|
| 357 | $cardholder = $order->appendChild($cardholder);
|
|---|
| 358 |
|
|---|
| 359 | $billinginfo = $dom->createElement('BillingInformation', '');
|
|---|
| 360 | $billinginfo = $cardholder->appendChild($billinginfo);
|
|---|
| 361 |
|
|---|
| 362 | if (isset($post['clickandpledge_selectedPaymentMethod']) && $post['clickandpledge_selectedPaymentMethod'] == 'CreditCard') {
|
|---|
| 363 | $billfirst_name = $dom->createElement('BillingFirstName', $this->safeString($params['clickandpledge_FirstName_CreditCard'], 50));
|
|---|
| 364 | $billfirst_name = $billinginfo->appendChild($billfirst_name);
|
|---|
| 365 | $billlast_name = $dom->createElement('BillingLastName', $this->safeString($params['clickandpledge_LastName_CreditCard'], 50));
|
|---|
| 366 | $billlast_name = $billinginfo->appendChild($billlast_name);
|
|---|
| 367 | } else if (isset($post['clickandpledge_selectedPaymentMethod']) && $post['clickandpledge_selectedPaymentMethod'] == 'eCheck') {
|
|---|
| 368 | $billfirst_name = $dom->createElement('BillingFirstName', $this->safeString($params['clickandpledge_FirstName_eCheck'], 50));
|
|---|
| 369 | $billfirst_name = $billinginfo->appendChild($billfirst_name);
|
|---|
| 370 | $billlast_name = $dom->createElement('BillingLastName', $this->safeString($params['clickandpledge_LastName_eCheck'], 50));
|
|---|
| 371 | $billlast_name = $billinginfo->appendChild($billlast_name);
|
|---|
| 372 | } else if (isset($post['clickandpledge_selectedPaymentMethod']) && $post['clickandpledge_selectedPaymentMethod'] == 'Invoice') {
|
|---|
| 373 | $billfirst_name = $dom->createElement('BillingFirstName', $this->safeString($params['clickandpledge_FirstName_Invoice'], 50));
|
|---|
| 374 | $billfirst_name = $billinginfo->appendChild($billfirst_name);
|
|---|
| 375 | $billlast_name = $dom->createElement('BillingLastName', $this->safeString($params['clickandpledge_LastName_Invoice'], 50));
|
|---|
| 376 | $billlast_name = $billinginfo->appendChild($billlast_name);
|
|---|
| 377 | } else if (isset($post['clickandpledge_selectedPaymentMethod']) && $post['clickandpledge_selectedPaymentMethod'] == 'PurchaseOrder') {
|
|---|
| 378 | $billfirst_name = $dom->createElement('BillingFirstName', $this->safeString($params['clickandpledge_FirstName_PO'], 50));
|
|---|
| 379 | $billfirst_name = $billinginfo->appendChild($billfirst_name);
|
|---|
| 380 | $billlast_name = $dom->createElement('BillingLastName', $this->safeString($params['clickandpledge_LastName_PO'], 50));
|
|---|
| 381 | $billlast_name = $billinginfo->appendChild($billlast_name);
|
|---|
| 382 | }
|
|---|
| 383 |
|
|---|
| 384 | if (isset($orderdetails['BillingEmail']) && $orderdetails['BillingEmail'] != '') {
|
|---|
| 385 | $bill_email = $dom->createElement('BillingEmail', $orderdetails['BillingEmail']);
|
|---|
| 386 | $bill_email = $billinginfo->appendChild($bill_email);
|
|---|
| 387 | }
|
|---|
| 388 | //echo 'SELECT * FROM '.$wpdb->prefix.'wpjb_job WHERE post_id = '.$params['id'];
|
|---|
| 389 | //echo '<pre>';
|
|---|
| 390 | //print_r($orderplaced);
|
|---|
| 391 | //die('fffffffffff');
|
|---|
| 392 | $billingaddress = $dom->createElement('BillingAddress', '');
|
|---|
| 393 | $billingaddress = $cardholder->appendChild($billingaddress);
|
|---|
| 394 |
|
|---|
| 395 | if (isset($orderdetails['CustomFields']) && count($orderdetails['CustomFields']) > 0) {
|
|---|
| 396 | $customfieldlist = $dom->createElement('CustomFieldList', '');
|
|---|
| 397 | $customfieldlist = $cardholder->appendChild($customfieldlist);
|
|---|
| 398 |
|
|---|
| 399 | foreach ($orderdetails['CustomFields'] as $key => $val) {
|
|---|
| 400 | $customfield = $dom->createElement('CustomField', '');
|
|---|
| 401 | $customfield = $customfieldlist->appendChild($customfield);
|
|---|
| 402 |
|
|---|
| 403 | $fieldname = $dom->createElement('FieldName', $key);
|
|---|
| 404 | $fieldname = $customfield->appendChild($fieldname);
|
|---|
| 405 |
|
|---|
| 406 | $fieldvalue = $dom->createElement('FieldValue', $this->safeString($val, 500));
|
|---|
| 407 | $fieldvalue = $customfield->appendChild($fieldvalue);
|
|---|
| 408 | }
|
|---|
| 409 | }
|
|---|
| 410 |
|
|---|
| 411 | $paymentmethod = $dom->createElement('PaymentMethod', '');
|
|---|
| 412 | $paymentmethod = $cardholder->appendChild($paymentmethod);
|
|---|
| 413 |
|
|---|
| 414 | if (isset($post['clickandpledge_selectedPaymentMethod']) && $post['clickandpledge_selectedPaymentMethod'] == 'CreditCard') {
|
|---|
| 415 | $payment_type = $dom->createElement('PaymentType', 'CreditCard');
|
|---|
| 416 | $payment_type = $paymentmethod->appendChild($payment_type);
|
|---|
| 417 |
|
|---|
| 418 | $creditcard = $dom->createElement('CreditCard', '');
|
|---|
| 419 | $creditcard = $paymentmethod->appendChild($creditcard);
|
|---|
| 420 | $credit_card_name = '';
|
|---|
| 421 | if (isset($params['clickandpledge_nameOnCard']) && $params['clickandpledge_nameOnCard'] != '') {
|
|---|
| 422 | $credit_card_name .= ' ' . $params['clickandpledge_nameOnCard'];
|
|---|
| 423 | }
|
|---|
| 424 |
|
|---|
| 425 | $credit_name = $dom->createElement('NameOnCard', $this->safeString($credit_card_name, 50));
|
|---|
| 426 | $credit_name = $creditcard->appendChild($credit_name);
|
|---|
| 427 |
|
|---|
| 428 | $credit_number = $dom->createElement('CardNumber', $this->safeString(str_replace(' ', '', $params['clickandpledge_cardNumber']), 17));
|
|---|
| 429 | $credit_number = $creditcard->appendChild($credit_number);
|
|---|
| 430 |
|
|---|
| 431 | $credit_cvv = $dom->createElement('Cvv2', $params['clickandpledge_cvc']);
|
|---|
| 432 | $credit_cvv = $creditcard->appendChild($credit_cvv);
|
|---|
| 433 |
|
|---|
| 434 | $credit_expdate = $dom->createElement('ExpirationDate', $params['clickandpledge_cardExpMonth'] . "/" . substr($params['clickandpledge_cardExpYear'], 2, 2));
|
|---|
| 435 | $credit_expdate = $creditcard->appendChild($credit_expdate);
|
|---|
| 436 | } elseif (isset($post['clickandpledge_selectedPaymentMethod']) && $post['clickandpledge_selectedPaymentMethod'] == 'eCheck') {
|
|---|
| 437 | $payment_type = $dom->createElement('PaymentType', 'Check');
|
|---|
| 438 | $payment_type = $paymentmethod->appendChild($payment_type);
|
|---|
| 439 |
|
|---|
| 440 | $echeck = $dom->createElement('Check', '');
|
|---|
| 441 | $echeck = $paymentmethod->appendChild($echeck);
|
|---|
| 442 | if (!empty($post['clickandpledge_echeck_AccountNumber'])) {
|
|---|
| 443 | $ecAccount = $dom->createElement('AccountNumber', $this->safeString($post['clickandpledge_echeck_AccountNumber'], 17));
|
|---|
| 444 | $ecAccount = $echeck->appendChild($ecAccount);
|
|---|
| 445 | }
|
|---|
| 446 | if (!empty($post['clickandpledge_echeck_AccountType'])) {
|
|---|
| 447 | $ecAccount_type = $dom->createElement('AccountType', $post['clickandpledge_echeck_AccountType']);
|
|---|
| 448 | $ecAccount_type = $echeck->appendChild($ecAccount_type);
|
|---|
| 449 | }
|
|---|
| 450 | if (!empty($post['clickandpledge_echeck_RoutingNumber'])) {
|
|---|
| 451 | $ecRouting = $dom->createElement('RoutingNumber', $this->safeString($post['clickandpledge_echeck_RoutingNumber'], 9));
|
|---|
| 452 | $ecRouting = $echeck->appendChild($ecRouting);
|
|---|
| 453 | }
|
|---|
| 454 | if (!empty($post['clickandpledge_echeck_CheckNumber'])) {
|
|---|
| 455 | $ecCheck = $dom->createElement('CheckNumber', $this->safeString($post['clickandpledge_echeck_CheckNumber'], 10));
|
|---|
| 456 | $ecCheck = $echeck->appendChild($ecCheck);
|
|---|
| 457 | }
|
|---|
| 458 | if (!empty($post['clickandpledge_echeck_CheckType'])) {
|
|---|
| 459 | $ecChecktype = $dom->createElement('CheckType', $post['clickandpledge_echeck_CheckType']);
|
|---|
| 460 | $ecChecktype = $echeck->appendChild($ecChecktype);
|
|---|
| 461 | }
|
|---|
| 462 | if (!empty($post['clickandpledge_echeck_NameOnAccount'])) {
|
|---|
| 463 | $ecName = $dom->createElement('NameOnAccount', $this->safeString($post['clickandpledge_echeck_NameOnAccount'], 100));
|
|---|
| 464 | $ecName = $echeck->appendChild($ecName);
|
|---|
| 465 | }
|
|---|
| 466 | if (!empty($post['clickandpledge_echeck_IdType'])) {
|
|---|
| 467 | $ecIdtype = $dom->createElement('IdType', $post['clickandpledge_echeck_IdType']);
|
|---|
| 468 | $ecIdtype = $echeck->appendChild($ecIdtype);
|
|---|
| 469 | }
|
|---|
| 470 | if (!empty($post['clickandpledge_echeck_IdNumber'])) {
|
|---|
| 471 | $IdNumber = $dom->createElement('IdNumber', $this->safeString($post['clickandpledge_echeck_IdNumber'], 30));
|
|---|
| 472 | $IdNumber = $creditcard->appendChild($IdNumber);
|
|---|
| 473 | }
|
|---|
| 474 | if (!empty($post['clickandpledge_echeck_IdStateCode'])) {
|
|---|
| 475 | $IdStateCode = $dom->createElement('IdStateCode', $post['clickandpledge_echeck_IdStateCode']);
|
|---|
| 476 | $IdStateCode = $creditcard->appendChild($IdStateCode);
|
|---|
| 477 | }
|
|---|
| 478 | } elseif (isset($post['clickandpledge_selectedPaymentMethod']) && $post['clickandpledge_selectedPaymentMethod'] == 'Invoice') {
|
|---|
| 479 | $payment_type = $dom->createElement('PaymentType', 'Invoice');
|
|---|
| 480 | $payment_type = $paymentmethod->appendChild($payment_type);
|
|---|
| 481 | $invoice = $dom->createElement('Invoice', '');
|
|---|
| 482 | $invoice = $paymentmethod->appendChild($invoice);
|
|---|
| 483 | $CheckNumber = $dom->createElement('InvoiceCheckNumber', $post['InvoiceCheckNumber']);
|
|---|
| 484 | $CheckNumber = $invoice->appendChild($CheckNumber);
|
|---|
| 485 | } elseif (isset($post['clickandpledge_selectedPaymentMethod']) && $post['clickandpledge_selectedPaymentMethod'] == 'PurchaseOrder') {
|
|---|
| 486 | $payment_type = $dom->createElement('PaymentType', 'PurchaseOrder');
|
|---|
| 487 | $payment_type = $paymentmethod->appendChild($payment_type);
|
|---|
| 488 | $PurchaseOrder = $dom->createElement('PurchaseOrder', '');
|
|---|
| 489 | $PurchaseOrder = $paymentmethod->appendChild($PurchaseOrder);
|
|---|
| 490 | $CheckNumber = $dom->createElement('PurchaseOrderNumber', $post['PurchaseOrderNumber']);
|
|---|
| 491 | $CheckNumber = $PurchaseOrder->appendChild($CheckNumber);
|
|---|
| 492 | } else {
|
|---|
| 493 | $payment_type = $dom->createElement('PaymentType', 'CreditCard');
|
|---|
| 494 | $payment_type = $paymentmethod->appendChild($payment_type);
|
|---|
| 495 |
|
|---|
| 496 | $creditcard = $dom->createElement('CreditCard', '');
|
|---|
| 497 | $creditcard = $paymentmethod->appendChild($creditcard);
|
|---|
| 498 |
|
|---|
| 499 | $credit_card_name = '';
|
|---|
| 500 | if (isset($params['clickandpledge_nameOnCard_First']) && $params['clickandpledge_nameOnCard_First'] != '') {
|
|---|
| 501 | $credit_card_name .= $params['clickandpledge_nameOnCard_First'];
|
|---|
| 502 | }
|
|---|
| 503 | if (isset($params['clickandpledge_nameOnCard_Last']) && $params['clickandpledge_nameOnCard_Last'] != '') {
|
|---|
| 504 | $credit_card_name .= ' ' . $params['clickandpledge_nameOnCard_Last'];
|
|---|
| 505 | }
|
|---|
| 506 |
|
|---|
| 507 | $credit_name = $dom->createElement('NameOnCard', $this->safeString($credit_card_name, 50));
|
|---|
| 508 | $credit_name = $creditcard->appendChild($credit_name);
|
|---|
| 509 |
|
|---|
| 510 | $credit_number = $dom->createElement('CardNumber', $this->safeString(str_replace(' ', '', $params['clickandpledge_cardNumber']), 17));
|
|---|
| 511 | $credit_number = $creditcard->appendChild($credit_number);
|
|---|
| 512 |
|
|---|
| 513 | $credit_cvv = $dom->createElement('Cvv2', $params['clickandpledge_cvc']);
|
|---|
| 514 | $credit_cvv = $creditcard->appendChild($credit_cvv);
|
|---|
| 515 |
|
|---|
| 516 | $credit_expdate = $dom->createElement('ExpirationDate', $params['clickandpledge_cardExpMonth'] . "/" . substr($params['clickandpledge_cardExpYear'], 2, 2));
|
|---|
| 517 | $credit_expdate = $creditcard->appendChild($credit_expdate);
|
|---|
| 518 | }
|
|---|
| 519 |
|
|---|
| 520 | $orderitemlist = $dom->createElement('OrderItemList', '');
|
|---|
| 521 | $orderitemlist = $order->appendChild($orderitemlist);
|
|---|
| 522 |
|
|---|
| 523 | $orderitem = $dom->createElement('OrderItem', '');
|
|---|
| 524 | $orderitem = $orderitemlist->appendChild($orderitem);
|
|---|
| 525 |
|
|---|
| 526 | $itemid = $dom->createElement('ItemID', 1);
|
|---|
| 527 | $itemid = $orderitem->appendChild($itemid);
|
|---|
| 528 |
|
|---|
| 529 | $itemname = $dom->createElement('ItemName', $this->safeString(trim($orderdetails['ItemName']), 100));
|
|---|
| 530 | $itemname = $orderitem->appendChild($itemname);
|
|---|
| 531 |
|
|---|
| 532 | $quntity = $dom->createElement('Quantity', 1);
|
|---|
| 533 | $quntity = $orderitem->appendChild($quntity);
|
|---|
| 534 | $line_subtotal = $params['clickandpledge_Amount'];
|
|---|
| 535 | if (isset($params['clickandpledge_isRecurring']) && $params['clickandpledge_isRecurring'] == 'true') {
|
|---|
| 536 | if ($params['clickandpledge_RecurringMethod'] == 'Installment') {
|
|---|
| 537 | if (isset($params['clickandpledge_indefinite']) && $params['clickandpledge_indefinite'] == 'true') {
|
|---|
| 538 | $UnitPriceDecimal = ($this->number_format(($line_subtotal / 999), 2, '.', '') * 100);
|
|---|
| 539 | $UnitPriceCalculate += ($this->number_format(($line_subtotal / 999), 2, '.', '') * 1);
|
|---|
| 540 | } else {
|
|---|
| 541 | $UnitPriceDecimal = ($this->number_format(($line_subtotal / $params['clickandpledge_Installment']), 2, '.', '') * 100);
|
|---|
| 542 | $UnitPriceCalculate += ($this->number_format(($line_subtotal / $params['clickandpledge_Installment']), 2, '.', '') * 1);
|
|---|
| 543 | }
|
|---|
| 544 | $unitprice = $dom->createElement('UnitPrice', $UnitPriceDecimal);
|
|---|
| 545 | $unitprice = $orderitem->appendChild($unitprice);
|
|---|
| 546 | } else {
|
|---|
| 547 | $unitprice = $dom->createElement('UnitPrice', ($line_subtotal * 100));
|
|---|
| 548 | $unitprice = $orderitem->appendChild($unitprice);
|
|---|
| 549 | //New Fix
|
|---|
| 550 | $UnitPriceCalculate += ($line_subtotal * 1);
|
|---|
| 551 | }
|
|---|
| 552 | } else {
|
|---|
| 553 | $unitprice = $dom->createElement('UnitPrice', ($line_subtotal * 100));
|
|---|
| 554 | $unitprice = $orderitem->appendChild($unitprice);
|
|---|
| 555 | $UnitPriceCalculate += ($line_subtotal * 1);
|
|---|
| 556 | }
|
|---|
| 557 |
|
|---|
| 558 | //Discount
|
|---|
| 559 | if ($params['clickandpledge_Discount'] > 0) {
|
|---|
| 560 | $order_discount = $params['clickandpledge_Discount'];
|
|---|
| 561 | if (isset($params['clickandpledge_isRecurring']) && $params['clickandpledge_isRecurring'] == 'true') {
|
|---|
| 562 | if ($params['clickandpledge_RecurringMethod'] == 'Installment') {
|
|---|
| 563 | $TotalDiscount = ($order_discount) / $params['clickandpledge_Installment'];
|
|---|
| 564 | $TotalDiscount = $this->number_format($TotalDiscount, 2, '.', '') * 100;
|
|---|
| 565 | } else {
|
|---|
| 566 | $TotalDiscount = $this->number_format($order_discount, 2, '.', '') * 100;
|
|---|
| 567 | }
|
|---|
| 568 | } else {
|
|---|
| 569 | $TotalDiscount = $this->number_format($order_discount, 2, '.', '') * 100;
|
|---|
| 570 | }
|
|---|
| 571 | if ($TotalDiscount > 0) {
|
|---|
| 572 | $unit_disc = $dom->createElement('UnitDiscount', $TotalDiscount);
|
|---|
| 573 | $unit_disc = $orderitem->appendChild($unit_disc);
|
|---|
| 574 | $TotalDiscountCalculate = $TotalDiscount;
|
|---|
| 575 | }
|
|---|
| 576 | }
|
|---|
| 577 |
|
|---|
| 578 | $receipt = $dom->createElement('Receipt', '');
|
|---|
| 579 | $receipt = $order->appendChild($receipt);
|
|---|
| 580 |
|
|---|
| 581 | $recipt_lang = $dom->createElement('Language', 'ENG');
|
|---|
| 582 | $recipt_lang = $receipt->appendChild($recipt_lang);
|
|---|
| 583 |
|
|---|
| 584 | if (isset($params['clickandpledge_OrganizationInformation']) && $params['clickandpledge_OrganizationInformation'] != '') {
|
|---|
| 585 | $recipt_org = $dom->createElement('OrganizationInformation', $this->safeString($params['clickandpledge_OrganizationInformation'], 1500));
|
|---|
| 586 | $recipt_org = $receipt->appendChild($recipt_org);
|
|---|
| 587 | }
|
|---|
| 588 |
|
|---|
| 589 | if (isset($params['clickandpledge_TermsCondition']) && $params['clickandpledge_TermsCondition'] != '') {
|
|---|
| 590 | $recipt_terms = $dom->createElement('TermsCondition', $this->safeString($params['clickandpledge_TermsCondition'], 1500));
|
|---|
| 591 | $recipt_terms = $receipt->appendChild($recipt_terms);
|
|---|
| 592 | }
|
|---|
| 593 |
|
|---|
| 594 | if (isset($params['clickandpledge_email_customer']) && $params['clickandpledge_email_customer'] == 'yes') { //Sending the email based on admin settings
|
|---|
| 595 | $recipt_email = $dom->createElement('EmailNotificationList', '');
|
|---|
| 596 | $recipt_email = $receipt->appendChild($recipt_email);
|
|---|
| 597 |
|
|---|
| 598 | $email_notification = '';
|
|---|
| 599 | if (isset($params['billing_email']) && $params['billing_email'] != '') {
|
|---|
| 600 | $email_notification = $params['billing_email'];
|
|---|
| 601 | }
|
|---|
| 602 |
|
|---|
| 603 | $email_note = $dom->createElement('NotificationEmail', $email_notification);
|
|---|
| 604 | $email_note = $recipt_email->appendChild($email_note);
|
|---|
| 605 | }
|
|---|
| 606 | $transation = $dom->createElement('Transaction', '');
|
|---|
| 607 | $transation = $order->appendChild($transation);
|
|---|
| 608 |
|
|---|
| 609 | $trans_type = $dom->createElement('TransactionType', 'Payment');
|
|---|
| 610 | $trans_type = $transation->appendChild($trans_type);
|
|---|
| 611 |
|
|---|
| 612 | $trans_desc = $dom->createElement('DynamicDescriptor', 'DynamicDescriptor');
|
|---|
| 613 | $trans_desc = $transation->appendChild($trans_desc);
|
|---|
| 614 |
|
|---|
| 615 |
|
|---|
| 616 | if (isset($params['clickandpledge_isRecurring']) && $params['clickandpledge_isRecurring'] == 'true') {
|
|---|
| 617 | $trans_recurr = $dom->createElement('Recurring', '');
|
|---|
| 618 | $trans_recurr = $transation->appendChild($trans_recurr);
|
|---|
| 619 | if (isset($params['clickandpledge_indefinite']) && $params['clickandpledge_indefinite'] == 'true') {
|
|---|
| 620 | $total_installment = $dom->createElement('Installment', 999);
|
|---|
| 621 | $total_installment = $trans_recurr->appendChild($total_installment);
|
|---|
| 622 | } else {
|
|---|
| 623 | if ($params['clickandpledge_Installment'] != '') {
|
|---|
| 624 | $total_installment = $dom->createElement('Installment', $params['clickandpledge_Installment']);
|
|---|
| 625 | $total_installment = $trans_recurr->appendChild($total_installment);
|
|---|
| 626 | } else {
|
|---|
| 627 | $total_installment = $dom->createElement('Installment', 1);
|
|---|
| 628 | $total_installment = $trans_recurr->appendChild($total_installment);
|
|---|
| 629 | }
|
|---|
| 630 | }
|
|---|
| 631 | $total_periodicity = $dom->createElement('Periodicity', $params['clickandpledge_Periodicity']);
|
|---|
| 632 | $total_periodicity = $trans_recurr->appendChild($total_periodicity);
|
|---|
| 633 |
|
|---|
| 634 | if (isset($params['clickandpledge_RecurringMethod'])) {
|
|---|
| 635 | $RecurringMethod = $dom->createElement('RecurringMethod', $params['clickandpledge_RecurringMethod']);
|
|---|
| 636 | $RecurringMethod = $trans_recurr->appendChild($RecurringMethod);
|
|---|
| 637 | } else {
|
|---|
| 638 | $RecurringMethod = $dom->createElement('RecurringMethod', 'Subscription');
|
|---|
| 639 | $RecurringMethod = $trans_recurr->appendChild($RecurringMethod);
|
|---|
| 640 | }
|
|---|
| 641 | }
|
|---|
| 642 |
|
|---|
| 643 | $trans_totals = $dom->createElement('CurrentTotals', '');
|
|---|
| 644 | $trans_totals = $transation->appendChild($trans_totals);
|
|---|
| 645 | if ($TotalDiscountCalculate > 0) {
|
|---|
| 646 | $total_discount = $dom->createElement('TotalDiscount', $TotalDiscountCalculate);
|
|---|
| 647 | $total_discount = $trans_totals->appendChild($total_discount);
|
|---|
| 648 | }
|
|---|
| 649 |
|
|---|
| 650 | if (isset($params['clickandpledge_isRecurring']) && $params['clickandpledge_isRecurring'] == 'true') {
|
|---|
| 651 | if ($params['clickandpledge_RecurringMethod'] == 'Installment') {
|
|---|
| 652 | $Total = $this->number_format($UnitPriceCalculate, 2, '.', '') * 100 - $TotalDiscountCalculate;
|
|---|
| 653 | $total_amount = $dom->createElement('Total', $Total);
|
|---|
| 654 | $total_amount = $trans_totals->appendChild($total_amount);
|
|---|
| 655 | } else {
|
|---|
| 656 | $Total = $this->number_format($UnitPriceCalculate, 2, '.', '') * 100 - $TotalDiscountCalculate;
|
|---|
| 657 | ;
|
|---|
| 658 | $total_amount = $dom->createElement('Total', $Total);
|
|---|
| 659 | $total_amount = $trans_totals->appendChild($total_amount);
|
|---|
| 660 | }
|
|---|
| 661 | } else {
|
|---|
| 662 | $Total = $this->number_format($UnitPriceCalculate, 2, '.', '') * 100 - $TotalDiscountCalculate;
|
|---|
| 663 | ;
|
|---|
| 664 | $total_amount = $dom->createElement('Total', $Total);
|
|---|
| 665 | $total_amount = $trans_totals->appendChild($total_amount);
|
|---|
| 666 | }
|
|---|
| 667 |
|
|---|
| 668 | if ($TotalDiscountCalculate > 0) {
|
|---|
| 669 | if (isset($post['clickandpledge_coupon_code']) && $post['clickandpledge_coupon_code'] != '') {
|
|---|
| 670 | $trans_coupon = $dom->createElement('CouponCode', $post['clickandpledge_coupon_code']);
|
|---|
| 671 | $trans_coupon = $transation->appendChild($trans_coupon);
|
|---|
| 672 | }
|
|---|
| 673 | }
|
|---|
| 674 |
|
|---|
| 675 | $strParam = $dom->saveXML();
|
|---|
| 676 | //die();
|
|---|
| 677 | return $strParam;
|
|---|
| 678 | }
|
|---|
| 679 |
|
|---|
| 680 | public function getEngine()
|
|---|
| 681 | {
|
|---|
| 682 | return "clickandpledge_payment";
|
|---|
| 683 | }
|
|---|
| 684 | public function getTitle()
|
|---|
| 685 | {
|
|---|
| 686 | return "Click & Pledge";
|
|---|
| 687 | }
|
|---|
| 688 |
|
|---|
| 689 | public function getForm()
|
|---|
| 690 | {
|
|---|
| 691 | return "Config_ClickandPledge";
|
|---|
| 692 | }
|
|---|
| 693 |
|
|---|
| 694 |
|
|---|
| 695 |
|
|---|
| 696 | public function processTransaction()
|
|---|
| 697 | {
|
|---|
| 698 | return array(
|
|---|
| 699 | "external_id" => $this->_post['token'],
|
|---|
| 700 | "paid" => $this->_post['clickandpledge_Amount'] - $this->_post['clickandpledge_Discount']
|
|---|
| 701 | );
|
|---|
| 702 | }
|
|---|
| 703 | public function bind(array $post, array $get)
|
|---|
| 704 | {
|
|---|
| 705 | // this is a good place to set $this->data
|
|---|
| 706 | $this->setObject(new Wpjb_Model_Payment($post["id"]));
|
|---|
| 707 | parent::bind($post, $get);
|
|---|
| 708 | }
|
|---|
| 709 | private function getMerchant()
|
|---|
| 710 | {
|
|---|
| 711 | $merchant = array();
|
|---|
| 712 | //USD Account
|
|---|
| 713 | $merchant['wpjobboard_clickandpledge_usdaccount'] = $this->conf('wpjobboard_clickandpledge_usdaccount');
|
|---|
| 714 | $merchant['wpjobboard_clickandpledge_USD_AccountID'] = $this->conf('wpjobboard_clickandpledge_USD_AccountID');
|
|---|
| 715 | $merchant['wpjobboard_clickandpledge_USD_AccountGuid'] = $this->conf('wpjobboard_clickandpledge_USD_AccountGuid');
|
|---|
| 716 | $merchant['wpjobboard_clickandpledge_USD_OrderMode'] = $this->conf('wpjobboard_clickandpledge_USD_OrderMode');
|
|---|
| 717 |
|
|---|
| 718 | //EUR Account
|
|---|
| 719 | $merchant['wpjobboard_clickandpledge_euraccount'] = $this->conf('wpjobboard_clickandpledge_euraccount');
|
|---|
| 720 | $merchant['wpjobboard_clickandpledge_EUR_AccountID'] = $this->conf('wpjobboard_clickandpledge_EUR_AccountID');
|
|---|
| 721 | $merchant['wpjobboard_clickandpledge_EUR_AccountGuid'] = $this->conf('wpjobboard_clickandpledge_EUR_AccountGuid');
|
|---|
| 722 | $merchant['wpjobboard_clickandpledge_EUR_OrderMode'] = $this->conf('wpjobboard_clickandpledge_EUR_OrderMode');
|
|---|
| 723 |
|
|---|
| 724 | //CAD Account
|
|---|
| 725 | $merchant['wpjobboard_clickandpledge_cadaccount'] = $this->conf('wpjobboard_clickandpledge_cadaccount');
|
|---|
| 726 | $merchant['wpjobboard_clickandpledge_CAD_AccountID'] = $this->conf('wpjobboard_clickandpledge_CAD_AccountID');
|
|---|
| 727 | $merchant['wpjobboard_clickandpledge_CAD_AccountGuid'] = $this->conf('wpjobboard_clickandpledge_CAD_AccountGuid');
|
|---|
| 728 | $merchant['wpjobboard_clickandpledge_CAD_OrderMode'] = $this->conf('wpjobboard_clickandpledge_CAD_OrderMode');
|
|---|
| 729 |
|
|---|
| 730 | //GBP Account
|
|---|
| 731 | $merchant['wpjobboard_clickandpledge_gbpaccount'] = $this->conf('wpjobboard_clickandpledge_gbpaccount');
|
|---|
| 732 | $merchant['wpjobboard_clickandpledge_GBP_AccountID'] = $this->conf('wpjobboard_clickandpledge_GBP_AccountID');
|
|---|
| 733 | $merchant['wpjobboard_clickandpledge_GBP_AccountGuid'] = $this->conf('wpjobboard_clickandpledge_GBP_AccountGuid');
|
|---|
| 734 | $merchant['wpjobboard_clickandpledge_GBP_OrderMode'] = $this->conf('wpjobboard_clickandpledge_GBP_OrderMode');
|
|---|
| 735 |
|
|---|
| 736 | //HKD Account
|
|---|
| 737 | $merchant['wpjobboard_clickandpledge_hkdaccount'] = $this->conf('wpjobboard_clickandpledge_hkdaccount');
|
|---|
| 738 | $merchant['wpjobboard_clickandpledge_HKD_AccountID'] = $this->conf('wpjobboard_clickandpledge_HKD_AccountID');
|
|---|
| 739 | $merchant['wpjobboard_clickandpledge_HKD_AccountGuid'] = $this->conf('wpjobboard_clickandpledge_HKD_AccountGuid');
|
|---|
| 740 | $merchant['wpjobboard_clickandpledge_HKD_OrderMode'] = $this->conf('wpjobboard_clickandpledge_HKD_OrderMode');
|
|---|
| 741 |
|
|---|
| 742 | //Payment Methods
|
|---|
| 743 | $merchant['wpjobboard_clickandpledge_Paymentmethods'] = $this->conf('wpjobboard_clickandpledge_Paymentmethods');
|
|---|
| 744 | //Default Payment Method
|
|---|
| 745 | $merchant['wpjobboard_clickandpledge_DefaultpaymentMethod'] = $this->conf('wpjobboard_clickandpledge_DefaultpaymentMethod');
|
|---|
| 746 |
|
|---|
| 747 | //Receipt Settings
|
|---|
| 748 | $merchant['wpjobboard_clickandpledge_emailcustomer'] = $this->conf('wpjobboard_clickandpledge_emailcustomer');
|
|---|
| 749 | $merchant['wpjobboard_clickandpledge_OrganizationInformation'] = $this->conf('wpjobboard_clickandpledge_OrganizationInformation');
|
|---|
| 750 | $merchant['wpjobboard_clickandpledge_TermsCondition'] = $this->conf('wpjobboard_clickandpledge_TermsCondition');
|
|---|
| 751 |
|
|---|
| 752 | //Recurring Settings
|
|---|
| 753 | $merchant['wpjobboard_clickandpledge_isRecurring'] = $this->conf('wpjobboard_clickandpledge_isRecurring');
|
|---|
| 754 | $merchant['wpjobboard_clickandpledge_RecurringLabel'] = $this->conf('wpjobboard_clickandpledge_RecurringLabel');
|
|---|
| 755 | $merchant['wpjobboard_clickandpledge_Periodicity'] = $this->conf('wpjobboard_clickandpledge_Periodicity');
|
|---|
| 756 | $merchant['wpjobboard_clickandpledge_RecurringMethod_Subscription'] = $this->conf('wpjobboard_clickandpledge_RecurringMethod_Subscription');
|
|---|
| 757 | $merchant['wpjobboard_clickandpledge_maxrecurrings_Subscription'] = $this->conf('wpjobboard_clickandpledge_maxrecurrings_Subscription');
|
|---|
| 758 | $merchant['wpjobboard_clickandpledge_RecurringMethod_Installment'] = $this->conf('wpjobboard_clickandpledge_RecurringMethod_Installment');
|
|---|
| 759 | $merchant['wpjobboard_clickandpledge_maxrecurrings_Installment'] = $this->conf('wpjobboard_clickandpledge_maxrecurrings_Installment');
|
|---|
| 760 | $merchant['wpjobboard_clickandpledge_indefinite'] = $this->conf('wpjobboard_clickandpledge_indefinite');
|
|---|
| 761 | return $merchant;
|
|---|
| 762 | }
|
|---|
| 763 | public function render()
|
|---|
| 764 | {
|
|---|
| 765 | $data = $this->_data;
|
|---|
| 766 | $id = $this->_data->id;
|
|---|
| 767 | $availableCurrencies = array();
|
|---|
| 768 | $paymentMethods = array();
|
|---|
| 769 | $merchant = $this->getMerchant();
|
|---|
| 770 |
|
|---|
| 771 |
|
|---|
| 772 | //echo '<pre>';
|
|---|
| 773 | //print_r($_POST);
|
|---|
| 774 | if (isset($merchant['wpjobboard_clickandpledge_usdaccount']) && $merchant['wpjobboard_clickandpledge_usdaccount'] != '')
|
|---|
| 775 | array_push($availableCurrencies, 'USD');
|
|---|
| 776 | if (isset($merchant['wpjobboard_clickandpledge_euraccount']) && $merchant['wpjobboard_clickandpledge_euraccount'] != '')
|
|---|
| 777 | array_push($availableCurrencies, 'EUR');
|
|---|
| 778 | if (isset($merchant['wpjobboard_clickandpledge_cadaccount']) && $merchant['wpjobboard_clickandpledge_cadaccount'] != '')
|
|---|
| 779 | array_push($availableCurrencies, 'CAD');
|
|---|
| 780 | if (isset($merchant['wpjobboard_clickandpledge_gbpaccount']) && $merchant['wpjobboard_clickandpledge_gbpaccount'] != '')
|
|---|
| 781 | array_push($availableCurrencies, 'GBP');
|
|---|
| 782 | if (isset($merchant['wpjobboard_clickandpledge_hkdaccount']) && $merchant['wpjobboard_clickandpledge_hkdaccount'] != '')
|
|---|
| 783 | array_push($availableCurrencies, 'HKD');
|
|---|
| 784 |
|
|---|
| 785 |
|
|---|
| 786 | $selectedCurrency = $this->_data->payment_currency;
|
|---|
| 787 | if (in_array($selectedCurrency, $availableCurrencies)) {
|
|---|
| 788 | if (isset($merchant['wpjobboard_clickandpledge_Paymentmethods']) && count($merchant['wpjobboard_clickandpledge_Paymentmethods']) > 0) {
|
|---|
| 789 | foreach ($merchant['wpjobboard_clickandpledge_Paymentmethods'] as $method) {
|
|---|
| 790 | if ($method == 'CreditCard')
|
|---|
| 791 | $paymentMethods[$method] = 'Credit Card';
|
|---|
| 792 | if ($method == 'eCheck')
|
|---|
| 793 | $paymentMethods[$method] = 'eCheck';
|
|---|
| 794 | if ($method == 'PurchaseOrder')
|
|---|
| 795 | $paymentMethods[$method] = 'Purchase Order';
|
|---|
| 796 | if ($method == 'Invoice')
|
|---|
| 797 | $paymentMethods[$method] = 'Invoice';
|
|---|
| 798 | }
|
|---|
| 799 | } else {
|
|---|
| 800 | $paymentMethods['CreditCard'] = 'Credit Card';
|
|---|
| 801 | $paymentMethods['eCheck'] = 'eCheck';
|
|---|
| 802 | $paymentMethods['PurchaseOrder'] = 'Purchase Order';
|
|---|
| 803 | $paymentMethods['Invoice'] = 'Invoice';
|
|---|
| 804 | }
|
|---|
| 805 |
|
|---|
| 806 | $defaultpayment = 'CreditCard';
|
|---|
| 807 | if ($merchant['wpjobboard_clickandpledge_DefaultpaymentMethod'] != '')
|
|---|
| 808 | $defaultpayment = $merchant['wpjobboard_clickandpledge_DefaultpaymentMethod'];
|
|---|
| 809 |
|
|---|
| 810 |
|
|---|
| 811 |
|
|---|
| 812 | $ajaxurl = admin_url("admin-ajax.php");
|
|---|
| 813 |
|
|---|
| 814 | wp_register_script('clickandpledge-plugin-script', plugins_url('/clickandpledge.js', __FILE__));
|
|---|
| 815 | wp_enqueue_script('clickandpledge-plugin-script');
|
|---|
| 816 |
|
|---|
| 817 | wp_register_script('jquery.validate.min-script', plugins_url('/jquery.validate.min.js', __FILE__));
|
|---|
| 818 | wp_enqueue_script('jquery.validate.min-script');
|
|---|
| 819 |
|
|---|
| 820 | wp_register_script('clickandpledge_validations-script', plugins_url('/clickandpledge_validations.js', __FILE__));
|
|---|
| 821 | wp_enqueue_script('clickandpledge_validations-script');
|
|---|
| 822 | // global $html;
|
|---|
| 823 | $html = '
|
|---|
| 824 | <style type="text/css">
|
|---|
| 825 | .form-row > label > span {
|
|---|
| 826 | display: block;
|
|---|
| 827 | width: 200px;
|
|---|
| 828 | float: left;
|
|---|
| 829 | line-height: 2em;
|
|---|
| 830 | }
|
|---|
| 831 | .form-row label.error {
|
|---|
| 832 | color: red;
|
|---|
| 833 | font-style: italic;
|
|---|
| 834 | }
|
|---|
| 835 | </style>
|
|---|
| 836 | <script type="text/javascript">
|
|---|
| 837 | var WPJB_PAYMENT_ID = ' . $id . ';
|
|---|
| 838 | if (typeof ajaxurl === "undefined") {
|
|---|
| 839 | ajaxurl = "' . $ajaxurl . '";
|
|---|
| 840 | }
|
|---|
| 841 | </script>
|
|---|
| 842 | <form action="" method="POST" id="payment-form">
|
|---|
| 843 | <h3>' . __("Click & Pledge", "wpjobboard") . '</h3>
|
|---|
| 844 | <div class="payment-errors"></div>
|
|---|
| 845 | <div class="htmlholder">
|
|---|
| 846 | ';
|
|---|
| 847 |
|
|---|
| 848 | if (count($paymentMethods) > 0) {
|
|---|
| 849 | $html .= '<span style="width:980px" id="payment_methods">';
|
|---|
| 850 | foreach ($paymentMethods as $pkey => $pval) {
|
|---|
| 851 | //print_r($pval);die('fff');
|
|---|
| 852 | if ($pkey == $defaultpayment) {
|
|---|
| 853 | $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> <b>' . $pval . '</b> ';
|
|---|
| 854 | } else {
|
|---|
| 855 | $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> ';
|
|---|
| 856 | }
|
|---|
| 857 | }
|
|---|
| 858 | $html .= '</span>';
|
|---|
| 859 | }
|
|---|
| 860 |
|
|---|
| 861 | $html .= '<script>
|
|---|
| 862 | jQuery("#cnp_payment_method_selection_CreditCard").click(function(){
|
|---|
| 863 | jQuery("#cnp_CreditCard_div").show();
|
|---|
| 864 | jQuery("#cnp_eCheck_div").hide();
|
|---|
| 865 | jQuery("#cnp_Invoice_div").hide();
|
|---|
| 866 | jQuery("#cnp_PurchaseOrder_div").hide();
|
|---|
| 867 |
|
|---|
| 868 | });
|
|---|
| 869 | jQuery("#cnp_payment_method_selection_eCheck").click(function(){
|
|---|
| 870 | jQuery("#cnp_CreditCard_div").hide();
|
|---|
| 871 | jQuery("#cnp_eCheck_div").show();
|
|---|
| 872 | jQuery("#cnp_Invoice_div").hide();
|
|---|
| 873 | jQuery("#cnp_PurchaseOrder_div").hide();
|
|---|
| 874 |
|
|---|
| 875 | });
|
|---|
| 876 | jQuery("#cnp_payment_method_selection_Invoice").click(function(){
|
|---|
| 877 | jQuery("#cnp_CreditCard_div").hide();
|
|---|
| 878 | jQuery("#cnp_eCheck_div").hide();
|
|---|
| 879 | jQuery("#cnp_Invoice_div").show();
|
|---|
| 880 | jQuery("#cnp_PurchaseOrder_div").hide();
|
|---|
| 881 |
|
|---|
| 882 | });
|
|---|
| 883 | jQuery("#cnp_payment_method_selection_PurchaseOrder").click(function(){
|
|---|
| 884 | jQuery("#cnp_CreditCard_div").hide();
|
|---|
| 885 | jQuery("#cnp_eCheck_div").hide();
|
|---|
| 886 | jQuery("#cnp_Invoice_div").hide();
|
|---|
| 887 | jQuery("#cnp_PurchaseOrder_div").show();
|
|---|
| 888 |
|
|---|
| 889 | });
|
|---|
| 890 | </script>';
|
|---|
| 891 | $cdivdisplay = ($defaultpayment == 'CreditCard') ? 'block' : 'none';
|
|---|
| 892 | $recurringhtml = '';
|
|---|
| 893 | // echo $merchant['wpjobboard_clickandpledge_isRecurring'].'############';
|
|---|
| 894 | // die();
|
|---|
| 895 | if (isset($merchant['wpjobboard_clickandpledge_isRecurring']) && $merchant['wpjobboard_clickandpledge_isRecurring'] == 1) {
|
|---|
| 896 | if ($merchant['wpjobboard_clickandpledge_RecurringLabel'] != '') {
|
|---|
| 897 | $recurringhtml .= '<br><div class="form-row" id="clickandpledge_isRecurring_div">
|
|---|
| 898 | <label>
|
|---|
| 899 | <span>' . __($merchant['wpjobboard_clickandpledge_RecurringLabel'], "wpjobboard") . '</span>
|
|---|
| 900 | <input type="checkbox" name="clickandpledge_isRecurring" id="clickandpledge_isRecurring"/>
|
|---|
| 901 | </label>
|
|---|
| 902 | </div>';
|
|---|
| 903 | } else {
|
|---|
| 904 | $recurringhtml .= '<br><div class="form-row" id="clickandpledge_isRecurring_div">
|
|---|
| 905 | <label>
|
|---|
| 906 | <span>' . __('Is this Recurring Payment?', "wpjobboard") . '</span>
|
|---|
| 907 | <input type="checkbox" name="clickandpledge_isRecurring" id="clickandpledge_isRecurring"/>
|
|---|
| 908 | </label>
|
|---|
| 909 | </div>';
|
|---|
| 910 | }
|
|---|
| 911 | $RecurringMethod = array();
|
|---|
| 912 | if (isset($merchant['wpjobboard_clickandpledge_RecurringMethod_Subscription']) && is_array($merchant['wpjobboard_clickandpledge_RecurringMethod_Subscription']) && count($merchant['wpjobboard_clickandpledge_RecurringMethod_Subscription']) > 0) {
|
|---|
| 913 | array_push($RecurringMethod, 'Subscription');
|
|---|
| 914 | }
|
|---|
| 915 | if (isset($merchant['wpjobboard_clickandpledge_RecurringMethod_Installment']) && is_array($merchant['wpjobboard_clickandpledge_RecurringMethod_Installment']) && count($merchant['wpjobboard_clickandpledge_RecurringMethod_Installment']) > 0) {
|
|---|
| 916 | array_push($RecurringMethod, 'Installment');
|
|---|
| 917 | }
|
|---|
| 918 | if (count($RecurringMethod) == 0) {
|
|---|
| 919 | array_push($RecurringMethod, 'Subscription');
|
|---|
| 920 | array_push($RecurringMethod, 'Installment');
|
|---|
| 921 | }
|
|---|
| 922 | if (count($RecurringMethod) > 0) {
|
|---|
| 923 | if (count($RecurringMethod) == 1) {
|
|---|
| 924 | $recurringhtml .= '<input type="hidden" name="clickandpledge_RecurringMethod" id="clickandpledge_RecurringMethod" value="' . $RecurringMethod[0] . '">';
|
|---|
| 925 | } else {
|
|---|
| 926 | $recurringhtml .= '<br><div class="form-row" id="clickandpledge_RecurringMethod_div">
|
|---|
| 927 | <label>
|
|---|
| 928 | <span>' . __("Recurring Method", "wpjobboard") . '</span>
|
|---|
| 929 | <select id="clickandpledge_RecurringMethod" name="clickandpledge_RecurringMethod">';
|
|---|
| 930 | foreach ($RecurringMethod as $r) {
|
|---|
| 931 | $recurringhtml .= '<option value="' . $r . '">' . $r . '</option>';
|
|---|
| 932 | }
|
|---|
| 933 | $recurringhtml .= '</select>
|
|---|
| 934 | </label>
|
|---|
| 935 | </div>';
|
|---|
| 936 | }
|
|---|
| 937 | } else {
|
|---|
| 938 | $recurringhtml .= '<div class="form-row" id="clickandpledge_RecurringMethod_div">
|
|---|
| 939 | <label>
|
|---|
| 940 | <span>' . __("Recurring Method", "wpjobboard") . '</span>
|
|---|
| 941 | <select id="clickandpledge_RecurringMethod" name="clickandpledge_RecurringMethod">
|
|---|
| 942 | <option value="Subscription">Subscription</option>
|
|---|
| 943 | <option value="Installment">Installment</option>
|
|---|
| 944 | </select>
|
|---|
| 945 | </label>
|
|---|
| 946 | </div>';
|
|---|
| 947 | }
|
|---|
| 948 |
|
|---|
| 949 | if (isset($merchant['wpjobboard_clickandpledge_indefinite']) && is_array($merchant['wpjobboard_clickandpledge_indefinite']) && count($merchant['wpjobboard_clickandpledge_indefinite']) > 0) {
|
|---|
| 950 | $recurringhtml .= '<br><div class="form-row" id="clickandpledge_indefinite_div">
|
|---|
| 951 | <label>
|
|---|
| 952 | <span>' . __("Indefinite Recurring", "wpjobboard") . '</span>
|
|---|
| 953 | <input type="checkbox" name="clickandpledge_indefinite" id="clickandpledge_indefinite"/>
|
|---|
| 954 | </label>
|
|---|
| 955 | </div>';
|
|---|
| 956 | }
|
|---|
| 957 |
|
|---|
| 958 | if (isset($merchant['wpjobboard_clickandpledge_Periodicity']) && is_array($merchant['wpjobboard_clickandpledge_Periodicity']) && count($merchant['wpjobboard_clickandpledge_Periodicity']) > 0) {
|
|---|
| 959 | $recurringhtml .= '<br><div class="form-row" id="clickandpledge_Periodicity_div">
|
|---|
| 960 | <label>
|
|---|
| 961 | <span>' . __("Every", "wpjobboard") . '</span>
|
|---|
| 962 | <select id="clickandpledge_Periodicity" name="clickandpledge_Periodicity">';
|
|---|
| 963 | foreach ($merchant['wpjobboard_clickandpledge_Periodicity'] as $r) {
|
|---|
| 964 | $recurringhtml .= '<option value="' . $r . '">' . $r . '</option>';
|
|---|
| 965 | }
|
|---|
| 966 | $recurringhtml .= '</select>
|
|---|
| 967 | </label>
|
|---|
| 968 | <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>
|
|---|
| 969 | </div>
|
|---|
| 970 | <script>
|
|---|
| 971 | jQuery("#clickandpledge_Installment").keypress(function(e) {
|
|---|
| 972 | var a = [];
|
|---|
| 973 | var k = e.which;
|
|---|
| 974 |
|
|---|
| 975 | for (i = 48; i < 58; i++)
|
|---|
| 976 | a.push(i);
|
|---|
| 977 |
|
|---|
| 978 | if (!(a.indexOf(k)>=0))
|
|---|
| 979 | e.preventDefault();
|
|---|
| 980 | });
|
|---|
| 981 | </script>';
|
|---|
| 982 | } else {
|
|---|
| 983 | $Periodicity = array();
|
|---|
| 984 | $Periodicity['Week'] = 'Week';
|
|---|
| 985 | $Periodicity['2 Weeks'] = '2 Weeks';
|
|---|
| 986 | $Periodicity['Month'] = 'Month';
|
|---|
| 987 | $Periodicity['2 Months'] = '2 Months';
|
|---|
| 988 | $Periodicity['Quarter'] = 'Quarter';
|
|---|
| 989 | $Periodicity['6 Months'] = '6 Months';
|
|---|
| 990 | $Periodicity['Year'] = 'Year';
|
|---|
| 991 | $recurringhtml .= '<br><div class="form-row" id="clickandpledge_Periodicity_div">
|
|---|
| 992 | <label>
|
|---|
| 993 | <span>' . __("Every", "wpjobboard") . '</span>
|
|---|
| 994 | <select id="clickandpledge_Periodicity" name="clickandpledge_Periodicity">';
|
|---|
| 995 | foreach ($Periodicity as $k => $v) {
|
|---|
| 996 | $recurringhtml .= '<option value="' . $k . '">' . $v . '</option>';
|
|---|
| 997 | }
|
|---|
| 998 | $recurringhtml .= '</select>
|
|---|
| 999 | </label>
|
|---|
| 1000 | <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>
|
|---|
| 1001 | </div>
|
|---|
| 1002 | <script>
|
|---|
| 1003 | jQuery("#clickandpledge_Installment").keypress(function(e) {
|
|---|
| 1004 | var a = [];
|
|---|
| 1005 | var k = e.which;
|
|---|
| 1006 |
|
|---|
| 1007 | for (i = 48; i < 58; i++)
|
|---|
| 1008 | a.push(i);
|
|---|
| 1009 |
|
|---|
| 1010 | if (!(a.indexOf(k)>=0))
|
|---|
| 1011 | e.preventDefault();
|
|---|
| 1012 | });
|
|---|
| 1013 | </script>';
|
|---|
| 1014 | }
|
|---|
| 1015 |
|
|---|
| 1016 | }
|
|---|
| 1017 | //echo $recurringhtml;
|
|---|
| 1018 | //die('333333333333');
|
|---|
| 1019 | $clickandpledgename_CreditCard = '<div class="form-row cnp_payment_style" >
|
|---|
| 1020 | <label>
|
|---|
| 1021 | <span>' . __("Name <font color='red'>*</font>", "wpjobboard") . '</span>
|
|---|
| 1022 | <input type="text" size="20" data-clickandpledge="number" name="clickandpledge_FirstName_CreditCard" id="clickandpledge_FirstName_CreditCard" class="required NameOnCard" placeholder="First Name"/>
|
|---|
| 1023 | <input type="text" size="20" data-clickandpledge="number" name="clickandpledge_LastName_CreditCard" id="clickandpledge_LastName_CreditCard" class="required NameOnCard" placeholder="Last Name"/>
|
|---|
| 1024 | </label>
|
|---|
| 1025 | </div>
|
|---|
| 1026 | <style>
|
|---|
| 1027 | .cnp_payment_style label span{
|
|---|
| 1028 | width: 100%;
|
|---|
| 1029 | }
|
|---|
| 1030 | #clickandpledge_FirstName_CreditCard, #clickandpledge_LastName_CreditCard {
|
|---|
| 1031 | width: 48%;
|
|---|
| 1032 | display: inline-block;
|
|---|
| 1033 | }
|
|---|
| 1034 | </style>
|
|---|
| 1035 | ';
|
|---|
| 1036 | $clickandpledgename_eCheck = '<div class="form-row cnp_payment_style" >
|
|---|
| 1037 | <label>
|
|---|
| 1038 | <span>' . __("Name <font color='red'>*</font>", "wpjobboard") . '</span>
|
|---|
| 1039 | <input type="text" size="20" data-clickandpledge="number" name="clickandpledge_FirstName_eCheck" id="clickandpledge_FirstName_eCheck" class="required NameOnCard" placeholder="First Name"/>
|
|---|
| 1040 | <input type="text" size="20" data-clickandpledge="number" name="clickandpledge_LastName_eCheck" id="clickandpledge_LastName_eCheck" class="required NameOnCard" placeholder="Last Name"/>
|
|---|
| 1041 | </label>
|
|---|
| 1042 | </div>
|
|---|
| 1043 | <style>
|
|---|
| 1044 | .cnp_payment_style label span{
|
|---|
| 1045 | width: 100%;
|
|---|
| 1046 | }
|
|---|
| 1047 | #clickandpledge_FirstName_eCheck, #clickandpledge_LastName_eCheck {
|
|---|
| 1048 | width: 48%;
|
|---|
| 1049 | display: inline-block;
|
|---|
| 1050 | }
|
|---|
| 1051 | </style>
|
|---|
| 1052 | ';
|
|---|
| 1053 | $clickandpledgename_Invoice = '<div class="form-row cnp_payment_style" >
|
|---|
| 1054 | <label>
|
|---|
| 1055 | <span>' . __("Name <font color='red'>*</font>", "wpjobboard") . '</span>
|
|---|
| 1056 | <input type="text" size="20" data-clickandpledge="number" name="clickandpledge_FirstName_Invoice" id="clickandpledge_FirstName_Invoice" class="required NameOnCard" placeholder="First Name"/>
|
|---|
| 1057 | <input type="text" size="20" data-clickandpledge="number" name="clickandpledge_LastName_Invoice" id="clickandpledge_LastName_Invoice" class="required NameOnCard" placeholder="Last Name"/>
|
|---|
| 1058 | </label>
|
|---|
| 1059 | </div>
|
|---|
| 1060 | <style>
|
|---|
| 1061 | .cnp_payment_style label span{
|
|---|
| 1062 | width: 100%;
|
|---|
| 1063 | }
|
|---|
| 1064 | #clickandpledge_FirstName_Invoice, #clickandpledge_LastName_Invoice {
|
|---|
| 1065 | width: 48%;
|
|---|
| 1066 | display: inline-block;
|
|---|
| 1067 | }
|
|---|
| 1068 | </style> ';
|
|---|
| 1069 | $clickandpledgename_PO = '<div class="form-row cnp_payment_style" >
|
|---|
| 1070 | <label>
|
|---|
| 1071 | <span>' . __("Name <font color='red'>*</font>", "wpjobboard") . '</span>
|
|---|
| 1072 | <input type="text" size="20" data-clickandpledge="number" name="clickandpledge_FirstName_PO" id="clickandpledge_FirstName_PO" class="required NameOnCard" placeholder="First Name"/>
|
|---|
| 1073 | <input type="text" size="20" data-clickandpledge="number" name="clickandpledge_LastName_PO" id="clickandpledge_LastName_PO" class="required NameOnCard" placeholder="Last Name"/>
|
|---|
| 1074 | </label>
|
|---|
| 1075 | </div>
|
|---|
| 1076 | <style>
|
|---|
| 1077 | .cnp_payment_style label span{
|
|---|
| 1078 | width: 100%;
|
|---|
| 1079 | }
|
|---|
| 1080 | #clickandpledge_FirstName_PO, #clickandpledge_LastName_PO {
|
|---|
| 1081 | width: 48%;
|
|---|
| 1082 | display: inline-block;
|
|---|
| 1083 | }
|
|---|
| 1084 | </style> ';
|
|---|
| 1085 |
|
|---|
| 1086 | $html .= '<div style="display:' . $cdivdisplay . '" id="cnp_CreditCard_div">';
|
|---|
| 1087 | $html .= $clickandpledgename_CreditCard;
|
|---|
| 1088 | $html .= '<div class="form-row">
|
|---|
| 1089 | <label>
|
|---|
| 1090 | <span>' . __("Name On Card <font color='red'>*</font>", "wpjobboard") . '</span>
|
|---|
| 1091 | <input type="text" size="20" data-clickandpledge="number" name="clickandpledge_nameOnCard" id="clickandpledge_nameOnCard" class="required NameOnCard" placeholder="Name On Card"/>
|
|---|
| 1092 | </label>
|
|---|
| 1093 | </div>
|
|---|
| 1094 |
|
|---|
| 1095 | <div class="form-row">
|
|---|
| 1096 | <label>
|
|---|
| 1097 | <span>' . __("Card Number <font color='red'>*</font>", "wpjobboard") . '</span>
|
|---|
| 1098 | <input type="text" size="20" data-clickandpledge="number" name="clickandpledge_cardNumber" id="clickandpledge_cardNumber" class="required creditcard" placeholder="Card Number"/>
|
|---|
| 1099 | </label>
|
|---|
| 1100 | </div>
|
|---|
| 1101 |
|
|---|
| 1102 | <div class="form-row">
|
|---|
| 1103 | <label>
|
|---|
| 1104 | <span>' . __("CVV <font color='red'>*</font>", "wpjobboard") . '</span>
|
|---|
| 1105 | <input type="text" size="4" data-clickandpledge="cvc" maxlength="4" name="clickandpledge_cvc" id="clickandpledge_cvc" class="required Cvv2" placeholder="CVV"/>
|
|---|
| 1106 | </label>
|
|---|
| 1107 | </div>
|
|---|
| 1108 | <div class="form-row">
|
|---|
| 1109 | <label><span>' . __("Expiration (MM/YYYY) <font color='red'>*</font>", "wpjobboard") . '</span></label>
|
|---|
| 1110 | <select name="clickandpledge_cardExpMonth" id="clickandpledge_cardExpMonth" class="required">' . $this->getMonths() . '</select>
|
|---|
| 1111 | <span> / </span>
|
|---|
| 1112 | <select name="clickandpledge_cardExpYear" id="clickandpledge_cardExpYear" class="required" data-clickandpledge="exp-year">' . $this->getYears() . '</select>
|
|---|
| 1113 | </div>';
|
|---|
| 1114 | $html .= $recurringhtml;
|
|---|
| 1115 | $html .= '</div>'; //CreditCard Div End
|
|---|
| 1116 |
|
|---|
| 1117 | $eCheckdivdisplay = ($defaultpayment == 'eCheck') ? 'block' : 'none';
|
|---|
| 1118 | $recurringhtml_eCheck = '';
|
|---|
| 1119 |
|
|---|
| 1120 | if (isset($merchant['wpjobboard_clickandpledge_isRecurring']) && $merchant['wpjobboard_clickandpledge_isRecurring'] == 1) {
|
|---|
| 1121 | if ($merchant['wpjobboard_clickandpledge_RecurringLabel'] != '') {
|
|---|
| 1122 | $recurringhtml_eCheck .= '<br><div class="form-row" id="clickandpledge_isRecurring_div_eCheck">
|
|---|
| 1123 | <label>
|
|---|
| 1124 | <span>' . __($merchant['wpjobboard_clickandpledge_RecurringLabel'], "wpjobboard") . '</span>
|
|---|
| 1125 | <input type="checkbox" name="clickandpledge_isRecurring_eCheck" id="clickandpledge_isRecurring_eCheck"/>
|
|---|
| 1126 | </label>
|
|---|
| 1127 | </div>';
|
|---|
| 1128 | } else {
|
|---|
| 1129 | $recurringhtml_eCheck .= '<br><div class="form-row" id="clickandpledge_isRecurring_div_eCheck">
|
|---|
| 1130 | <label>
|
|---|
| 1131 | <span>' . __('Is this Recurring Payment?', "wpjobboard") . '</span>
|
|---|
| 1132 | <input type="checkbox" name="clickandpledge_isRecurring_eCheck" id="clickandpledge_isRecurring_eCheck"/>
|
|---|
| 1133 | </label>
|
|---|
| 1134 | </div>';
|
|---|
| 1135 | }
|
|---|
| 1136 | $RecurringMethod = array();
|
|---|
| 1137 | if (isset($merchant['wpjobboard_clickandpledge_RecurringMethod_Subscription']) && is_array($merchant['wpjobboard_clickandpledge_RecurringMethod_Subscription']) && count($merchant['wpjobboard_clickandpledge_RecurringMethod_Subscription']) > 0) {
|
|---|
| 1138 | array_push($RecurringMethod, 'Subscription');
|
|---|
| 1139 | }
|
|---|
| 1140 | if (isset($merchant['wpjobboard_clickandpledge_RecurringMethod_Installment']) && is_array($merchant['wpjobboard_clickandpledge_RecurringMethod_Installment']) && count($merchant['wpjobboard_clickandpledge_RecurringMethod_Installment']) > 0) {
|
|---|
| 1141 | array_push($RecurringMethod, 'Installment');
|
|---|
| 1142 | }
|
|---|
| 1143 | if (count($RecurringMethod) == 0) {
|
|---|
| 1144 | array_push($RecurringMethod, 'Subscription');
|
|---|
| 1145 | array_push($RecurringMethod, 'Installment');
|
|---|
| 1146 | }
|
|---|
| 1147 | if (count($RecurringMethod) > 0) {
|
|---|
| 1148 | if (count($RecurringMethod) == 1) {
|
|---|
| 1149 | $recurringhtml_eCheck .= '<input type="hidden" name="clickandpledge_RecurringMethod_eCheck" id="clickandpledge_RecurringMethod_eCheck" value="' . $RecurringMethod[0] . '">';
|
|---|
| 1150 | } else {
|
|---|
| 1151 | $recurringhtml_eCheck .= '<br><div class="form-row" id="clickandpledge_RecurringMethod_div_eCheck">
|
|---|
| 1152 | <label>
|
|---|
| 1153 | <span>' . __("Recurring Method", "wpjobboard") . '</span>
|
|---|
| 1154 | <select id="clickandpledge_RecurringMethod_eCheck" name="clickandpledge_RecurringMethod_eCheck">';
|
|---|
| 1155 | foreach ($RecurringMethod as $r) {
|
|---|
| 1156 | $recurringhtml_eCheck .= '<option value="' . $r . '">' . $r . '</option>';
|
|---|
| 1157 | }
|
|---|
| 1158 | $recurringhtml_eCheck .= '</select>
|
|---|
| 1159 | </label>
|
|---|
| 1160 | </div>';
|
|---|
| 1161 | }
|
|---|
| 1162 | } else {
|
|---|
| 1163 | $recurringhtml_eCheck .= '<div class="form-row" id="clickandpledge_RecurringMethod_div_eCheck">
|
|---|
| 1164 | <label>
|
|---|
| 1165 | <span>' . __("Recurring Method", "wpjobboard") . '</span>
|
|---|
| 1166 | <select id="clickandpledge_RecurringMethod_eCheck" name="clickandpledge_RecurringMethod_eCheck">
|
|---|
| 1167 | <option value="Subscription">Subscription</option>
|
|---|
| 1168 | <option value="Installment">Installment</option>
|
|---|
| 1169 | </select>
|
|---|
| 1170 | </label>
|
|---|
| 1171 | </div>';
|
|---|
| 1172 | }
|
|---|
| 1173 |
|
|---|
| 1174 | if (isset($merchant['wpjobboard_clickandpledge_indefinite']) && is_array($merchant['wpjobboard_clickandpledge_indefinite']) && count($merchant['wpjobboard_clickandpledge_indefinite']) > 0) {
|
|---|
| 1175 | $recurringhtml_eCheck .= '<br><div class="form-row" id="clickandpledge_indefinite_div_eCheck">
|
|---|
| 1176 | <label>
|
|---|
| 1177 | <span>' . __("Indefinite Recurring", "wpjobboard") . '</span>
|
|---|
| 1178 | <input type="checkbox" name="clickandpledge_indefinite_eCheck" id="clickandpledge_indefinite_eCheck"/>
|
|---|
| 1179 | </label>
|
|---|
| 1180 | </div>';
|
|---|
| 1181 | }
|
|---|
| 1182 |
|
|---|
| 1183 | if (isset($merchant['wpjobboard_clickandpledge_Periodicity']) && is_array($merchant['wpjobboard_clickandpledge_Periodicity']) && count($merchant['wpjobboard_clickandpledge_Periodicity']) > 0) {
|
|---|
| 1184 | $recurringhtml_eCheck .= '<br><div class="form-row" id="clickandpledge_Periodicity_div_eCheck">
|
|---|
| 1185 | <label>
|
|---|
| 1186 | <span>' . __("Every", "wpjobboard") . '</span>
|
|---|
| 1187 | <select id="clickandpledge_Periodicity_eCheck" name="clickandpledge_Periodicity_eCheck">';
|
|---|
| 1188 | foreach ($merchant['wpjobboard_clickandpledge_Periodicity'] as $r) {
|
|---|
| 1189 | $recurringhtml_eCheck .= '<option value="' . $r . '">' . $r . '</option>';
|
|---|
| 1190 | }
|
|---|
| 1191 | $recurringhtml_eCheck .= '</select>
|
|---|
| 1192 | </label>
|
|---|
| 1193 | <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>
|
|---|
| 1194 | </div>
|
|---|
| 1195 | <script>
|
|---|
| 1196 | jQuery("#clickandpledge_Installment_eCheck").keypress(function(e) {
|
|---|
| 1197 | var a = [];
|
|---|
| 1198 | var k = e.which;
|
|---|
| 1199 |
|
|---|
| 1200 | for (i = 48; i < 58; i++)
|
|---|
| 1201 | a.push(i);
|
|---|
| 1202 |
|
|---|
| 1203 | if (!(a.indexOf(k)>=0))
|
|---|
| 1204 | e.preventDefault();
|
|---|
| 1205 | });
|
|---|
| 1206 | </script>';
|
|---|
| 1207 | } else {
|
|---|
| 1208 | $Periodicity = array();
|
|---|
| 1209 | $Periodicity['Week'] = 'Week';
|
|---|
| 1210 | $Periodicity['2 Weeks'] = '2 Weeks';
|
|---|
| 1211 | $Periodicity['Month'] = 'Month';
|
|---|
| 1212 | $Periodicity['2 Months'] = '2 Months';
|
|---|
| 1213 | $Periodicity['Quarter'] = 'Quarter';
|
|---|
| 1214 | $Periodicity['6 Months'] = '6 Months';
|
|---|
| 1215 | $Periodicity['Year'] = 'Year';
|
|---|
| 1216 | $recurringhtml_eCheck .= '<br><div class="form-row" id="clickandpledge_Periodicity_div_eCheck">
|
|---|
| 1217 | <label>
|
|---|
| 1218 | <span>' . __("Every", "wpjobboard") . '</span>
|
|---|
| 1219 | <select id="clickandpledge_Periodicity_eCheck" name="clickandpledge_Periodicity_eCheck">';
|
|---|
| 1220 | foreach ($Periodicity as $k => $v) {
|
|---|
| 1221 | $recurringhtml_eCheck .= '<option value="' . $k . '">' . $v . '</option>';
|
|---|
| 1222 | }
|
|---|
| 1223 | $recurringhtml_eCheck .= '</select>
|
|---|
| 1224 | </label>
|
|---|
| 1225 | <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>
|
|---|
| 1226 | </div>
|
|---|
| 1227 | <script>
|
|---|
| 1228 | jQuery("#clickandpledge_Installment_eCheck").keypress(function(e) {
|
|---|
| 1229 | var a = [];
|
|---|
| 1230 | var k = e.which;
|
|---|
| 1231 |
|
|---|
| 1232 | for (i = 48; i < 58; i++)
|
|---|
| 1233 | a.push(i);
|
|---|
| 1234 |
|
|---|
| 1235 | if (!(a.indexOf(k)>=0))
|
|---|
| 1236 | e.preventDefault();
|
|---|
| 1237 | });
|
|---|
| 1238 | </script>';
|
|---|
| 1239 | }
|
|---|
| 1240 |
|
|---|
| 1241 | }
|
|---|
| 1242 | $html .= '<div style="display:' . $eCheckdivdisplay . '" id="cnp_eCheck_div">';
|
|---|
| 1243 | $html .= $clickandpledgename_eCheck;
|
|---|
| 1244 | $html .= '
|
|---|
| 1245 | <div class="form-row">
|
|---|
| 1246 | <label>
|
|---|
| 1247 | <span>' . __("Routing Number <font color='red'>*</font>", "wpjobboard") . '</span>
|
|---|
| 1248 | <input type="text" data-clickandpledge="number" name="clickandpledge_echeck_RoutingNumber" id="clickandpledge_echeck_RoutingNumber" class="required RoutingNumber" placeholder="Routing Number"/>
|
|---|
| 1249 | </label>
|
|---|
| 1250 | </div>
|
|---|
| 1251 | <div class="form-row">
|
|---|
| 1252 | <label>
|
|---|
| 1253 | <span>' . __("Check Number <font color='red'>*</font>", "wpjobboard") . '</span>
|
|---|
| 1254 | <input type="text" data-clickandpledge="number" name="clickandpledge_echeck_CheckNumber" id="clickandpledge_echeck_CheckNumber" class="required CheckNumber" placeholder="Check Number"/>
|
|---|
| 1255 | </label>
|
|---|
| 1256 | </div>
|
|---|
| 1257 | <div class="form-row">
|
|---|
| 1258 | <label>
|
|---|
| 1259 | <span>' . __("Account Number <font color='red'>*</font>", "wpjobboard") . '</span>
|
|---|
| 1260 | <input type="text" data-clickandpledge="number" name="clickandpledge_echeck_AccountNumber" id="clickandpledge_echeck_AccountNumber" class="required AccountNumber" placeholder="Account Number"/>
|
|---|
| 1261 | </label>
|
|---|
| 1262 | </div>
|
|---|
| 1263 | <div class="form-row">
|
|---|
| 1264 | <label>
|
|---|
| 1265 | <span>' . __("Retype Account Number <font color='red'>*</font>", "wpjobboard") . '</span>
|
|---|
| 1266 | <input type="text" data-clickandpledge="number" name="clickandpledge_echeck_retypeAccountNumber" id="clickandpledge_echeck_retypeAccountNumber" class="required AccountNumber" placeholder="Retype Account Number"/>
|
|---|
| 1267 | </label>
|
|---|
| 1268 | </div>
|
|---|
| 1269 | <div class="form-row">
|
|---|
| 1270 | <label>
|
|---|
| 1271 | <span>' . __("Account Type <font color='red'>*</font>", "wpjobboard") . '</span>
|
|---|
| 1272 | <select name="clickandpledge_echeck_AccountType" id="clickandpledge_echeck_AccountType" title="Account Type">
|
|---|
| 1273 | <option value="SavingsAccount">SavingsAccount</option>
|
|---|
| 1274 | <option value="CheckingAccount">CheckingAccount</option>
|
|---|
| 1275 | </select>
|
|---|
| 1276 | </label>
|
|---|
| 1277 | </div>
|
|---|
| 1278 | <div class="form-row">
|
|---|
| 1279 | <label>
|
|---|
| 1280 | <span>' . __("Check Type <font color='red'>*</font>", "wpjobboard") . '</span>
|
|---|
| 1281 | <select name="clickandpledge_echeck_CheckType" id="clickandpledge_echeck_CheckType" title="Check Type">
|
|---|
| 1282 | <option value="Company">Company</option>
|
|---|
| 1283 | <option value="Personal">Personal</option>
|
|---|
| 1284 | </select>
|
|---|
| 1285 | </label>
|
|---|
| 1286 | </div>
|
|---|
| 1287 | <div class="form-row">
|
|---|
| 1288 | <label>
|
|---|
| 1289 | <span>' . __("Name on Account <font color='red'>*</font>", "wpjobboard") . '</span>
|
|---|
| 1290 | <input type="text" data-clickandpledge="number" name="clickandpledge_echeck_NameOnAccount" id="clickandpledge_echeck_NameOnAccount" class="required AccountNumber" placeholder="Name on Account"/>
|
|---|
| 1291 | </label>
|
|---|
| 1292 | </div>
|
|---|
| 1293 | <div class="form-row">
|
|---|
| 1294 | <label>
|
|---|
| 1295 | <span>' . __("Type of ID <font color='red'>*</font>", "wpjobboard") . '</span>
|
|---|
| 1296 | <select name="clickandpledge_echeck_IdType" id="clickandpledge_echeck_IdType" title="Type of ID">
|
|---|
| 1297 | <option value="Driver">Driver</option>
|
|---|
| 1298 | <option value="Military">Military</option>
|
|---|
| 1299 | <option value="State">State</option>
|
|---|
| 1300 | </select>
|
|---|
| 1301 | </label>
|
|---|
| 1302 | </div>';
|
|---|
| 1303 | $html .= $recurringhtml_eCheck;
|
|---|
| 1304 | $html .= '</div>'; //eCheck Div End
|
|---|
| 1305 |
|
|---|
| 1306 | $Invoicedivdisplay = ($defaultpayment == 'Invoice') ? 'block' : 'none';
|
|---|
| 1307 | $html .= '<div style="display:' . $Invoicedivdisplay . '" id="cnp_Invoice_div">';
|
|---|
| 1308 | $html .= $clickandpledgename_Invoice;
|
|---|
| 1309 | $html .= '
|
|---|
| 1310 | <div class="form-row">
|
|---|
| 1311 | <label>
|
|---|
| 1312 | <span>' . __("Invoice Number", "wpjobboard") . '</span>
|
|---|
| 1313 | <input type="text" data-clickandpledge="number" name="clickandpledge_Invoice_InvoiceNumber" id="clickandpledge_Invoice_InvoiceNumber" class="InvoiceCheckNumber" placeholder="Invoice Number"/>
|
|---|
| 1314 | </label>
|
|---|
| 1315 | </div>';
|
|---|
| 1316 | $html .= '</div>'; //Invoice Div End
|
|---|
| 1317 |
|
|---|
| 1318 | $PurchaseOrderdivdisplay = ($defaultpayment == 'PurchaseOrder') ? 'block' : 'none';
|
|---|
| 1319 | $html .= '<div style="display:' . $PurchaseOrderdivdisplay . '" id="cnp_PurchaseOrder_div">';
|
|---|
| 1320 | $html .= $clickandpledgename_PO;
|
|---|
| 1321 | $html .= '
|
|---|
| 1322 | <div class="form-row">
|
|---|
| 1323 | <label>
|
|---|
| 1324 | <span>' . __("Purchase Order Number", "wpjobboard") . '</span>
|
|---|
| 1325 | <input type="text" data-clickandpledge="number" name="clickandpledge_PurchaseOrder_OrderNumber" id="clickandpledge_PurchaseOrder_OrderNumber" class="PurchaseOrderNumber" placeholder="Purchase Order Number"/>
|
|---|
| 1326 | </label>
|
|---|
| 1327 | </div>';
|
|---|
| 1328 | $html .= '</div>'; //PurchaseOrder Div End
|
|---|
| 1329 | $listing_id = '';
|
|---|
| 1330 | if (isset($_POST['listing']) && $_POST['listing'] != '')
|
|---|
| 1331 | $listing_id = $_POST['listing'];
|
|---|
| 1332 | elseif (isset($_POST['listing_type']) && $_POST['listing_type'] != '')
|
|---|
| 1333 | $listing_id = $_POST['listing_type'];
|
|---|
| 1334 | //print_r($this->_data->payment_sum+$this->_data->payment_discount);
|
|---|
| 1335 | $varArray = array(
|
|---|
| 1336 | 'clickandpledge_AccountID' => $merchant['wpjobboard_clickandpledge_' . $selectedCurrency . '_AccountID'],
|
|---|
| 1337 | 'clickandpledge_AccountGuid' => $merchant['wpjobboard_clickandpledge_' . $selectedCurrency . '_AccountGuid'],
|
|---|
| 1338 | 'clickandpledge_OrderMode' => $merchant['wpjobboard_clickandpledge_' . $selectedCurrency . '_OrderMode'],
|
|---|
| 1339 | 'clickandpledge_Amount' => $this->_data->payment_sum + $this->_data->payment_discount,
|
|---|
| 1340 | 'clickandpledge_Discount' => $this->_data->payment_discount,
|
|---|
| 1341 | 'clickandpledge_OrganizationInformation' => htmlspecialchars($merchant['wpjobboard_clickandpledge_OrganizationInformation']),
|
|---|
| 1342 | 'clickandpledge_TermsCondition' => htmlspecialchars($merchant['wpjobboard_clickandpledge_TermsCondition']),
|
|---|
| 1343 | 'clickandpledge_email_customer' => (is_array($merchant['wpjobboard_clickandpledge_emailcustomer']) && count($merchant['wpjobboard_clickandpledge_emailcustomer']) > 0) ? $merchant['wpjobboard_clickandpledge_emailcustomer'][0] : '',
|
|---|
| 1344 | 'clickandpledge_maxrecurrings_Subscription' => $merchant['wpjobboard_clickandpledge_maxrecurrings_Subscription'],
|
|---|
| 1345 | 'clickandpledge_maxrecurrings_Installment' => $merchant['wpjobboard_clickandpledge_maxrecurrings_Installment'],
|
|---|
| 1346 | 'clickandpledge_listing_id' => $listing_id,
|
|---|
| 1347 | 'clickandpledge_coupon_code' => (isset($_POST['coupon'])) ? $_POST['coupon'] : ''
|
|---|
| 1348 | );
|
|---|
| 1349 | foreach ($varArray as $k => $v) {
|
|---|
| 1350 | $html .= '<input type="hidden" name="' . $k . '" id="' . $k . '" value="' . $v . '" />';
|
|---|
| 1351 | }
|
|---|
| 1352 | $html .= '<button type="submit">' . __("Submit Payment", "wpjobboard") . '</button>
|
|---|
| 1353 | </div>
|
|---|
| 1354 | </form>';
|
|---|
| 1355 | } else {
|
|---|
| 1356 | if (count($availableCurrencies) > 0) {
|
|---|
| 1357 | $html = 'Selected currency <b>' . $selectedCurrency . '</b> not supported by Click & Pledge. We are supporting <b>' . implode(',', $availableCurrencies) . '</b> only. Please contact administrator.';
|
|---|
| 1358 | } else {
|
|---|
| 1359 | $html = 'Selected currency <b>' . $selectedCurrency . '</b> not supported by Click & Pledge. Please contact administrator.';
|
|---|
| 1360 | }
|
|---|
| 1361 | }
|
|---|
| 1362 | return $html;
|
|---|
| 1363 | }
|
|---|
| 1364 | public function getMonths()
|
|---|
| 1365 | {
|
|---|
| 1366 | $str = '';
|
|---|
| 1367 | for ($i = 1; $i <= 12; $i++) {
|
|---|
| 1368 | if (date('m') == sprintf('%02d', $i)) {
|
|---|
| 1369 | $str .= '<option value="' . sprintf('%02d', $i) . '" selected>' . sprintf('%02d', $i) . ' (' . strftime('%B', mktime(0, 0, 0, $i, 1, 2000)) . ')</option>';
|
|---|
| 1370 | } else {
|
|---|
| 1371 | $str .= '<option value="' . sprintf('%02d', $i) . '">' . sprintf('%02d', $i) . ' (' . strftime('%B', mktime(0, 0, 0, $i, 1, 2000)) . ')</option>';
|
|---|
| 1372 | }
|
|---|
| 1373 | }
|
|---|
| 1374 | return $str;
|
|---|
| 1375 | }
|
|---|
| 1376 | public function getYears()
|
|---|
| 1377 | {
|
|---|
| 1378 | $str = '';
|
|---|
| 1379 | for ($i = date('Y'); $i < date('Y') + 11; $i++) {
|
|---|
| 1380 | $str .= '<option value="' . strftime('%Y', mktime(0, 0, 0, 1, 1, $i)) . '">' . strftime('%Y', mktime(0, 0, 0, 1, 1, $i)) . '</option>';
|
|---|
| 1381 | }
|
|---|
| 1382 | return $str;
|
|---|
| 1383 | }
|
|---|
| 1384 | public function number_format($number, $decimals = 2, $decsep = '', $ths_sep = '')
|
|---|
| 1385 | {
|
|---|
| 1386 | $parts = explode('.', $number);
|
|---|
| 1387 | if (count($parts) > 1) {
|
|---|
| 1388 | return $parts[0] . '.' . substr($parts[1], 0, $decimals);
|
|---|
| 1389 | } else {
|
|---|
| 1390 | return $number;
|
|---|
| 1391 | }
|
|---|
| 1392 | }
|
|---|
| 1393 | }
|
|---|