group RefundSqlDao: EntitySqlDao;

tableName() ::= "refunds"

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
>>

updateStatus() ::= <<
    UPDATE refunds
    SET refund_status = :refundStatus
    WHERE id = :id
    <AND_CHECK_TENANT()>
    ;
>>

getRefundsForPayment()  ::= <<
    SELECT <refundFields()>
    FROM refunds
    WHERE payment_id = :paymentId
    <AND_CHECK_TENANT()>
    ;
>>

getRefundsForAccount()  ::= <<
    SELECT <refundFields()>
    FROM refunds
    WHERE account_id = :accountId
    <AND_CHECK_TENANT()>
    ;
>>
