Page 1 of 6 123 ... LastLast
Results 1 to 10 of 53
  1. #1
    Join Date
    Jun 2017
    Location
    canada
    Posts
    30
    Plugin Contributions
    0

    Idea or Suggestion Modifying code to make a new gateway

    Hi guys, am trying to modify OKPAY payment gateway zencart code to add a new payment gateway
    not sure what args and where to update it, can someone help, please ???

    here is the okpay code, if I want to add a different gateway instead of okpay , how can I do that ??? what changes are needed in the below code ??? i saw western union is using the same code, the changes needed to be done via cpanel/php myadmin database ???

    Code:
    <?php
    /*
      $Id: okpay.php, v. 1.0 2010-05-06
    
     
    */
    
    
      class okpay {
        var $code;
        var $title;
        var $description;
        var $enabled;
    
    // class constructor
        function okpay() {
          $this->code = 'okpay';
          $this->title = MODULE_PAYMENT_OKPAY_TEXT_TITLE;
          $this->description = MODULE_PAYMENT_OKPAY_TEXT_DESCRIPTION;
          $this->sort_order = MODULE_PAYMENT_OKPAY_SORT_ORDER;
          $this->enabled = ((MODULE_PAYMENT_OKPAY_STATUS == 'True') ? true : false);
          
          if ((int)MODULE_PAYMENT_OKPAY_ORDER_STATUS_ID > 0) {
            $this->order_status = MODULE_PAYMENT_OKPAY_ORDER_STATUS_ID;
          }
          $this->form_action_url = 'https://www.okpay.com/process.html';
        }
    
     function update_status() {
          global $db;
          global $order;
    
          if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_OKPAY_ZONE > 0) ) {
            $check_flag = false;
            $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_OKPAY_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");
            while (!$check->EOF) {
              if ($check->fields['zone_id'] < 1) {
                $check_flag = true;
                break;
              } elseif ($check->fields['zone_id'] == $order->billing['zone_id']) {
                $check_flag = true;
                break;
              }
              $check->MoveNext();
            }
    
            if ($check_flag == false) {
              $this->enabled = false;
            }
          }
        }
    
    // class methods
        function javascript_validation() {
          return false;
        }
    
        function selection() {
          return array('id'     => $this->code,
                       'module' => MODULE_PAYMENT_OKPAY_TEXT_CATALOG_LOGO,
                       'icon'   => MODULE_PAYMENT_OKPAY_TEXT_CATALOG_LOGO);
        }
    
        function pre_confirmation_check() {
          return false;
        }
    
        function confirmation() {
          return false;
        }
    
        function process_button() {
          global $db, $order, $currencies;
    
          //okpay accepted currency
          $ok_cur = array('EUR', 'USD', 'GBP', 'CHF', 'CAD', 'RUR');
          $CUR = $order->info['currency'];
          if (!in_array($CUR,$ok_cur)) {
            $CUR = 'USD';
          }
    
          $process_button_string = zen_draw_hidden_field('ok_receiver', MODULE_PAYMENT_OKPAY_RECEIVER) .
                                   zen_draw_hidden_field('ok_item_1_name', MODULE_PAYMENT_OKPAY_PURCHASE_TITLE) .
                                   zen_draw_hidden_field('ok_item_1_article', MODULE_PAYMENT_OKPAY_PURCHASE_ITEMNUM) .
                                   zen_draw_hidden_field('ok_item_1_price', number_format($order->info['total'], 2, '.', '')) .
                                   zen_draw_hidden_field('ok_currency', $CUR) .
                                   zen_draw_hidden_field('ok_return_success', zen_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')) .
                                   zen_draw_hidden_field('ok_return_fail', zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
    
          return $process_button_string;
        }
    
        function before_process() {
          return false;
        }
    
        function after_process() {
          return false;
        }
    
        function output_error() {
          return false;
        }
    
        function check() {
          global $db;
          if (!isset($this->_check)) {
            $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_OKPAY_STATUS'");
            $this->_check = $check_query->RecordCount();
          }
          return $this->_check;
        }
    
        function install() {
          global $db;
          $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable OKPAY Module', 'MODULE_PAYMENT_OKPAY_STATUS', 'True', 'Do you want to accept OKPAY payments?', '6', '3', 'zen_cfg_select_option(array(\'True\', \'False\'))', now())");
          $db->Execute("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_OKPAY_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
          $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('OKPAY Receiver', 'MODULE_PAYMENT_OKPAY_RECEIVER', '[email protected]', 'Your OKPAY wallet ID, linked email or mobile phone number to which the payment is to be made.', '6', '4', now())");
          $db->Execute("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_OKPAY_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())");
          $db->Execute("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_OKPAY_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())");
          
        }
    
    
        function remove() {
          global $db;
          $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
        }
    
        function keys() {
          return array('MODULE_PAYMENT_OKPAY_STATUS', 'MODULE_PAYMENT_OKPAY_SORT_ORDER', 'MODULE_PAYMENT_OKPAY_RECEIVER', 'MODULE_PAYMENT_OKPAY_ZONE', 'MODULE_PAYMENT_OKPAY_ORDER_STATUS_ID');
        }
      }
    
    ?>
    Last edited by ersiranjeevi; 20 Jun 2017 at 07:40 PM.

  2. #2
    Join Date
    Jul 2012
    Posts
    16,740
    Plugin Contributions
    17

    Default Re: Modifying codes to add a new gateway

    In order to gain specific assistance, details would need to be provided. Every gateway that offers electronic processing should identify what communication is needed, what data is needed, what it will provide back, and other information about the general process. With that information the applicable portions of code can be modified to get, give, and process the information. Care should be taken to prevent/mitigate the possibility of payment information being skimmed and ideally not stored on the site unless the site has taken the necessary precautions to protect the customer.

    Beyond that, standard methods of code modification are recommended: ie a plain text editor, ftp (using secure methods), etc. There's a FAQ on recommended tools to use for development, but I don't have the direct link available at the moment.

    Also, as a side note, when posting code, please encompass it in [CODE][/CODE] tags when posting. The tags are generated when selecting the # button from the message box toolbar when posting or replying to a message.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Jun 2017
    Location
    canada
    Posts
    30
    Plugin Contributions
    0

    Default Re: Modifying codes to add a new gateway

    Sure will post codes as per advised hereafter and What specific information needed to gain further assistance
    I have access to all the back end stuffs you needed
    Am working partner for the gateway

  4. #4
    Join Date
    Jul 2012
    Posts
    16,740
    Plugin Contributions
    17

    Default Re: Modifying codes to add a new gateway

    Quote Originally Posted by ersiranjeevi View Post
    Sure will post codes as per advised hereafter and What specific information needed to gain further assistance
    I have access to all the back end stuffs you needed
    Am working partner for the gateway
    The information needed is basically everything related as discussed. Ultimately need to know what inputs are needed by the payment processor and at what stage of processing those inputs are needed, then once something is provided to the processor, what is returned or what needs to be done to get information back, then what does the returned information look like/contain so as to know what to do next or how to process what is provided back. Different processors do things differently. Some collect a minor amount of information from the eCommerce site and take that and the cost of the product and simply obtain the bank/card information and return a "number" and processing status to represent the transaction. Some will take that initial information but then have the customer confirm or permit modification of the information and send back to the store the "real" details such as destination of the item (if one is being sent), or the payment address, or again may only provide a number and status of the payment. The processor may send multiple messages to indicate some change of status such as processing, authorized, completed, error, a combination of these, them in order, just a final notification, repeated response(s) based on processing etc...

    All of this should be covered in their documentation about using their service(s). That information should be used to generate the applicable code or code change. The above payment gateway is relatively simply presented as compared to say paypal. If you review the paypal code, you will see that there is a lot that goes on, between validation of the price(s), generation of "tags" to be sent to paypal, response code, response handling, database updates to reflect completion of business, etc... Similar processes are involved in the authorize.net code and others. The goal is to prevent additional page content (or removal of necessary content) from being provided by someone that has found a way to personally pay less for something than what is expected and to ensure the security of the current customer's, the store owner's and any other customer's information.

    Just changing the web address to a different payment gateway does not mean that everything will work as desired/expected.

    I failed to welcome you to Zen Cart as potentially a new user. The issues that I describe are not hardly related to ZC and in fact if it is only ZC related portions that are "a mystery" then that is far easier to address than how to connect and work with a payment processor gateway. To address the ZC side of things, basically when you look at all of the files associated with that payment method, you should see common information among them all. For example, there should be an includes/languages/english/modules/payment related file in which there should be some defines associated to say: MODULE_PAYMENT_OKPAY_TEXT_TITLE or: MODULE_PAYMENT_OKPAY_TEXT_DESCRIPTION.
    In any given language, during a system load, defines are pulled in to support the use of multiple languages. The english language is programmed as the default, though there are ways to work around that. Anyways, not every file throughout the languages folder is loaded, but typically when working with payments or shipping, each of the payments folder files are loaded at some point. Because these defines become immutable once defined, it is necessary to have a unique define for the applicable payment processor, so at least: MODULE_PAYMENT_OKPAY_TEXT_TITLE in the above code would need to be modified to be something else and again ideally something that relates to the "new" payment method. You could hardcode the text, but then there is a lot of flexibility and capability that is lost by doing so with the possibility of other code not outputting what might be expected to be seen. I.e. if code "joins" two or more text strings together to display MODULE_PAYMENT_OKPAY_TEXT_TITLE (such as 'MODULE_PAYMENT_' . $module_name . '_TEXT_TITLE' as an example, then if that new define is not well defined, it will display as what I have pasted just before: MODULE_PAYMENT_OKPAY_TEXT_TITLE (assuming that $module_name is in all capital letters).

    So, all that said and as I previously posted, to obtain targeted assistance, more direct questions should be asked. Otherwise, suggest seeking out someone to write it for you or identify more about what you know (and don't know), what portion of the "project" is being worked on, what has worked, what hasn't, what were the results, etc... and perhaps you can get along a bit faster. Right now, all that is known is that OKPAY works for okpay, western union has used the same basic code, but there is nothing about what payment processor is to be used, experience level with any aspect of the execution (other than identifying that not sure what tool(s) to use to modify the code), etc... There is nothing wrong with starting out from scratch or as a beginner and there is nothing wrong with an experienced individual coming here that just doesn't know ZC, the forum is filled with people of at different levels of experience, some have been around a long time and couldn't get ZC to say "Hello World" but have a successful business and others can write code in their sleep but may not be able to carry an intelligent conversation, you name it, its out there.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #5
    Join Date
    Jan 2004
    Posts
    66,380
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Modifying codes to add a new gateway

    1. What gateway are you building a module for?
    2. What's a URL to their documentation?
    3. Why did you select OKPAY as the module to copy from?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #6
    Join Date
    Jun 2017
    Location
    canada
    Posts
    30
    Plugin Contributions
    0

    Default Re: Modifying codes to add a new gateway

    Would you mind if I PM you ?? if its not permitted will post the required info here :) those are all I hope secured info's that's why

  7. #7
    Join Date
    Jul 2012
    Posts
    16,740
    Plugin Contributions
    17

    Default Re: Modifying codes to add a new gateway

    Quote Originally Posted by ersiranjeevi View Post
    Would you mind if I PM you ?? if its not permitted will post the required info here :) those are all I hope secured info's that's why
    Don't know how much browsing of the forum you had done before joining the forum, but as far as the forum rules, one of the developers of ZC has asked three direct questions, the answers to which are permitted in the forum. If you have taken part in some "initial program" where you have information that is not releasable to the public, then you should follow those guidelines.

    The more that you are able to offer the more outside help you can get.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  8. #8
    Join Date
    Jun 2017
    Location
    canada
    Posts
    30
    Plugin Contributions
    0

    Default Re: Modifying codes to add a new gateway

    I agree, ,my apologies, Solidtrust pay is the gateway name we are trying to modify with the module

    not sure this is the one your are talking about Documentation urls
    https://www.solidtrustpay.com/documents/sell-item
    https://www.solidtrustpay.com/developers

    Okpay is similar to our gatewayName:  Screen Shot 2017-06-21 at 4.10.29 PM.jpg
Views: 264
Size:  22.4 KB
    I just wanted to know where and what informations needed to modify ?
    And also what ZC things needed to included ??
    We just want zencart clients to point out to this form and make their payment --- below is the screenshot

  9. #9
    Join Date
    Jun 2017
    Location
    canada
    Posts
    30
    Plugin Contributions
    0

    Default Re: Modifying codes to add a new gateway

    any updates for the above query ??

  10. #10
    Join Date
    Jan 2004
    Posts
    66,380
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Modifying codes to add a new gateway

    If you're going to clone the module:
    1. Go through and rename all the constants, in both the module and the language file.
    2. Rename the class. Don't use underscores or capitals
    3. Make sure the constructor method is __construct
    4. Set the $this->code to match the class name.
    5. Replace the URL with the correct endpoint
    6. Update the process_button() class method with all the form fields that must be POSTed to the form URL. Use the SolidTrustPay documentation to learn what field names and values are to be transmitted.
    7. Update the install() and remove() and keys() methods to reflect all the relevant configurations for SolidTrustPay instead of OKPay.
    8. Fix all the language edits in the language file to suit SolidTrustPay instead of OKPay.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 
Page 1 of 6 123 ... LastLast

Similar Threads

  1. v151 Modifying the login code
    By gkginc in forum General Questions
    Replies: 2
    Last Post: 20 May 2013, 08:43 PM
  2. Make Code Change To New Products listing
    By DigitalShadow in forum General Questions
    Replies: 3
    Last Post: 2 Mar 2011, 12:38 PM
  3. Modifying Email Code
    By asimms1 in forum General Questions
    Replies: 1
    Last Post: 9 Jun 2009, 07:19 PM
  4. Modifying something in PHP-Code
    By mathon in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 10 Dec 2006, 10:24 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR