function commerce_gc_transaction_write in Commerce GC 7
Write a new commerce giftcard transaction record. Uses a database transaction to ensure balance integrity.
Parameters
type $coupon_id:
type $amount:
Return value
type
See also
CommerceGCTransactionEntityController::save().
4 calls to commerce_gc_transaction_write()
File
- ./
commerce_gc.module, line 649 - Provides Giftcard coupon bundle, Giftcard Transaction entity and basic user interface elements.
Code
function commerce_gc_transaction_write($coupon_id, $amount, $status = 'complete') {
$values = array(
'coupon_id' => $coupon_id,
'amount' => $amount,
'status' => $status,
);
$transaction = commerce_gc_transaction_new($values);
// Insert record
commerce_gc_transaction_save($transaction);
return !empty($transaction->transaction_id) ? $transaction->transaction_id : NULL;
}