Module: MercuryBanking::CLI::Reconciliation::UnreconcileCommand
- Defined in:
- lib/mercury_banking/cli/reconciliation.rb
Overview
Module for unreconcile command
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/mercury_banking/cli/reconciliation.rb', line 168 def self.included(base) base.class_eval do desc 'unreconcile ACCOUNT_ID_OR_NUMBER TRANSACTION_ID', 'Mark a transaction as unreconciled' def unreconcile(account_identifier, transaction_id) with_api_client do |client| # Resolve account identifier to account ID account_id = resolve_account_id(client, account_identifier) # Verify the transaction exists but don't need to store it client.transaction(account_id, transaction_id) # Mark the transaction as unreconciled reconciliation = MercuryBanking::Reconciliation.new result = reconciliation.mark_unreconciled(account_id, transaction_id) if [:json] puts JSON.pretty_generate({ 'account_id' => account_id, 'transaction_id' => transaction_id, 'reconciled' => false, 'was_reconciled' => result }) elsif result puts "Transaction #{transaction_id} marked as unreconciled." else puts "Transaction #{transaction_id} was not reconciled." end end end end end |