You are here

function commerce_gc_commerce_coupon_insert in Commerce GC 7

File

./commerce_gc.module, line 1127
Provides Giftcard coupon bundle, Giftcard Transaction entity and basic user interface elements.

Code

function commerce_gc_commerce_coupon_insert($coupon) {
  if ($coupon->type == 'giftcard_coupon') {
    $coupon_wrapper = entity_metadata_wrapper('commerce_coupon', $coupon);

    // Write a new transaction record for the coupon
    commerce_gc_transaction_write($coupon->coupon_id, $coupon_wrapper->commerce_gc_value->amount
      ->value());
  }
}