All Projects → salesking → Sepa_king

salesking / Sepa_king

Licence: mit
Ruby gem for creating SEPA XML files

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Sepa king

Mojaloop
Starting point for on-boarding and contribution documentation for mojaloop
Stars: ✭ 267 (+113.6%)
Mutual labels:  payment, fintech
Ach
ACH implements a reader, writer, and validator for Automated Clearing House (ACH) files. The HTTP server is available in a Docker image and the Go package is available.
Stars: ✭ 210 (+68%)
Mutual labels:  payment, fintech
Openfintech
Opensource FinTech standards & payment provider data
Stars: ✭ 87 (-30.4%)
Mutual labels:  payment, fintech
terms-dictionary
Simple definitions of terms, acronyms, abbreviations, companies, and projects related to financial services and Moov.
Stars: ✭ 48 (-61.6%)
Mutual labels:  payment, fintech
Libreselery
Continuous distribution of funding to your project contributors and dependencies. Integrated into GitHub Actions
Stars: ✭ 92 (-26.4%)
Mutual labels:  payment, fintech
Iyzipay Node
iyzipay api node.js client
Stars: ✭ 116 (-7.2%)
Mutual labels:  fintech
Saxerator
A SAX-based XML parser for parsing large files into manageable chunks
Stars: ✭ 119 (-4.8%)
Mutual labels:  xml
Bashcov
Code coverage tool for Bash
Stars: ✭ 113 (-9.6%)
Mutual labels:  rubygems
Xlpaymenthud
iOS 支付宝支付动画
Stars: ✭ 113 (-9.6%)
Mutual labels:  payment
Sdk Dotnet
.Net SDK for Authorize.Net API
Stars: ✭ 124 (-0.8%)
Mutual labels:  payment
Snodge
Randomly mutate JSON, XML, HTML forms, text and binary data for fuzz testing
Stars: ✭ 121 (-3.2%)
Mutual labels:  xml
Tokencaps
A middleware framework and persistence layer to aggregate and normalize crypto-currency data.
Stars: ✭ 118 (-5.6%)
Mutual labels:  fintech
Fetch Plus
🐕 Fetch+ is a convenient Fetch API replacement with first-class middleware support.
Stars: ✭ 116 (-7.2%)
Mutual labels:  xml
Payumlaravelpackage
Payum offers everything you need to work with payments. From simplest use cases to very advanced ones.
Stars: ✭ 121 (-3.2%)
Mutual labels:  payment
Openpgp.rb
[Retired] OpenPGP.rb is a pure-Ruby implementation of the OpenPGP Message Format (RFC 4880).
Stars: ✭ 115 (-8%)
Mutual labels:  rubygems
Awesome Stellar
👨‍🚀 A curated list of Stellar applications, blog posts, educational resources, tools, and more.
Stars: ✭ 123 (-1.6%)
Mutual labels:  fintech
Marklogic Data Hub
The MarkLogic Data Hub: documentation ==>
Stars: ✭ 113 (-9.6%)
Mutual labels:  xml
Flexlib
FlexLib是一个基于flexbox模型,使用xml文件进行界面布局的框架,融合了web快速布局的能力,让iOS界面开发像写网页一样简单快速
Stars: ✭ 1,569 (+1155.2%)
Mutual labels:  xml
Markup.ml
Error-recovering streaming HTML5 and XML parsers
Stars: ✭ 122 (-2.4%)
Mutual labels:  xml
Lemminx
XML Language Server
Stars: ✭ 117 (-6.4%)
Mutual labels:  xml

Ruby gem for creating SEPA XML files

Build Status Code Climate Coverage Status Gem Version Dependency Status

We love building payment applications! So after developing the DTAUS library for Ruby we move on with SEPA.

Features

This gem implements the following two messages out of the ISO 20022 standard:

  • Credit Transfer Initiation (pain.001.003.03, pain.001.002.03 and pain.001.001.03)
  • Direct Debit Initiation (pain.008.003.02, pain.008.002.02 and pain.008.001.02)

It handles the Specification of Data Formats v2.7 (2013-11-04).

BTW: pain is a shortcut for Payment Initiation.

Requirements

  • Ruby 2.2 or newer
  • ActiveModel 3.1 or newer (including 6.0)

Installation

gem install sepa_king

Usage

How to create the XML for Direct Debit Initiation (in German: "Lastschriften")

# First: Create the main object
sdd = SEPA::DirectDebit.new(
  # Name of the initiating party and creditor, in German: "Auftraggeber"
  # String, max. 70 char
  name:       'Gläubiger GmbH',

  # OPTIONAL: Business Identifier Code (SWIFT-Code) of the creditor
  # String, 8 or 11 char
  bic:        'BANKDEFFXXX',

  # International Bank Account Number of the creditor
  # String, max. 34 chars
  iban:       'DE87200500001234567890',

  # Creditor Identifier, in German: Gläubiger-Identifikationsnummer
  # String, max. 35 chars
  creditor_identifier: 'DE98ZZZ09999999999'
)

# Second: Add transactions
sdd.add_transaction(
  # Name of the debtor, in German: "Zahlungspflichtiger"
  # String, max. 70 char
  name:                      'Zahlemann & Söhne GbR',

  # OPTIONAL: Business Identifier Code (SWIFT-Code) of the debtor's account
  # String, 8 or 11 char
  bic:                       'SPUEDE2UXXX',

  # International Bank Account Number of the debtor's account
  # String, max. 34 chars
  iban:                      'DE21500500009876543210',

  # Amount
  # Number with two decimal digit
  amount:                    39.99,

  # OPTIONAL: Currency, EUR by default (ISO 4217 standard)
  # String, 3 char
  currency:                  'EUR',

  # OPTIONAL: Instruction Identification, will not be submitted to the debtor
  # String, max. 35 char
  instruction:               '12345',

  # OPTIONAL: End-To-End-Identification, will be submitted to the debtor
  # String, max. 35 char
  reference:                 'XYZ/2013-08-ABO/6789',

  # OPTIONAL: Unstructured remittance information, in German "Verwendungszweck"
  # String, max. 140 char
  remittance_information:    'Vielen Dank für Ihren Einkauf!',

  # Mandate identifikation, in German "Mandatsreferenz"
  # String, max. 35 char
  mandate_id:                'K-02-2011-12345',

  # Mandate Date of signature, in German "Datum, zu dem das Mandat unterschrieben wurde"
  # Date
  mandate_date_of_signature: Date.new(2011,1,25),

  # Local instrument, in German "Lastschriftart"
  # One of these strings:
  #   'CORE' ("Basis-Lastschrift")
  #   'COR1' ("Basis-Lastschrift mit verkürzter Vorlagefrist")
  #   'B2B' ("Firmen-Lastschrift")
  local_instrument: 'CORE',

  # Sequence type
  # One of these strings:
  #   'FRST' ("Erst-Lastschrift")
  #   'RCUR' ("Folge-Lastschrift")
  #   'OOFF' ("Einmalige Lastschrift")
  #   'FNAL' ("Letztmalige Lastschrift")
  sequence_type: 'OOFF',

  # OPTIONAL: Requested collection date, in German "Fälligkeitsdatum der Lastschrift"
  # Date
  requested_date: Date.new(2013,9,5),

  # OPTIONAL: Enables or disables batch booking, in German "Sammelbuchung / Einzelbuchung"
  # True or False
  batch_booking: true

  # OPTIONAL: Use a different creditor account
  # CreditorAccount
  creditor_account: SEPA::CreditorAccount.new(
    name:                'Creditor Inc.',
    bic:                 'RABONL2U',
    iban:                'NL08RABO0135742099',
    creditor_identifier: 'NL53ZZZ091734220000'
  )

  # OPTIONAL: Specify the country & address of the debtor (REQUIRED for SEPA debits outside of EU. The individually required fields depend on the target country)
  debtor_address: SEPA::DebtorAddress.new(
    country_code:        'CH',
    # Not required if individual fields are used
    address_line1:       'Mustergasse 123a',
    address_line2:       '1234 Musterstadt'
    # Not required if address_line1 and address_line2 are used
    street_name:         'Mustergasse',
    building_number:     '123a',
    post_code:           '1234',
    town_name:           'Musterstadt'
  )
)
sdd.add_transaction ...

# Last: create XML string
xml_string = sdd.to_xml # Use latest schema pain.008.003.02
xml_string = sdd.to_xml('pain.008.002.02') # Use former schema pain.008.002.02

How to create the XML for Credit Transfer Initiation (in German: "Überweisungen")

# First: Create the main object
sct = SEPA::CreditTransfer.new(
  # Name of the initiating party and debtor, in German: "Auftraggeber"
  # String, max. 70 char
  name: 'Schuldner GmbH',

  # OPTIONAL: Business Identifier Code (SWIFT-Code) of the debtor
  # String, 8 or 11 char
  bic:  'BANKDEFFXXX',

  # International Bank Account Number of the debtor
  # String, max. 34 chars
  iban: 'DE87200500001234567890'
)

# Second: Add transactions
sct.add_transaction(
  # Name of the creditor, in German: "Zahlungsempfänger"
  # String, max. 70 char
  name:                   'Telekomiker AG',

  # OPTIONAL: Business Identifier Code (SWIFT-Code) of the creditor's account
  # String, 8 or 11 char
  bic:                    'PBNKDEFF370',

  # International Bank Account Number of the creditor's account
  # String, max. 34 chars
  iban:                   'DE37112589611964645802',

  # Amount
  # Number with two decimal digit
  amount:                 102.50,

  # OPTIONAL: Currency, EUR by default (ISO 4217 standard)
  # String, 3 char
  currency:               'EUR',

  # OPTIONAL: Instruction Identification, will not be submitted to the creditor
  # String, max. 35 char
  instruction:               '12345',

  # OPTIONAL: End-To-End-Identification, will be submitted to the creditor
  # String, max. 35 char
  reference:              'XYZ-1234/123',

  # OPTIONAL: Unstructured remittance information, in German "Verwendungszweck"
  # String, max. 140 char
  remittance_information: 'Rechnung vom 22.08.2013',

  # OPTIONAL: Requested execution date, in German "Ausführungstermin"
  # Date
  requested_date: Date.new(2013,9,5),

  # OPTIONAL: Enables or disables batch booking, in German "Sammelbuchung / Einzelbuchung"
  # True or False
  batch_booking: true,

  # OPTIONAL: Urgent Payment
  # One of these strings:
  #   'SEPA' ("SEPA-Zahlung")
  #   'URGP' ("Taggleiche Eilüberweisung")
  service_level: 'URGP'

  # OPTIONAL: Unstructured information to indicate the purpose of the payment
  # String, max. 4 char
  category_purpose:         'SALA',

  # OPTIONAL: Specify the country & address of the creditor (REQUIRED for SEPA debits outside of EU. The individually required fields depend on the target country)
  creditor_address: SEPA::CreditorAddress.new(
    country_code:        'CH',
    # Not required if individual fields are used
    address_line1:       'Mustergasse 123a',
    address_line2:       '1234 Musterstadt'
    # Not required if address_line1 and address_line2 are used
    street_name:         'Mustergasse',
    building_number:     '123a',
    post_code:           '1234',
    town_name:           'Musterstadt'
  )
)
sct.add_transaction ...

# Last: create XML string
xml_string = sct.to_xml # Use latest schema pain.001.003.03
xml_string = sct.to_xml('pain.001.002.03') # Use former schema pain.001.002.03

Validations

You can rely on our internal validations, raising errors when needed, during message creation. To validate your models holding SEPA related information (e.g. BIC, IBAN, mandate_id) you can use our validator classes or rely on some constants.

Examples:

class BankAccount < ActiveRecord::Base
  # IBAN validation, by default it validates the attribute named "iban"
  validates_with SEPA::IBANValidator, field_name: :iban_the_terrible

  # BIC validation, by default it validates the attribute named "bic"
  validates_with SEPA::BICValidator, field_name: :bank_bic
end

class Payment < ActiveRecord::Base
  validates_inclusion_of :sepa_sequence_type, in: SEPA::DirectDebitTransaction::SEQUENCE_TYPES

  # Mandate ID validation, by default it validates the attribute named "mandate_id"
  validates_with SEPA::MandateIdentifierValidator, field_name: :mandate_id
end

Beware: The SEPA::IBANValidator is strict - e.g. it does not allow any spaces in the IBAN.

Also see:

Changelog

https://github.com/salesking/sepa_king/releases

Contributors

https://github.com/salesking/sepa_king/graphs/contributors

Resources

License

Released under the MIT license

Copyright (c) 2013-2019 Georg Leciejewski (SalesKing), Georg Ledermann (https://github.com/ledermann)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].