group PaymentAttemptSqlDao: EntitySqlDao;

tableName() ::= "payment_attempts"

historyTableName() ::= "payment_attempt_history"


tableFields(prefix) ::= <<
  <prefix>payment_external_key
, <prefix>transaction_id
, <prefix>transaction_external_key
, <prefix>state_name
, <prefix>operation_name
, <prefix>plugin_name
, <prefix>created_by
, <prefix>created_date
, <prefix>updated_by
, <prefix>updated_date
>>

tableValues() ::= <<
  :paymentExternalKey
, :transactionId
, :transactionExternalKey
, :stateName
, :operationName
, :pluginName
, :createdBy
, :createdDate
, :updatedBy
, :updatedDate
>>

getByTransactionExternalKey() ::= <<
select
<allTableFields("")>
from <tableName()>
where transaction_external_key = :transactionExternalKey
<andCheckSoftDeletionWithComma("")>
<AND_CHECK_TENANT("")>
;
>>

getByPaymentExternalKey() ::= <<
select
<allTableFields("")>
from <tableName()>
where payment_external_key = :paymentExternalKey
<andCheckSoftDeletionWithComma("")>
<AND_CHECK_TENANT("")>
;
>>


updateAttempt() ::= <<
update <tableName()>
set state_name = :stateName
, transaction_id = :transactionId
, updated_by = :updatedBy
, updated_date = :createdDate
where id = :id
<AND_CHECK_TENANT()>
;
>>




