Jump to content

 

huyvu

Member Since 22 Jun 2020
Offline Last Active Jul 28 2020 04:46 PM
-----

Posts I've Made

In Topic: Payment Addon Development

17 July 2020 - 06:39 PM

Thank you so much. It works. I passed an empty order_id.

 

There are new problem:

- I can't get $processor_data when PAYMENT_NOTIFICATION defined.

- fn_order_placement_routines('route', $order_id) doesn't clear cart and not redirect to order completed page but come back to checkout page.

My bad, fn_order_placement_routines('route', $order_id) work when $pp_response['order_status'] = 'P'


In Topic: Payment Addon Development

17 July 2020 - 06:04 PM

 

then replace

if (!fn_check_payment_script(MOMO_PROCESSOR_SCRIPT, $order_id)) {

with

if (!fn_check_payment_script('momo_processor.php', $_REQUEST['order_id'])) {

 

Thank you so much. It works. I passed an empty order_id.

 

There are new problem:

- I can't get $processor_data when PAYMENT_NOTIFICATION defined.

- fn_order_placement_routines('route', $order_id) doesn't clear cart and not redirect to order completed page but come back to checkout page.


In Topic: Payment Addon Development

17 July 2020 - 06:09 AM

If your payment script is called my_script.php, URL should contain the following parameter

 

...&payment=my_script&...

I already changed payment to my script ...&payment=momo_processor&... but still doesn't work. Please see the attachment. Thanks


In Topic: Payment Addon Development

16 July 2020 - 06:16 AM

Hi eComLabs,

 

I get "404 Page not found" with the return url

http://sivin-7f251c0d.localhost.run/index.php?dispatch=payment_notification.invoice&payment=Momo&order_id=101&partnerCode=...

My payment_notification code:

if (defined('PAYMENT_NOTIFICATION')) {

    if (!fn_check_payment_script(MOMO_PROCESSOR_SCRIPT, $order_id)) {
        return array(CONTROLLER_STATUS_DENIED);
    }

    $order_id = $_REQUEST['order_id'];
    $pp_response = fn_momo_response_processing($_REQUEST, $processor_data['processor_params']['secret_key']);
        
    if ($mode == 'notify') {

        fn_change_order_status($order_id, $pp_response["order_status"], '', true);
        exit();

    } elseif ($mode == 'invoice') {

        fn_finish_payment($order_id, $pp_response, false);
        fn_order_placement_routines('route', $order_id);
        exit();
    }

}

Thanks for your help :wub:


In Topic: Payment Addon Development

07 July 2020 - 11:13 AM

I'm using cUrl instead of fn_create_payment_form. Is it good? Thanks

$post_data = json_encode($data);

$ch = curl_init($endpoint);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// for localhost
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);

$result = curl_exec($ch);
curl_close($ch);

$arrayResult = json_decode($result, true);

header('Content-type: text/html; charset=utf-8');
header('Location: ' . $arrayResult['payUrl']);

exit;