Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement the Instruction Identification tag #36

Merged
merged 1 commit into from
May 10, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ sdd.add_transaction(
# Number with two decimal digit
amount: 39.99,

# 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',
Expand Down
3 changes: 3 additions & 0 deletions lib/sepa_king/message/credit_transfer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ def build_payment_informations(builder)
def build_transaction(builder, transaction)
builder.CdtTrfTxInf do
builder.PmtId do
if transaction.instruction.present?
builder.InstrId(transaction.instruction)
end
builder.EndToEndId(transaction.reference)
end
builder.Amt do
Expand Down
5 changes: 3 additions & 2 deletions lib/sepa_king/transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ class Transaction
include ActiveModel::Validations
extend Converter

attr_accessor :name, :iban, :bic, :amount, :reference, :remittance_information, :requested_date, :batch_booking
convert :name, :reference, :remittance_information, to: :text
attr_accessor :name, :iban, :bic, :amount, :instruction, :reference, :remittance_information, :requested_date, :batch_booking
convert :name, :instruction, :reference, :remittance_information, to: :text
convert :amount, to: :decimal

validates_length_of :name, within: 1..70
validates_length_of :instruction, within: 1..35, allow_nil: true
validates_length_of :reference, within: 1..35, allow_nil: true
validates_length_of :remittance_information, within: 1..140, allow_nil: true
validates_numericality_of :amount, greater_than: 0
Expand Down