i've coded a checkout complete but aint triggering other modules checkout complete rules, i'm assuming commerce_checkout_complete($order->order_id); will do this.
The most important thing for me is that, the items on the cart are files, hence i have commerce licence that grant license to each files which is not triggered by the code below. Any tips on how to do this please?
Thank you very much.
<?php
function custom_module_complete_order($order_id) {
$order = commerce_order_load($order_id);
commerce_order_status_update($order, 'checkout_checkout');
$payment_method = commerce_payment_method_instance_load('commerce_payment_example|commerce_payment_commerce_payment_example');
$transaction = commerce_payment_transaction_new('commerce_payment_example', $order->order_id);
$transaction->instance_id = $payment_method['instance_id'];
$transaction->amount = $order->commerce_order_total['und'][0]['amount'];
$transaction->currency_code = $order->commerce_order_total['und'][0]['currency_code'];
$transaction->status = COMMERCE_PAYMENT_STATUS_SUCCESS;
$transaction->message = 'Name: @name';
$transaction->message_variables = array('@name' => 'Commerce Cartmaker Payment');
commerce_payment_transaction_save($transaction);
commerce_payment_commerce_payment_transaction_insert($transaction);
commerce_order_save($order);
commerce_checkout_complete($order->order_id);
}
?>