function openecho_capture($params) { $echoPHP = new EchoPHP(); $echoPHP->set_EchoServer("https://wwws.echo-inc.com/scripts/INR200.EXE"); $echoPHP->set_transaction_type("EV"); $echoPHP->set_order_type("S"); $echoPHP->set_merchant_echo_id($params['merchantechoid']); $echoPHP->set_merchant_pin($params['merchantpin']); $echoPHP->set_billing_ip_address($_SERVER['REMOTE_ADDR']); $echoPHP->set_billing_first_name($params['clientdetails']['firstname']); $echoPHP->set_billing_last_name($params['clientdetails']['lastname']); $echoPHP->set_billing_address1($params['clientdetails']['address1']); $echoPHP->set_billing_city($params['clientdetails']['city']); $echoPHP->set_billing_state($params['clientdetails']['state']); $echoPHP->set_billing_zip($params['clientdetails']['postcode']); $echoPHP->set_billing_country($params['clientdetails']['country']); $echoPHP->set_billing_phone($params['clientdetails']['phonenumber']); $echoPHP->set_billing_email($params['clientdetails']['email']); $echoPHP->set_debug("F"); $echoPHP->set_cc_number($params['cardnum']); $echoPHP->set_grand_total($params['amount']); $echoPHP->set_ccexp_month(substr($params['cardexp'], 0, 2)); $echoPHP->set_ccexp_year("20" . substr($params['cardexp'], 2, 2)); $echoPHP->set_cnp_security($params['cccvv']); $echoPHP->set_counter("1"); $desc = "Action => Capture\n"; $desc .= "Client => " . $params['clientdetails']['firstname'] . " " . $params['clientdetails']['lastname'] . "\n"; $desc .= "Authorization Code => " . $echoPHP->authorization . "\n"; $desc .= "Order Number => " . $echoPHP->order_number . "\n"; $desc .= "Reference => " . $echoPHP->reference . "\n"; $desc .= "Status => " . $echoPHP->status . "\n"; $desc .= "AVS Result => " . $echoPHP->avs_result . "\n"; $desc .= "Security Result => " . $echoPHP->security_result . "\n"; $desc .= "MAC => " . $echoPHP->mac . "\n"; $desc .= "Decline Code => " . $echoPHP->decline_code . "\n"; $desc .= "Transaction Date => " . $echoPHP->tran_date . "\n"; $desc .= "Merchant Name => " . $echoPHP->merchant_name . "\n"; $desc .= "Version => " . $echoPHP->version . "\n"; $desc .= "Echo Type 1 => " . $echoPHP->echotype1 . "\n"; $desc .= "Echo Type 2 => " . $echoPHP->echotype2 . "\n"; $desc .= "Echo Type 3 => " . $echoPHP->echotype3 . "\n"; $desc .= "Echo Response => " . $echoPHP->EchoResponse . "\n"; if (!$echoPHP->Submit()) { return array("status" => "declined", "rawdata" => $desc); } return array("status" => "success", "transid" => $echoPHP->reference, "rawdata" => $desc); }
$echoPHP->set_ec_last_name(lastName); $echoPHP->set_ec_address1($address1); $echoPHP->set_ec_address2($address2); $echoPHP->set_ec_city($city); $echoPHP->set_ec_state($state); $echoPHP->set_ec_zip($zip); $echoPHP->set_ec_rt($route); $echoPHP->set_ec_account($account); $echoPHP->set_ec_serial_number($serial); $echoPHP->set_ec_payee($EchoPayee); //$echoPHP->set_ec_id_state(""); //$echoPHP->set_ec_id_number(""); //$echoPHP->set_ec_id_type(""); $echoPHP->set_transaction_type("DD"); } $echoPHP->set_debug("F"); // set to T to turn on debugging $echoPHP->set_counter(1); $submitSuccess = $echoPHP->Submit(); if ($submitSuccess) { $submitSuccess = 1; } else { $submitSuccess = 0; } if ($submitSuccess) { // Push the authorized transaction date forward by the interval $sSQL = "UPDATE autopayment_aut SET aut_NextPayDate=DATE_ADD('" . $authDate . "', INTERVAL " . $aut_Interval . " MONTH), aut_Serial=aut_Serial+1 WHERE aut_ID = " . $aut_ID . " AND aut_Amount = " . $plg_amount; RunQuery($sSQL); } $sSQL = "UPDATE pledge_plg SET plg_aut_Cleared=" . $submitSuccess . " WHERE plg_plgID=" . $plg_plgID; RunQuery($sSQL);
function bill_checkout($amount, $invoice, $currency_iso, $acct_fields, $total_recurring = false, $recurr_bill_arr = false) { # Validate currency if (!$this->validate_currency($currency_iso)) { return false; } $ret = false; if (!$this->validate_card_details($ret)) { return false; } # Get the country $country = $this->getCountry('three_code', $acct_fields["country_id"]); if ($this->cfg['mode'] = "0") { $test = "F"; } else { $test = "T"; } include_once PATH_PLUGINS . 'checkout/CLASS_ECHO/echophp.class'; $echoPHP = new EchoPHP(); $echoPHP->set_order_type("S"); $echoPHP->set_debug($test); $echoPHP->set_EchoServer($this->host . '' . $this->url); $echoPHP->set_transaction_type($this->cfg["type"]); $echoPHP->set_merchant_echo_id($this->cfg["id"]); $echoPHP->set_merchant_pin($this->cfg["pin"]); $echoPHP->set_billing_ip_address(USER_IP); $echoPHP->set_billing_first_name($this->account["first_name"]); $echoPHP->set_billing_last_name($this->account["last_name"]); $echoPHP->set_billing_address1($this->account["address1"] . ' ' . $this->account["address2"]); $echoPHP->set_billing_city($this->account["city"]); $echoPHP->set_billing_state($this->account["state"]); $echoPHP->set_billing_zip($this->account["zip"]); $echoPHP->set_billing_country($country); $echoPHP->set_billing_email($acct_fields["email"]); $echoPHP->set_grand_total($amount); $echoPHP->set_ccexp_month($this->billing["exp_month"]); $echoPHP->set_ccexp_year($this->billing["exp_year"]); $echoPHP->set_cnp_security($this->billing["ccv"]); $echoPHP->set_cc_number($this->billing["cc_no"]); $echoPHP->set_counter($echoPHP->getRandomCounter()); # Set the return codes: if (!$echoPHP->Submit()) { if ($echoPHP->decline_code == "1013") { $ret['status'] = 0; $ret['msg'] = $echoPHP->avs_result . 'Echo account ' . $echoPHP->merchant_echo_id . ' could not be found, failed!'; } else { $ret['status'] = 0; $ret['msg'] = $echoPHP->echotype1; } } else { $ret['status'] = 1; $ret['transaction_id'] = $echoPHP->reference; $ret['authorization'] = $echoPHP->authorization; # AVS Details: if ($echoPHP->avs_result == 'A') { $ret['avs'] = 'avs_address_only'; } elseif ($echoPHP->avs_result == 'E') { $ret['avs'] = 'avs_error'; } elseif ($echoPHP->avs_result == 'N') { $ret['avs'] = 'avs_no_match'; } elseif ($echoPHP->avs_result == 'P') { $ret['avs'] = 'avs_na'; } elseif ($echoPHP->avs_result == 'R') { $ret['avs'] = 'avs_retry'; } elseif ($echoPHP->avs_result == 'S' || $echoPHP->avs_result == 'G') { $ret['avs'] = 'avs_not_supported'; } elseif ($echoPHP->avs_result == 'U') { $ret['avs'] = 'avs_address_unavail'; } elseif ($echoPHP->avs_result == 'W') { $ret['avs'] = 'avs_fullzip_only'; } elseif ($echoPHP->avs_result == 'X') { $ret['avs'] = 'avs_exact'; } elseif ($echoPHP->avs_result == 'D' || $echoPHP->avs_result == 'M') { $ret['avs'] = 'avs_address_zip'; } elseif ($echoPHP->avs_result == 'Z') { $ret['avs'] = 'avs_partzip_only'; } else { $ret['avs'] = 'avs_na'; } } if ($ret['status'] == 1) { return $ret; } else { global $VAR; @($VAR['msg'] = $ret["msg"]); return false; } }