salesking / sepa_king

Ruby gem for creating SEPA XML files
MIT License
149 stars 118 forks source link

Get final batch id from SEPA message #28

Closed edwinv closed 10 years ago

edwinv commented 10 years ago

This pull request contains changes to provide the batch id of a certain transaction. The batch id is used in bank transactions to reference a certain batch in a SEPA message.

Added are two extra methods for a SEPA::Message:

  1. SEPA::Message#batch_id(transaction_reference): fetches the batch id of the transaction with the given reference
  2. SEPA::Message#batches: returns an array with the batch ids of the batch in the current file

For a successful implementation of these methods, a refactor was required. Transactions are now stored in groups right after adding a transaction with add_transaction. For backward compatibility, it is still possible to get all transactions across all batches by calling the transactions method.

schorsch commented 10 years ago

Does not look to bad :-)
@ledermann what are your thoughts on it?

ledermann commented 10 years ago

Great, thanks!