salesking / sepa_king Goto Github PK
View Code? Open in Web Editor NEWRuby gem for creating SEPA XML files
License: MIT License
Ruby gem for creating SEPA XML files
License: MIT License
Dear Salesking,
thank your for providing sepa_king.
Unfortunately upon setting the :local_instrument as provided in your readme I get the above error.
Am I doing something wrong here?
Hey,
I'm interested, if you would find it useful to remove the ActiveModel dependency? This would be a feature for non rails users.
Best regards
I really like your gem. Thank you for putting in the effort!
My question is, are there any plans to support the updated specifications of SEPA 3.1?
As far as I can tell, this library is still based around the 2.7 version vom late 2013 and some things have changed over the past few years like removing the COR1 option and no longer differentiating between first, last and recurring transactions.
Would you be open to a PR with support for ActiveModel 3.2.x?
RubyGems.org doesn't report a license for your gem. This is because it is not specified in the gemspec of your last release.
via e.g.
spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']
Including a license in your gemspec is an easy way for rubygems.org and other tools to check how your gem is licensed. As you can imagine, scanning your repository for a LICENSE file or parsing the README, and then attempting to identify the license or licenses is much more difficult and more error prone. So, even for projects that already specify a license, including a license in your gemspec is a good practice. See, for example, how rubygems.org uses the gemspec to display the rails gem license.
There is even a License Finder gem to help companies/individuals ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough issue that even Bundler now generates gems with a default 'MIT' license.
I hope you'll consider specifying a license in your gemspec. If not, please just close the issue with a nice message. In either case, I'll follow up. Thanks for your time!
Appendix:
If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file), GitHub has created a license picker tool. Code without a license specified defaults to 'All rights reserved'-- denying others all rights to use of the code.
Here's a list of the license names I've found and their frequencies
p.s. In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :). See the previous link or my blog post about this project for more information.
<ChrgBr>SLEV</ChrgBr>
means that the ChargerBearer is ServiceLevel.. When ServiceLevel is nil, it shouldn't be shown in the xml file.. Some Payments in CHF can be denied by the swiss bank institutions if this field is set as SLEV..
I created a small PR for that: #84
We are using sepa_king to generate SEPA Transfer files in order to tell our bank to transfer money to our customers.
We noticed that it sets the requested_date for CreditTransfers to the date after creation as default
The default seems ok - however, it is also not possible to pass in today as a date.
Is there a particular reason that it has to be the next day and today is specifically not allowed?
I couldn't find any documentation about it and our bank says setting the date to today is fine for them.
(We generate the files in the morning and give them to the bank to execute some time during the day)
Since we dont test with ruby 1.8.7 we could use the shiny new hash: 'syntax'
Hi all,
I am not a big expert in Sepa so maybe the following is a stupid question. Our contract with the bank has a limited amount of money that can be collected in one sepa batch. Our current workaround for this is to create multiple seperate batches (in different sepa files) and upload this to the bank. This works fine, but is not ideal since we need to create multiple sepa files and therefore have different collections in our system. Is it possible to keep those different batches (since we have to by our contract) but group them in one file? I heard sometime ago that this should be possible within the SEPA standard. Is this true? And how can I do this within sepa_king?
Would like the hear from you!
Support for Business to Business (B2B) Direct Debit Scheme
Hey guys,
Just wondering if there are any plans to add support for pain 001.001.02 or 001.001.03 schemas in this gem? If not could anyone point me in the direction of another gem that would cater for them? Thanks!
The implemented Data Formats v2.7 is end of life. In November 2022 many banks will drop its support: https://www.ebics.de/de/datenformate/format-lifecycle
Are there any plans to implement new versions?
I am having trouble generating a XML file with this gem using pain.0001.001.03 and currency in CHF. When I upload the file to Credit Suisse test page to check the structure, it says
Currency 'CHF' is not allowed for payment type 5
. I think the problem is that using this gem, even if I don't set the service_level to 'SEPA', it is being automatically set to it for pain.0001.0001.03. If I just remove this part <PmtTpInf> <SvcLvl> <Cd>SEPA</Cd> </SvcLvl> </PmtTpInf>
from the xml, the file passes on the test. Can you provide a modification that would fix this? Like, if I don't provide the service_level information, the gem don't automatically sets it.
Support for BatchBooking. Currently, it is always set to true
First, thanks for putting this software out on Github. It's super helpful and I use it to manage the finances of a small students association in Germany.
For the future I want to propose to implement the following ebics functionality as well:
– Request old protocols (transactions) PKT
– Cancel transactions made before
I am not an expert of the ebics standard, so please excuse this request if it does not make sense or goes against the goals of your library.
Thanks!
Hello,
first, thanks a lot for this gem. It will probably save us a lot of work. Are there any plans to support the new format specifications:
Or can the currently implemented version still be used, is it backwards compatible? Sadly / fortunately we never had to deal with payment before, so we don't have any idea.
Hi!
Finnish banks (including Nordea bank) require the 001.001.03 XML to contain a Creditor Identifier
and an External Organization Identifier Code
for their SEPA transfers.
I've created PR #73 which allows for adding a Creditor Identifier
to DebtorAccount
and External Organization Identifier Code
for Account
(as it should be available for both creditor as debtor).
Sources:
Hi, thanks for the library, it's been a huge help!
Is there a recommended way to de-serialize the documents created by e.g. Sepa::CreditTransfer.new(...).to_xml
? I'm currently storing a log of all the XML docs we submit, and getting data out of them later means a lot of Xpath. It would be great if there was some sort of from_xml
method that would give me an object equivalent to the one I called to_xml
on.
Use cases for me include test assertions and displaying useful details about what bank transactions we've initiated with a given document.
Not as much of an issue as being curious. Why only providing unstructured message for CT's?
i'am trying to development java project to generate pain.008, pacs.003 XML ,
it's doable using sepa_king? if there example how can do this ?
Support for some special characters like German umlauts seems to have been added with SEPA 2.7.
sepa_king still replaces or even removes special characters in any given string. Shouldn't this limitation be removed? The use of i18n_transliterate
and the resulting replacement of all umlauts is bugging me the most.
I've noticed errors in two regular expressions used in the validators:
In SEPA::CreditorIdentifierValidator
:
REGEX = /\A[a-zA-Z]{2,2}[0-9]{2,2}([A-Za-z0-9]|[\+|\?|\/|\-|\:|\(|\)|\.|,|']){3,3}([A-Za-z0-9]|[\+|\?|\/|\-|:|\(|\)|\.|,|']){1,28}\z/
# ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
# A B B B ...
Here, |
is used as a meta-character for alternation to combine character classes (A
) which is correct. But |
is also used within a character class to combine its characters (B
) which is wrong. Within a character class, |
is treated as a literal character. You can't use it as a meta-character here.
In SEPA::MandateIdentifierValidator
:
REGEX = /\A([A-Za-z0-9]|[\+|\?|\/|\-|\:|\(|\)|\.|\,|\']){1,35}\z/
• Again, |
inside the character class (|
is not allowed per spec)
• The "space" character is missing, which according to the spec is a valid character
Apart from the above errors, the regular expressions seem overly complex and are quite hard to read. For example, instead of defining two separate character classes which are joined via |
, you can define the allowed characters in one character class which allows you to omit the capture group. You can also remove all of the escape characters by using %r|...|
and by moving -
to the end. Applied to MandateIdentifierValidator
's regex:
REGEX = %r|\A[A-Za-z0-9 +?/:().,'-]{1,35}\z|
Support for different SequenceType
Currently, only OOF is supported. The following are missing: FRST, RCUR, FNAL
class Company < ActiveRecord::Base
validates_with SEPA::BICValidator, field_name: :bank_bic
end
undefined method `bic' for #Company:0x007fb814508448
It seems like the validator doesn't recognize the the options passed in the validates_with method, am I missing something ?
=> Company.validators
"SEPA::BICValidator:0x007fd322fc0bf0 @options={:field_name=>:bank_bic}"
Hello,
we're using this gem to initiate credit transfers for Greek banks.
The problem is that names of initiating parties and account beneficiaries can be in Greek. As we see here, the only letter characters allowed are Latin and German. This results in empty strings and therefore validation errors.
Would you accept a PR that adds Greek letters to the allowed set?
Before submitting a pull request, I just want to check if you are open for this change. Message#add_transaction raises an ArgumentError exception when attributes have invalid data. But it only exposes them via a single error message. In our case, we would like to have them in a format like { bic: ['is invalid'] }
. In general one can attach additional data to exceptions, which in this case would be quite useful.
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>")
The Valid BIC "BYLADEM1TST" of Kreissparkasse Traunstein-Trostberg isnt matched by the regex.
I'm not very fluent with regex nor the sepa standard so maybe you know why it fails? Thx a lot.
Hi!
I am curious about the >=2.2 version specifier in the gemspec.
Could it be raised to a more-modern version, without losing a big chunk of this gem's audience? We are not running tests on non-supported Ruby versions, for example.
First of all, thanks for making this gem available!
During validation of the generated SEPA files I got an error that the value for PmtInfId was too long (max 35 characters). It would be nice if the length of this field was validated.
Happens when generating the xml, i.e.: sdd.to_xml
Any idea what might be causing it?
Nokogiri has no encoding explicitly set on the XML builder. This means that it will encode all non-ascii-chars as character entities (e.g. ö). Some software really dislikes this.
The same thing is also causing #85 ...
The 3 known debit schemas (pain.008.003.02, pain.008.002.02, pain.008.001.02) all support the InstructionId field in the PaymentInformation next to the EndToEndId.
In sepa_king this field can be set using the instruction
key when adding a transaction to a sepa document and it works for credits but not for debits. For debits it is even specifically mentioned in the README.
Is there a specific reason for this to be missing? Otherwise I'll prepare a pull request to add this, because we actually need this functionality.
Hi all!
We ran into an issue with a bank: they require the encoding to be implicit at XML declaration.
Sepa King creates an XML like this:
<?xml version="1.0"?>
But they require it to be:
<?xml version="1.0" encoding="utf-8" ?>
Is there a way to add this attribute at the current version? I can't figure it out.
Thanks in advance and best regards!
Hi!
In my case, the produced value for CreDtTm (Time.now.iso8601) includes a numeric time offset (the host date is set to CET, vie ene 20 13:37:31 CET 2017
)
<CreDtTm>2017-01-20T12:06:07+00:00</CreDtTm>
and is not considered as a valid value for some Spanish banks (Liberbank in this case), it should be great the possibility to using a custom date.
I think fixed on PR #59.
Spanish banks seem to require an Id tag inside the InitiatingParty (InitgPty) tag, not just a name. Something like:
<CstmrDrctDbtInitn>
<GrpHdr>
...
<InitgPty>
<Nm>COMPNAY NAME</Nm>
<Id>
<OrgId>
<Othr>
<Id>XXXXXXXXXXXXXX</Id>
</Othr>
</OrgId>
</Id>
</InitgPty>
</GrpHdr>
How can this be done? It seems it is not supported, isn't? Could you please add support for this?
In any case, thank you for this gem!
To initiate direct debits in France I have to use pain.008.001.02 and the BIC is optional. I'll prepare a pull request but I have a few questions first.
Adding support for pain.008.001.02 was trivial. I didn't change anything in the file generation and it was validated by my bank. But there are probably differences other than the version number. Will you merge support for pain.008.001.02 if the only difference with pain.008.002.02 is the version number?
My bank accepts pain.008.001.02 files without debtor BIC. But I think the specs says it's mandatory. Should we make the BIC optional?
Switzerland uses pain.001 and pain.008 Formats that are derived from the official SEPA standard.
These formats are defined by the SIX Group (https://www.six-group.com/interbank-clearing/de/home/standardization/iso-payments/customer-bank/implementation-guidelines.html).
While Swiss Payment Standards (SPS) are very similar to SEPA, they technically aren't part of it.
In order to support it regardless, the following formats would have to be supported:
pain.008.001.02.ch.03
(Implementation Guidline (pdf), Schema and examples (zip))pain.001.001.03.ch.02
(Implementation Guidline (pdf), Schema and examples (zip))Would you be willing to accept a PR that adds support for it? (even though it is technically not SEPA)
Given a project which uses RVM and has its own RVM gemset
when I install sepa_king
v0.11.1 using bundle install
,
then a binstub called rake
(!) is created
thereby overwriting the binstub created by the rake
gem itself.
The erroneously created binstub:
#!/usr/bin/env ruby_executable_hooks
#
# This file was generated by RubyGems.
#
# The application 'sepa_king' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'rubygems'
version = ">= 0.a"
if ARGV.first
str = ARGV.first
str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then
version = $1
ARGV.shift
end
end
if Gem.respond_to?(:activate_bin_path)
load Gem.activate_bin_path('sepa_king', 'rake', version)
else
gem "sepa_king", version
load Gem.bin_path("sepa_king", "rake", version)
end
loads sepa_king/bin/rake
which then loads rake/exe/rake
but the gem repository paths are not managed correctly,
resulting in error messages like
$ rake -T
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
Could not find gem 'rspec' in any of the gem sources listed in your Gemfile.
Run `bundle install` to install missing gems.
even though bundle install
will show that rspec
was installed all along.
Hi,
I'm not quite familiar with github and don't want be part of this project, but I've made some improvements you might want to include to this.
Swiss Banks are obviously using a special form of the ISO 20022 standard. They partially use limitations to fields and declare some fields as mandatory that are usually optionally and therefore not implemented here in this package.
See here for the implementation recommendations of SIX, that explain the Swiss modifications:
http://www.six-interbank-clearing.com/de/home/standardization/iso-payments/customer-bank/swiss-recommendations.html
I patched the following files to adapt this package, maybe you'd like to take over these changes to this project.
diff -rupN sepa_king-master/lib/sepa_king/message/direct_debit.rb sepa_king-patched/lib/sepa_king/message/direct_debit.rb
--- sepa_king-master/lib/sepa_king/message/direct_debit.rb 2015-03-31 07:44:59.000000000 +0200
+++ sepa_king-patched/lib/sepa_king/message/direct_debit.rb 2015-04-20 18:03:50.313914000 +0200
@@ -86,6 +86,9 @@ module SEPA
def build_transaction(builder, transaction)
builder.DrctDbtTxInf do
builder.PmtId do
+ if transaction.instruction.present?
+ builder.InstrId(transaction.instruction)
+ end
builder.EndToEndId(transaction.reference)
end
builder.InstdAmt('%.2f' % transaction.amount, Ccy: 'EUR')
diff -rupN sepa_king-master/lib/sepa_king/message.rb sepa_king-patched/lib/sepa_king/message.rb
--- sepa_king-master/lib/sepa_king/message.rb 2015-03-31 07:44:59.000000000 +0200
+++ sepa_king-patched/lib/sepa_king/message.rb 2015-04-20 18:17:54.105928000 +0200
@@ -103,6 +103,15 @@ module SEPA
builder.CtrlSum('%.2f' % amount_total)
builder.InitgPty do
builder.Nm(account.name)
+ if account.class == CreditorAccount and account.creditor_identifier.present?
+ builder.Id do
+ builder.OrgId do
+ builder.Othr do
+ builder.Id(account.creditor_identifier)
+ end
+ end
+ end
+ end
end
end
end
Furthermore I got the following recommendations from our Swiss Bank:
(0001) Der Namespace 'urn:iso:std:iso:20022:tech:xsd:pain.008.003.02' wurde ersetzt durch 'http://www.six-interbank-clearing.com/de/pain.008.001.02.ch.01.xsd', um gegen das XML-Schema testen zu können.
(0001) Hinweis: Statt dem Schweizer XML-Schema wurde das ISO XML-Schema verwendet. Das zu verwendende XML-Schema ist mit den jeweiligen Finanzinstituten abzustimmen.
(0024) Hinweis: <NbOfTxs> wird in der Regel von den Schweizer Instituten nicht geprüft
(0025) Hinweis: <CtrlSum> wird in der Regel von den Schweizer Instituten nicht geprüft.
(0065) Hinweis: <EndToEndId> - In der Schweiz wird die Verwendung von maximal 16 Stellen empfohlen
Only important thing seems to be the change of the namespace, which is currently not possible to set with sepa_king. Maybe you can find a solution to pass it through or set it automatically for Swiss Bank connections.
Cheers,
Markus
Support for RequestedCollectionDate and RequestedExecutionDate
A valid account (IBAN and BIC) is required on the SEPA::DirectDebit object, otherwise validation fails[1].
But since the creditor IBAN is only used at the transaction level, why is it required at the top level?
Hey, we are getting this error message:
SEPA::Error: Account: ["Bic: COBADEFFXXXX is invalid"]
when calling SEPA::CreditTransfer#to_xml
However this is a normal BIC from Commerzbank (germany). Double checked with https://www.bundesbank.de/de/aufgaben/unbarer-zahlungsverkehr/serviceangebot/bankleitzahlen/download-bankleitzahlen-602592
Is there any way we can work around this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.