RefundSqlDao.sql.stg

56 lines | 917 B Blame History Raw Download
group RefundSqlDao: EntitySqlDao;

tableName() ::= "refunds"

historyTableName() ::= "refund_history"

tableFields(prefix) ::= <<
  <prefix>account_id
, <prefix>payment_id
, <prefix>amount
, <prefix>currency
, <prefix>is_adjusted
, <prefix>refund_status
, <prefix>created_by
, <prefix>created_date
, <prefix>updated_by
, <prefix>updated_date
>>

tableValues() ::= <<
:accountId
, :paymentId
, :amount
, :currency
, :isAdjusted
, :refundStatus
, :createdBy
, :createdDate
, :updatedBy
, :updatedDate
>>

updateStatus(refundStatus) ::= <<
update <tableName()>
set refund_status = :refundStatus
where id = :id
<AND_CHECK_TENANT()>
;
>>

getRefundsForPayment(paymentId)  ::= <<
select <allTableFields()>
from <tableName()>
where payment_id = :paymentId
<AND_CHECK_TENANT()>
;
>>

getRefundsForAccount(accountId)  ::= <<
select <allTableFields()>
from <tableName()>
where account_id = :accountId
<AND_CHECK_TENANT()>
;
>>