postgresql
7.1
select ec_gift_certificate_balance(:user_id)
select ec_order_gift_cert_amount(:order_id)
select coalesce(sum(i.price_charged),0) - coalesce(sum(i.price_refunded),0) as soft_goods_cost
from ec_items i, ec_products p
where i.order_id = :order_id
and i.item_state <> 'void'
and i.product_id = p.product_id
and p.no_shipping_avail_p = 't'
select coalesce(sum(i.price_charged),0) - coalesce(sum(i.price_refunded),0) as hard_goods_cost
from ec_items i, ec_products p
where i.order_id = :order_id
and i.item_state <> 'void'
and i.product_id = p.product_id
and p.no_shipping_avail_p = 'f'
insert into ec_financial_transactions
(transaction_id, order_id, transaction_amount, transaction_type, inserted_date)
values
(:transaction_id, :order_id, :transaction_amount, 'charge', current_timestamp)
update ec_financial_transactions
set authorized_date = current_timestamp
where transaction_id = :transaction_id
*op
update ec_financial_transactions
set authorized_date = current_timestamp, to_be_captured_p = 't', to_be_captured_date = current_timestamp
where transaction_id = :transaction_id
update ec_financial_transactions
set to_be_captured_p = 't', to_be_captured_date = current_timestamp
where transaction_id = :transaction_id
insert into ec_problems_log
(problem_id, problem_date, problem_details, order_id)
values
(ec_problem_id_sequence.nextval, current_timestamp, :problem_details, :order_id)
update ec_financial_transactions
set marked_date = current_timestamp
where transaction_id = :pgw_transaction_id