*

SilenceXX

  • **
  • 11 posts
Need a bit help, if posible...
« on: July 18, 2018, 05:32:01 PM »
Im trying to add my own gateway using other gateways as reference, but im having problem with onClick. (Uncaught ReferenceError: $ is not defined at HTMLAnchorElement.onclick)
Maybe someone has idea why so...

Code: [Select]
<?php
class 
PayeezyPaymentOSP 
    public function 
__construct() { }

function 
get_client_ip_env() {
    
$ipaddress '';
    if (
getenv('HTTP_CLIENT_IP'))
        
$ipaddress getenv('HTTP_CLIENT_IP');
    else if(
getenv('HTTP_X_FORWARDED_FOR'))
        
$ipaddress getenv('HTTP_X_FORWARDED_FOR');
    else if(
getenv('HTTP_X_FORWARDED'))
        
$ipaddress getenv('HTTP_X_FORWARDED');
    else if(
getenv('HTTP_FORWARDED_FOR'))
        
$ipaddress getenv('HTTP_FORWARDED_FOR');
    else if(
getenv('HTTP_FORWARDED'))
        
$ipaddress getenv('HTTP_FORWARDED');
    else if(
getenv('REMOTE_ADDR'))
        
$ipaddress getenv('REMOTE_ADDR');
    else
        
$ipaddress 'UNKNOWN';
 
    return 
$ipaddress;
}

      public static function 
button($amount '0.00'$description ''$itemnumber ''$extra_array null) {
      
$extra osp_prepare_custom($extra_array) . '|';
      
$extra .= 'concept,'.$description.'|';
      
$extra .= 'product,'.$itemnumber.'|';
      
$r rand(0,1000);
      
$extra .= '|random,'.$r;

      
PayeezyPaymentOSP::payeezyButton($amount$description$itemnumber$extra_array);
    }
   
public static function payeezyButton($amount '0.00'$description ''$itemnumber '101'$extra_array null) {
      
$extra osp_prepare_custom($extra_array) . '|';
      
$extra .= 'concept,'.$description.'|';
      
$extra .= 'product,'.$itemnumber.'|';
      
$r rand(0,1000);
      
$extra .= '|random,'.$r;
  $link 'https://www.somesite.com/a/index.php?action=form_sms';
  $ip get_client_ip_env;
    
?>


<li class="btn-payeezy">
<form class="nocsrf" action="<?php echo $link?>" target="_self" name="payment_form" id="payeezy_<?php echo $r?>">
<input type="hidden" name="post_amount" value="<?php echo $amount?>" />
<input type="hidden" name="post_currency" value="978" />
<input type="hidden" name="post_ip" value="<?php echo $ip?>" />
<input type="hidden" name="post_description" value="<?php echo $description;?>" />
<input type="hidden" name="post_language" value="lv" />
<input type="hidden" name="extra" value="<?php echo $extra?>">
</form>
<a id="payeezy-button-confirm" class="button btn-payeezy osp-has-tooltip" href="#" title="<?php echo osc_esc_html(__('You will be redirected to FirstData''osclass_pay')); ?>" onclick="$('#payeezy_<?php echo $r?>').submit();">Pay with card</a>
</li>
 <?php
}
}
?>


*

MB Themes

Re: Need a bit help, if posible...
« Reply #1 on: July 18, 2018, 08:29:26 PM »
onclick="$('#payeezy_<?php echo $r; ?>').submit();"

You should call function that submit form rather that calling jQuery that probably does not work with onclick.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

SilenceXX

  • **
  • 11 posts
Re: Need a bit help, if posible...
« Reply #2 on: July 18, 2018, 10:00:27 PM »
Did find out, that it is easyer to edit out some gatweay i will not use. (Skrill)
Now only need to think trough how to record all of it in OSP database :D

*

SilenceXX

  • **
  • 11 posts
Re: Need a bit help, if posible...
« Reply #3 on: July 18, 2018, 10:16:06 PM »
Managed to record all info in its test database, if i may ask one last thing (hopefuly), with payment has closes payment procesing to record all this in database logs?

I figured out how to do returnOK, returnFail link, but have problems figuring out how to record this transaction id in db before i move to payment procesors website.

Code: [Select]
  $amount       = $_POST['post_amount'];
  $currency     = $_POST['post_currency'];
  $ip           = $_POST['post_ip'];
  $description  = urlencode(htmlspecialchars($_POST['post_description'], ENT_QUOTES));
  $language     = $_POST['post_language'];
  $extra     = $_POST['extra'];



  $merchant = new Merchant($ecomm_server_url, $cert_url, $cert_pass, 1);

  $resp = $merchant -> startSMSTrans($amount, $currency, $ip, $description, $language);

        if (substr($resp,0,14)=="TRANSACTION_ID") {
                $trans_id = substr($resp,16,28);
                $url = $ecomm_client_url."?trans_id=". urlencode($trans_id);
               
                $sql = mysql_query("INSERT INTO $db_table_transaction VALUES ('', '$trans_id', '$amount', '$currency', '$ip', '$description', '$language', '---', '???', '???', '???', '???', now(), '$resp', '', '')", '$extra');
                       
                header("Location: $url");
                        if (!$sql) {
                            die('*** Invalid query: ' . mysql_error());
                        }

        }else{
                echo $resp;
                $resp = htmlentities($resp, ENT_QUOTES);
                $sql = mysql_query("INSERT INTO $db_table_error VALUES ('', now(), 'startsmstrans', '$resp')
                        ");

                        if (!$sql) {
                            die('*** Invalid query2: ' . mysql_error());
                        }
        }
mysql_close($link);

*

MB Themes

Re: Need a bit help, if posible...
« Reply #4 on: July 19, 2018, 08:38:28 AM »
@SilenceXX
Osclass Pay never store transaction before it is really processed. Every gateway generate payment & process order once data are sent from processor back to web.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

SilenceXX

  • **
  • 11 posts
Re: Need a bit help, if posible...
« Reply #5 on: July 19, 2018, 09:11:02 AM »
Im dumb then :D How does OSP tie transaction id to with cart is paid?

If im geting corectly, as soon i submit data/start redirecting to payment gateway, it gives me transaction id.
When payment is finished, it is identified with same transaction id. 
Code: [Select]
RESULT: OK RESULT_CODE: 000 3DSECURE: NOTPARTICIPATED RRN: 820009354952 APPROVAL_CODE: 714523 CARD_NUMBER: ****************and in $_POST trans_id   FBUPlQTvpqnvet3GtGRhQJNbQ4Q=

*

MB Themes

Re: Need a bit help, if posible...
« Reply #6 on: July 19, 2018, 09:12:56 AM »
@SilenceXX
It sends all data required to generate order to processor and these data are then returned also with status of payment.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

SilenceXX

  • **
  • 11 posts
Re: Need a bit help, if posible...
« Reply #7 on: July 19, 2018, 09:39:48 AM »
I guess will do then in dumb way, using its own database table as midway where to keep all transactionid and extra.
« Last Edit: July 19, 2018, 09:45:43 AM by SilenceXX »

*

MB Themes

Re: Need a bit help, if posible...
« Reply #8 on: July 19, 2018, 11:15:09 AM »
@SilenceXX
You may create help tables where transaction in "preparation" status will be held
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots