You are here

function commerce_robokassa_create_transaction in Commerce robokassa 7

Creates an robokassa payment transaction for the specified charge amount.

Parameters

$payment_method: The payment method instance object used to charge this payment.

$order: The order object the payment applies to.

$charge: An array indicating the amount and currency code to charge.

$name: The name entered on the submission form.

1 call to commerce_robokassa_create_transaction()
commerce_robokassa_result in ./commerce_robokassa.module
Page callback to receive payment notification from robokassa.

File

./commerce_robokassa.module, line 270

Code

function commerce_robokassa_create_transaction($order_id, $status) {
  $order = commerce_order_load($order_id);
  $payment_method = commerce_payment_method_instance_load($order->data['payment_method']);
  $transaction = commerce_payment_transaction_new('commerce_robokassa', $order->order_id);
  $transaction->instance_id = $payment_method['instance_id'];
  $wrapper = entity_metadata_wrapper('commerce_order', $order);
  $currency_code = $wrapper->commerce_order_total->currency_code
    ->value();
  $amount = $wrapper->commerce_order_total->amount
    ->value();

  //$transaction->amount = $order->commerce_order_total[LANGUAGE_NONE][0]['amount'];

  //$transaction->currency_code = $order->commerce_order_total[LANGUAGE_NONE][0]['currency_code'];

  // @doto Sheck statuses deeper
  $transaction->status = COMMERCE_PAYMENT_STATUS_SUCCESS;
  $transaction->message = '';
  $transaction->message_variables = array();
  commerce_payment_transaction_save($transaction);

  // @doto is this actually need?
  rules_invoke_all('commerce_checkout_complete', $order);
}