Tranzacții online cu carduri Mastercard și Visa

De la PlatiOnline
Salt la: navigare, căutare

osCommerce 2.3.3 PlatiOnline.ro Payment Method Installation Guide

Step 1: Drop the 'catalog folder contents into your shop folder.
Step 2: If you have a vanilla (clean) osCommerce install, you can also overwrite the 'checkout_process.php' file in your catalog folder.
Otherwise, it might be safer to follow these steps:

2.1 Find this line (around 134)

	$customer_notification = (SEND_EMAILS == 'true') ? '1' : '0';

Add below it:

	/* PlatiOnline Payment Module - v2012.10.07 */
	// Save the orders_id in order array
	if (isset($insert_id) && !is_null($insert_id) && (int)$insert_id == $insert_id) {
		$order->info['orders_id'] = $insert_id;
	} else {
		// Fallback
		$order->info['orders_id'] = $customer_id;
	}
	/* End PlatiOnline Payment Module - v2012.10.07 */

2.2 Find this line (around 297):

	$payment_modules->after_process();

Replace it with:

	/* PlatiOnline Payment Module - v2012.10.07 */
	/* Schimbare in modul de operare a PO -> se salveaza comanda inainte de intrarea in PlatiOnline */
	$local_process_button_string = '';
	if ( is_array($payment_modules->modules) && $payment_modules->selected_module == 'po') {
		$local_process_button_string = $payment_modules->after_process();
	} else {
		$payment_modules->after_process();
	}
	/* End PlatiOnline Payment Module - v2012.10.07 */
2.3 Find this line (at the end of the file):

	tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));

Replace it with:

	//tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));	if ( is_array($payment_modules->modules) && $payment_modules->selected_module == 'po') {		require(DIR_WS_INCLUDES . 'template_top.php');
		if (isset($$payment->form_post_action_url)) {
			$form_post_action_url = $$payment->form_post_action_url;
		} else {
			$form_post_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');
		} ?>
		<form id="checkout_process" name="checkout_process" method="post" action="<?php echo htmlspecialchars( $form_post_action_url ) ?>">
			<h1>Your order is being sent to PlatiOnline.</h1>
			<div>
				<p>Please wait...</p>
				<?php
					echo tep_draw_hidden_field('comments', $order->info['comments']);
					echo $local_process_button_string; ?>

					<div class="right">
						<?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', null, 'primary'); ?>
					</div>
			</div>
		</form>
		<script type="text/javascript">
			function delayedSubmit(){
				document.checkout_process.submit();
			}
			setTimeout('delayedSubmit()', 3000)
		</script>
		<?php
		require(DIR_WS_INCLUDES . 'template_bottom.php');
	} else {
		tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));
	}
	/* End PlatiOnline Payment Module - v2012.10.07 */
Step 3: Install the plugin in the backend -> modules -> payment.


Step 4: Log in your PlatiOnline Comercianti/Merchants account and get your MerchID, KeyEnc and KeyMod.


Step 5 (optional): Back to your shop admin page, go to Localization -> Orders Status, where you should create order statuses for each of these PO status:
 AUTHORIZED
 DECLINED
 VOIDED
 ONHOLD
 REFUNDED
 CHARGEBACK
 SETTLED


Step 6: In your shop admin page, go to the plugin's settings page and fill in your MerchID, KeyEnc and KeyMod.
You might want to change some of the settings to suit your needs (eg. Orders Statuses).


Step 7: Run the add_po_fields_to_order_table.sql (using phpMyAdmin or another MySQL Management Tool) OR manually add the following fields to your orders DB table:
po_TransID (INT( 0))
, po_amount (FLOAT(6, 2))
, po_currency (VARCHAR(3)).
 Make sure you run the provided SQL or add the fields in the orders table!


Step 8 (optional but recommended): If you have a vanilla (clean) osCommerce install, you can also overwrite the orders.php file in your admin folder.
Otherwise, it might be safer to open /admin/orders.php and find this code (around 157):
	  <tr>
		<td class="main"><strong><?php echo ENTRY_PAYMENT_METHOD; ?></strong></td>
		<td class="main"><?php echo $order->info['payment_method']; ?></td>
	  </tr>

Then add below it:

	  <!-- PlatiOnline Payment Module - v2012.10.07 -->	  
	  <?php		// Build order PO params SQL
		$sql_POParams = "SELECT po_TransID, po_amount, po_currency FROM " . TABLE_ORDERS . " WHERE orders_id='" . $oID . "';";

		// Get the order PO params
		$query_POParams = tep_db_query($sql_POParams);
		$POParams = tep_db_fetch_array($query_POParams));
	  ?>
          <tr>
            <td class="main"><strong>po_TransID</strong></td>
            <td class="main"><?php echo $POParams['po_TransID']; ?></td>
          </tr>
          <tr>
            <td class="main"><strong>po_amount</strong></td>
            <td class="main"><?php echo $POParams['po_amount']; ?></td>
          </tr>
          <tr>
            <td class="main"><strong>po_currency</strong></td>
            <td class="main"><?php echo $POParams['po_currency']; ?></td>
          </tr>
	  <!-- End PlatiOnline Payment Module - v2012.10.07 -->


Step 9 (just check it): Remember to properly set the URLs int your merchant account.
- Example URL for transaction response: http://oscommerce.plationline.eu/checkout_response_po.php
- Example URL for ITSN: http://oscommerce.plationline.eu/itsn_po.php