group PaymentMethodSqlDao: EntitySqlDao;


tableFields(prefix) ::= <<
  <prefix>account_id
, <prefix>plugin_name
, <prefix>is_active
, <prefix>external_id
, <prefix>created_by
, <prefix>created_date
, <prefix>updated_by
, <prefix>updated_date
>>

tableValues() ::= <<
  :account_id
, :plugin_name
, :is_active
, :external_id
, :created_by
, :created_date
, :updated_by
, :updated_date
>>

historyTableName() ::= "payment_method_history"

markPaymentMethodAsDeleted() ::= <<
    UPDATE payment_methods 
    SET is_active = 0
    WHERE  id = :id
    <AND_CHECK_TENANT()>
    ;
>>

unmarkPaymentMethodAsDeleted() ::= <<
    UPDATE payment_methods
    SET is_active = 1
    WHERE  id = :id
    <AND_CHECK_TENANT()>
    ;
>>

getPaymentMethodIncludedDelete() ::= <<
    SELECT <paymentMethodFields()>
      FROM payment_methods
    WHERE id = :id;
>>

getPaymentMethods() ::= <<
    SELECT <paymentMethodFields()>
      FROM payment_methods
    WHERE account_id = :accountId AND is_active = 1
    <AND_CHECK_TENANT()>
    ;
>>
