salesking / sepa_king

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

Container message support #118

Open tobischo opened 3 months ago

tobischo commented 3 months ago

sepa_king supports different versions for pain.001 and pain.008, which is amazing when using EBICS directly through e.g. CCT, CDB and CDD

When using EBICS in a service data center context it requires the use of containers (as specified in the attachment 3 of the file format specification of EBICS).

Would you be open to support the container formats as well? I will have that use case in the near future and would love to have that support open sourced and available for others to use where needed.

API wise I was thinking of something along the lines of:

container = SEPA::Container.new(
  # whichever meta info should be added
)

container.add_message(sdd1)
container.add_message(sdd2)
container.add_message(sdd3)

# picks the pain message format fitting to the container version
# and ensures that all passed messages are of the same type
xml_string = container.to_xml
xml_string = container.to_xml("<specific format/version>")