can_add Posted September 19, 2007 Share Posted September 19, 2007 has any one make a payment module for Oscommerce using Mirapay. has anyone ever used Mirapay? I have a client that was change their mind last minuets and now want to use mirapay (I don't know anything about mirapay) on there site does anyone have any idea where I should start? thanks. Quote Link to comment Share on other sites More sharing options...
can_add Posted September 28, 2007 Author Share Posted September 28, 2007 no one has any idea? no one has ever worked with Mirapay before? Quote Link to comment Share on other sites More sharing options...
hasnut Posted April 30, 2008 Share Posted April 30, 2008 If anyoe need mirapay integration let me know. Quote Link to comment Share on other sites More sharing options...
Rhawke Posted May 6, 2008 Share Posted May 6, 2008 If anyoe need mirapay integration let me know. **IMPORTANT -- THIS IS NOT A WORKING MODULE AT THIS TIME -- DO NOT USE AS IS** I am trying to create a module for Mirapay for oscommerce. My php experience is just passed the novice stage. i do understand programming fundementals and am a C# developer. 1: I do not think my hash code is being calculated correctly. 2: I am not sure Mirapay is accepting the form using the php method tep_draw_hidden_field('xxxx', $this->$xxxx); Below you will find the code I have been working on, if there is a better way to do this, or anyone has ideas on what's wrong, please by all means constructive criticism and tips are very welcome! thanks in advance. Basically what I have done here is take the paypal module and adapt it to Mirapay. class mirapay { var $code, $title, $description, $enabled; // class constructor function mirapay() { global $order; $this->code = 'mirapay'; $this->title = MODULE_PAYMENT_MIRAPAY_TEXT_TITLE; $this->description = MODULE_PAYMENT_MIRAPAY_TEXT_DESCRIPTION; $this->sort_order = MODULE_PAYMENT_MIRAPAY_SORT_ORDER; $this->enabled = ((MODULE_PAYMENT_MIRAPAY_STATUS == 'True') ? true : false); if ((int)MODULE_PAYMENT_MIRAPAY_ORDER_STATUS_ID > 0) { $this->order_status = MODULE_PAYMENT_MIRAPAY_ORDER_STATUS_ID; } if (is_object($order)) $this->update_status(); $this->form_action_url = '(this is the link to the mirapay website secure credit card processing area)'; } // class methods function update_status() { global $order; if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_MIRAPAY_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_MIRAPAY_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->billing['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } } function javascript_validation() { return false; } function selection() { return array('id' => $this->code, 'module' => $this->title); } function pre_confirmation_check() { return false; } function confirmation() { return false; } function process_button() { global $order, $currencies, $currency, $customer_id; if (MODULE_PAYMENT_MIRAPAY_CURRENCY == 'Selected Currency') { $my_currency = $currency; } else { $my_currency = substr(MODULE_PAYMENT_MIRAPAY_CURRENCY, 5); } if (!in_array($my_currency, array('CAD', 'EUR', 'GBP', 'JPY', 'USD'))) { $my_currency = 'USD'; } //this section is for declaring the variables being sent to MiraPay and for debugging $password = MODULE_PAYMENT_MIRAPAY_PASSWORD;//fao mirapay password echo "\$password: $password <br>";//debug $amount = $order->info['total'];//the total of the order including tax echo "\$amount: $amount <br>";//debug $mtid = $customer_id . date('YmdHis');//$order_id;//the order id echo "\$mtid: $mtid <br>";//debug $mkey = md5($mtid.$amount.$password);// the hash key echo "\$mkey: $mkey <br>";//debug $email = $order->customer['email_address']; echo "\$email: $email <br>";//debug $merchantID = MODULE_PAYMENT_MIRAPAY_MERCHANTID; echo "\$merchantID: $merchantID <br>";//debug $successUrl = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL'); echo "\$successUrl: $successUrl <br>";//debug $failUrl = tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'); echo "\$failUrl: $failUrl <br>";//debug*/ //end variables and debugging $process_button_string = tep_draw_hidden_field('MTID', $this->$mtid) . tep_draw_hidden_field('Merchant_ID', $this->$merchantID) . tep_draw_hidden_field('MKEY', $this->$mkey) . tep_draw_hidden_field('Amount1', $this->$amount) . tep_draw_hidden_field('SuccessURL', $this->$successUrl) . tep_draw_hidden_field('FailURL', $this->$failUrl) . tep_draw_hidden_field('EMail', $this->$email); return $process_button_string; } function before_process() { return false; } function after_process() { return false; } function output_error() { return false; } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_MIRAPAY_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable MiraPaY Module', 'MODULE_PAYMENT_MIRAPAY_STATUS', 'True', 'Do you want to accept MiraPaY payments?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); //state the merchant id for mirapay tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Merchant ID', 'MODULE_PAYMENT_MIRAPAY_MERCHANTID', '(***merchant id goes here***)', 'This is the Merchant ID provided to you by MiraPay', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Password', 'MODULE_PAYMENT_MIRAPAY_PASSWORD', '(**Password goes here**)', 'The password for the MiraPay service', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Transaction Currency', 'MODULE_PAYMENT_MIRAPAY_CURRENCY', 'Selected Currency', 'The currency to use for credit card transactions', '6', '0', 'tep_cfg_select_option(array(\'Selected Currency\',\'Only USD\',\'Only CAD\',\'Only EUR\',\'Only GBP\',\'Only JPY\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_MIRAPAY_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_MIRAPAY_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_MIRAPAY_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_PAYMENT_MIRAPAY_STATUS', 'MODULE_PAYMENT_MIRAPAY_MERCHANTID', 'MODULE_PAYMENT_MIRAPAY_PASSWORD', 'MODULE_PAYMENT_MIRAPAY_CURRENCY', 'MODULE_PAYMENT_MIRAPAY_ZONE', 'MODULE_PAYMENT_MIRAPAY_ORDER_STATUS_ID', 'MODULE_PAYMENT_MIRAPAY_SORT_ORDER'); } } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.