Need new Payments processor

Standard payment process does not suit me. How to add a new payment processor? Copy to 'payments' folder is not working.

I rewrote the payment processor for my bank. One question. how to put the status of the order? You need to put the status of “paid” or “processed”. Now orders are not added to the panel “Orders”. :(

[quote name=‘Psinetron’ timestamp=‘1351153309’ post=‘147644’]

I rewrote the payment processor for my bank. One question. how to put the status of the order? You need to put the status of “paid” or “processed”. Now orders are not added to the panel “Orders”. :(

[/quote]

Hi there!



This is a code snippet from my custom payment processor. You can check the answer messages, and the methods:

<br />
	if ($mode == 'success' && !empty($_REQUEST['order_id'])) {<br />
  // if the answer is success<br />
  if (fn_check_payment_script('YOURSCRIPT.php', $_REQUEST['order_id'])) {<br />
  // build the payment processor's response array<br />
				$pp_response = array();<br />
				$pp_response['reason_text'] = '';<br />
				$pp_response['transaction_id'] = $_REQUEST['orderNumber'];<br />
	// set order status here (whatever you want)<br />
				$pp_response['order_status'] = "O";<br />
	// call the finish payment built in function<br />
				fn_finish_payment($_REQUEST['order_id'], $pp_response);<br />
   }	  <br />
	 fn_order_placement_routines($_REQUEST['order_id'], false);<br />
	} elseif ($mode == 'cancel') {<br />
  // if the answer is cancel<br />
  $order_info = fn_get_order_info($_REQUEST['order_id']);<br />
  // set order status here (whatever you want)<br />
		$pp_response['order_status'] = 'N';<br />
  $pp_response["reason_text"] = fn_get_lang_var('text_transaction_cancelled');<br />
  fn_finish_payment($_REQUEST['order_id'], $pp_response, false);<br />
  fn_order_placement_routines($_REQUEST['order_id']);<br />
	} elseif ($mode == 'failure'){<br />
  // if the answer is failure<br />
  $order_info = fn_get_order_info($_REQUEST['order_id']);<br />
  // set order status here (whatever you want)<br />
		$pp_response['order_status'] = 'N';<br />
  $pp_response["reason_text"] = fn_get_lang_var('text_transaction_declined');<br />
  fn_finish_payment($_REQUEST['order_id'], $pp_response, false);<br />
  fn_order_placement_routines($_REQUEST['order_id']);<br />
}<br />

```<br />
I hope this little code will help you.

drahos.istvan. Once again you save me :)

$ pp_response ['order_status'] = "P"
``` - this line I needed!<br />
Another question. Can I put the status of your order, if I know only him order_id?

[quote name=‘Psinetron’ timestamp=‘1351159943’ post=‘147657’]

drahos.istvan. Once again you save me :)

$ pp_response ['order_status'] = "P"
``` - this line I needed!<br />
Another question. Can I put the status of your order, if I know only him order_id?<br />
[/quote]<br />
I am very happy <img src="upload://rA9Qa8gnUPZzRZRdI8kt3dpjkrs.png" class="bbc_emoticon" alt=":)"> You know my answer, "Reputation points will be appreciated <img src="upload://rA9Qa8gnUPZzRZRdI8kt3dpjkrs.png" class="bbc_emoticon" alt=":)"><br />
<br />
But I think I did not understand your last question: "[color=#282828][font=arial, verdana, tahoma, sans-serif]Can I put the status of your order, if I know only him order_id?[/font][/color]"

Sorry for my English, I will teach. :)

The situation is this:

I send order data to the bank. Redirects the customer to a page of the bank. Buyer pays. Bank returns the order page. Now I want to put automatic status “Paid” or the “Bank rejected the operation.” To change the order status, I only know the order number (order_id).How to change the order status?

[quote name=‘Psinetron’ timestamp=‘1351221108’ post=‘147701’]

Sorry for my English, I will teach. :)

The situation is this:

I send order data to the bank. Redirects the customer to a page of the bank. Buyer pays. Bank returns the order page. Now I want to put automatic status “Paid” or the “Bank rejected the operation.” To change the order status, I only know the order number (order_id).How to change the order status?

[/quote]

Hi there!



Ok. I think this function (fn_finish_payment) makes it for you.

<br />
function fn_finish_payment($order_id, $pp_response, $force_notification = array())<br />
{<br />
// Change order status<br />
$valid_id = db_get_field("SELECT order_id FROM ?:order_data WHERE order_id = ?i AND type = 'S'", $order_id);<br />
if (!empty($valid_id)) {<br />
  db_query("DELETE FROM ?:order_data WHERE order_id = ?i AND type = 'S'", $order_id);<br />
  fn_update_order_payment_info($order_id, $pp_response);<br />
  if ($pp_response['order_status'] == 'N' && !empty($_SESSION['cart']['placement_action']) && $_SESSION['cart']['placement_action'] == 'repay') {<br />
   $pp_response['order_status'] = 'I';<br />
  }<br />
  fn_set_hook('finish_payment', $order_id, $pp_response, $force_notification);<br />
  fn_change_order_status($order_id, $pp_response['order_status'], '', $force_notification);<br />
}<br />
}<br />

```<br />
<br />
But if you would like to do it manually, the function is here:<br />
```php
<br />
fn_change_order_status($order_id, $status_to, $status_from = '', $force_notification = array(), $place_order = false)<br />

Thank you!

[quote name=‘Psinetron’ timestamp=‘1351248012’ post=‘147718’]

Thank you!

[/quote]

It is my pleasure :)