sepa 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
@@ -37,7 +37,7 @@ class Sepa::DirectDebitOrder
|
|
37
37
|
"group_header.control_sum" => creditor_payments.inject(0) { |sum, cp| sum + cp.control_sum },
|
38
38
|
}
|
39
39
|
|
40
|
-
hsh = hsh.merge initiating_party.to_properties("group_header.initiating_party", opts)
|
40
|
+
hsh = hsh.merge initiating_party.to_properties("group_header.initiating_party", opts.merge({context: :initiating_party}))
|
41
41
|
|
42
42
|
cps = []
|
43
43
|
if opts[:pain_008_001_version] == "02"
|
@@ -72,14 +72,22 @@ class Sepa::DirectDebitOrder
|
|
72
72
|
def to_properties prefix, opts
|
73
73
|
cc = county_code country
|
74
74
|
hsh = { "#{prefix}.name" => name }
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
75
|
+
if (opts[:context] != :initiating_party) || (opts[:pain_008_001_version] != "02")
|
76
|
+
hsh["#{prefix}.postal_address.address_line[0]"] = address_line_1 unless blank? address_line_1
|
77
|
+
|
78
|
+
if opts[:pain_008_001_version] == "02"
|
79
|
+
candidate_adr_line_2 = "#{postcode} #{town}".strip
|
80
|
+
address_line_2 = candidate_adr_line_2 unless blank? candidate_adr_line_2
|
81
|
+
hsh["#{prefix}.postal_address.address_line[1]"] = address_line_2 unless blank? address_line_2
|
82
|
+
else
|
83
|
+
hsh["#{prefix}.postal_address.post_code"] = postcode unless blank? postcode
|
84
|
+
hsh["#{prefix}.postal_address.town_name"] = town unless blank? town
|
85
|
+
end
|
86
|
+
hsh["#{prefix}.postal_address.country"] = cc unless blank? cc
|
87
|
+
hsh["#{prefix}.contact_details.name"] = contact_name unless blank? contact_name
|
88
|
+
hsh["#{prefix}.contact_details.phone_number"] = contact_phone unless blank? contact_phone
|
89
|
+
hsh["#{prefix}.contact_details.email_address"] = contact_email unless blank? contact_email
|
90
|
+
end
|
83
91
|
hsh
|
84
92
|
end
|
85
93
|
end
|
@@ -108,8 +116,8 @@ class Sepa::DirectDebitOrder
|
|
108
116
|
@direct_debits = direct_debits
|
109
117
|
end
|
110
118
|
|
111
|
-
#
|
112
|
-
#
|
119
|
+
# This is only called for V02, in which case SequenceType is mandatory.
|
120
|
+
# Necessary because each PaymentInformation container contains a single SequenceType element (inside PaymentTypeInformation)
|
113
121
|
# whereas in V04, there is one SequenceType element per DirectDebitTransactionInformation
|
114
122
|
def collect_by_sequence_type
|
115
123
|
seq_types = {
|
@@ -177,7 +185,7 @@ class Sepa::DirectDebitOrder
|
|
177
185
|
def to_properties prefix, opts
|
178
186
|
bic_tag = ( opts[:pain_008_001_version] == "04" ? "bic_fi" : "bic" )
|
179
187
|
|
180
|
-
{ "#{prefix}_account.identification.iban" => iban,
|
188
|
+
{ "#{prefix}_account.identification.iban" => iban.gsub(/\s/, ''),
|
181
189
|
"#{prefix}_agent.financial_institution_identification.#{bic_tag}" => swift }
|
182
190
|
end
|
183
191
|
end
|
data/lib/sepa/version.rb
CHANGED
@@ -18,7 +18,7 @@ describe Sepa::DirectDebitOrder do
|
|
18
18
|
dd10 = Sepa::DirectDebitOrder::DirectDebit.new debtor1, bank_account1, "MONECOLE REG F13790 PVT 3", 1732.32, "EUR", mandate1
|
19
19
|
dd11 = Sepa::DirectDebitOrder::DirectDebit.new debtor1, bank_account1, "MONECOLE REG F13792 PVT 3", 1034.34, "EUR", mandate1
|
20
20
|
|
21
|
-
bank_account2 = Sepa::DirectDebitOrder::BankAccount.new "
|
21
|
+
bank_account2 = Sepa::DirectDebitOrder::BankAccount.new " FR QU IQ UI WI GW\tAM 947 551 ", "FRQQWIGGA"
|
22
22
|
debtor2 = Sepa::DirectDebitOrder::Party.new "Mr. James Joyce", "512, Livva de Meet Agir", nil, "75099", "LONDON", "Angleterre", "Johann S. BACH", "09876543210", "js@bach.sepa.i.hope.this.works"
|
23
23
|
mandate2 = Sepa::DirectDebitOrder::MandateInformation.new("mandate-id-2", Date.parse("2013-06-08"), "RCUR")
|
24
24
|
dd20 = Sepa::DirectDebitOrder::DirectDebit.new debtor2, bank_account2, "MONECOLE REG F13793 PVT 3", 1935.35, "EUR", mandate2
|
@@ -28,7 +28,7 @@ describe Sepa::DirectDebitOrder do
|
|
28
28
|
Time.stub(:now).and_return sepa_now
|
29
29
|
|
30
30
|
creditor = Sepa::DirectDebitOrder::Party.new "Mon École", "3, Livva de Getamire", nil, "75022", "Paris", "Frankreich", "M. le Directeur", "+33 999 999 999", "directeur@monecole.softify.com"
|
31
|
-
creditor_account = Sepa::DirectDebitOrder::BankAccount.new "
|
31
|
+
creditor_account = Sepa::DirectDebitOrder::BankAccount.new "FRGOO GOOY ADDA 9999 999", "FRGGYELLOW99"
|
32
32
|
sepa_identifier = sepa_identifier_class.new "FR123ZZZ010203"
|
33
33
|
payment = Sepa::DirectDebitOrder::CreditorPayment.new creditor, creditor_account, "MONECOLE_PAYMENTS_20130703", Date.parse("2013-07-10"), sepa_identifier, [dd00, dd01, dd10, dd11, dd20, dd21]
|
34
34
|
|
@@ -8,17 +8,6 @@
|
|
8
8
|
<CtrlSum>8303.01</CtrlSum>
|
9
9
|
<InitgPty>
|
10
10
|
<Nm>SOFTIFY SARL</Nm>
|
11
|
-
<PstlAdr>
|
12
|
-
<PstCd>75021</PstCd>
|
13
|
-
<TwnNm>Paris</TwnNm>
|
14
|
-
<Ctry>FR</Ctry>
|
15
|
-
<AdrLine>289, Livva de Getamire</AdrLine>
|
16
|
-
</PstlAdr>
|
17
|
-
<CtctDtls>
|
18
|
-
<Nm>M. Le Gérant</Nm>
|
19
|
-
<PhneNb>+33 111 111 111</PhneNb>
|
20
|
-
<EmailAdr>gerant@softify.bigbang</EmailAdr>
|
21
|
-
</CtctDtls>
|
22
11
|
</InitgPty>
|
23
12
|
</GrpHdr>
|
24
13
|
<PmtInf>
|
@@ -39,10 +28,9 @@
|
|
39
28
|
<Cdtr>
|
40
29
|
<Nm>Mon École</Nm>
|
41
30
|
<PstlAdr>
|
42
|
-
<PstCd>75022</PstCd>
|
43
|
-
<TwnNm>Paris</TwnNm>
|
44
31
|
<Ctry>FR</Ctry>
|
45
32
|
<AdrLine>3, Livva de Getamire</AdrLine>
|
33
|
+
<AdrLine>75022 Paris</AdrLine>
|
46
34
|
</PstlAdr>
|
47
35
|
<CtctDtls>
|
48
36
|
<Nm>M. le Directeur</Nm>
|
@@ -92,10 +80,9 @@
|
|
92
80
|
<Dbtr>
|
93
81
|
<Nm>ADAMS/SAMUELMR</Nm>
|
94
82
|
<PstlAdr>
|
95
|
-
<PstCd>75048</PstCd>
|
96
|
-
<TwnNm>BERLIN</TwnNm>
|
97
83
|
<Ctry>DE</Ctry>
|
98
84
|
<AdrLine>256, Livva de Getamire</AdrLine>
|
85
|
+
<AdrLine>75048 BERLIN</AdrLine>
|
99
86
|
</PstlAdr>
|
100
87
|
<CtctDtls>
|
101
88
|
<Nm>Samuel ADAMS</Nm>
|
@@ -128,10 +115,9 @@
|
|
128
115
|
<Dbtr>
|
129
116
|
<Nm>ADAMS/SAMUELMR</Nm>
|
130
117
|
<PstlAdr>
|
131
|
-
<PstCd>75048</PstCd>
|
132
|
-
<TwnNm>BERLIN</TwnNm>
|
133
118
|
<Ctry>DE</Ctry>
|
134
119
|
<AdrLine>256, Livva de Getamire</AdrLine>
|
120
|
+
<AdrLine>75048 BERLIN</AdrLine>
|
135
121
|
</PstlAdr>
|
136
122
|
<CtctDtls>
|
137
123
|
<Nm>Samuel ADAMS</Nm>
|
@@ -164,10 +150,9 @@
|
|
164
150
|
<Cdtr>
|
165
151
|
<Nm>Mon École</Nm>
|
166
152
|
<PstlAdr>
|
167
|
-
<PstCd>75022</PstCd>
|
168
|
-
<TwnNm>Paris</TwnNm>
|
169
153
|
<Ctry>FR</Ctry>
|
170
154
|
<AdrLine>3, Livva de Getamire</AdrLine>
|
155
|
+
<AdrLine>75022 Paris</AdrLine>
|
171
156
|
</PstlAdr>
|
172
157
|
<CtctDtls>
|
173
158
|
<Nm>M. le Directeur</Nm>
|
@@ -217,10 +202,9 @@
|
|
217
202
|
<Dbtr>
|
218
203
|
<Nm>DALTON/CONANMR</Nm>
|
219
204
|
<PstlAdr>
|
220
|
-
<PstCd>30005</PstCd>
|
221
|
-
<TwnNm>RENNES</TwnNm>
|
222
205
|
<Ctry>FR</Ctry>
|
223
206
|
<AdrLine>64, Livva de Getamire</AdrLine>
|
207
|
+
<AdrLine>30005 RENNES</AdrLine>
|
224
208
|
</PstlAdr>
|
225
209
|
<CtctDtls>
|
226
210
|
<Nm>Conan DALTON</Nm>
|
@@ -253,10 +237,9 @@
|
|
253
237
|
<Dbtr>
|
254
238
|
<Nm>DALTON/CONANMR</Nm>
|
255
239
|
<PstlAdr>
|
256
|
-
<PstCd>30005</PstCd>
|
257
|
-
<TwnNm>RENNES</TwnNm>
|
258
240
|
<Ctry>FR</Ctry>
|
259
241
|
<AdrLine>64, Livva de Getamire</AdrLine>
|
242
|
+
<AdrLine>30005 RENNES</AdrLine>
|
260
243
|
</PstlAdr>
|
261
244
|
<CtctDtls>
|
262
245
|
<Nm>Conan DALTON</Nm>
|
@@ -289,9 +272,8 @@
|
|
289
272
|
<Dbtr>
|
290
273
|
<Nm>Mr. James Joyce</Nm>
|
291
274
|
<PstlAdr>
|
292
|
-
<PstCd>75099</PstCd>
|
293
|
-
<TwnNm>LONDON</TwnNm>
|
294
275
|
<AdrLine>512, Livva de Meet Agir</AdrLine>
|
276
|
+
<AdrLine>75099 LONDON</AdrLine>
|
295
277
|
</PstlAdr>
|
296
278
|
<CtctDtls>
|
297
279
|
<Nm>Johann S. BACH</Nm>
|
@@ -324,9 +306,8 @@
|
|
324
306
|
<Dbtr>
|
325
307
|
<Nm>Mr. James Joyce</Nm>
|
326
308
|
<PstlAdr>
|
327
|
-
<PstCd>75099</PstCd>
|
328
|
-
<TwnNm>LONDON</TwnNm>
|
329
309
|
<AdrLine>512, Livva de Meet Agir</AdrLine>
|
310
|
+
<AdrLine>75099 LONDON</AdrLine>
|
330
311
|
</PstlAdr>
|
331
312
|
<CtctDtls>
|
332
313
|
<Nm>Johann S. BACH</Nm>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sepa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-12-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: builder
|