sps_king 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7110f83251be28b1fcd5bc66d2071ac1587c7ddd9ab19a3fed3c8e0c593bc87b
4
- data.tar.gz: 02b6280f380d1648bd8d1d905d96676e4ac7f299eb07d968780cad25967164d4
3
+ metadata.gz: 0bbc6291838df10ef7290cb3e04e1c97d573c92f67e13073e0734743a7d93fa7
4
+ data.tar.gz: 9611dd93cbfa199e0d32e50f39f6a9d77c4cc952a64a1d20d191d4644ecb0beb
5
5
  SHA512:
6
- metadata.gz: 8533d776ca0a69f4f675f5717ebe4cb6a4060d85c90dfdba2d6d360e5f04017be111e78a4668d38834138406f6af7d064f20e8863dd96633bde73d693f462d31
7
- data.tar.gz: f318b2e263415392387480e4d15d97e9da8a66ecbf69dd5f40c8df32e630ea717bfdcf89af824903a2b3bbed7dd0fbc2d3138f6f28af9289fe76ca65f8551bbe
6
+ metadata.gz: 7e50e84dac80865f798fe6bbbbfb4582d2500346d87f9e28420a1381c5cc7843db5d8999892fc4d41c34c83fff0cbfd24cf10dafbb13cee6966bac854aa7d59e
7
+ data.tar.gz: d6ccf85250954c8e84df1146bf4c59d07d0f0eb99f313fef315bd7e0b4a5a31e8cf204fa4bec4c320d33e289661532346533147b08a9bc60e4ad35828f78ef87
data/CHANGELOG.md CHANGED
@@ -1,9 +1,20 @@
1
- ## What's Changed
1
+ ## What's Changed in v0.5.0
2
+ * Add support for QRR type in structured remittance information by @tobischo in [#10](https://github.com/viafintech/sps_king/pull/10)
3
+ * Allow structured remittance information optionally for credits
4
+ * Bump version to 0.5.0
5
+ * Add support for QRR as value for proprietary
6
+ * Fix changelog links
7
+
8
+ ## What's Changed in v0.4.0
9
+ * Bump version to 0.4.0
10
+ * Make charge bearer optional instead of constant set to `SLEV` by @tobischo in [#7](https://github.com/viafintech/sps_king/pull/7)
2
11
  * Make charge bearer optional instead of constant set to `SLEV`
3
12
 
13
+ **Full Changelog**: https://github.com/viafintech/sps_king/compare/v0.3.1...v0.4.0
14
+
4
15
  ## What's Changed in v0.3.1
5
16
  * Bump version to 0.3.1
6
- * Merge pull request #5 from viafintech/bug/use-correct-default-currency
17
+ * Fix default currency on transactions by @tobischo in [#5](https://github.com/viafintech/sps_king/pull/5)
7
18
  * Revert to old gemfile definition
8
19
  * Re-add bundle install step
9
20
  * Fix indentation
@@ -11,36 +22,39 @@
11
22
  * Add newer ruby versions to test matrix
12
23
  * Fix default currency on transactions
13
24
 
14
- **Full Changelog**: https://github.com///compare/v0.3.0...v0.3.1
25
+ **Full Changelog**: https://github.com/viafintech/sps_king/compare/v0.3.0...v0.3.1
15
26
 
16
27
  ## What's Changed in v0.3.0
17
28
  * Bump gem version
18
29
  * Update tested activemodel versions
19
30
  * Update test ruby version to 3.0
20
31
 
21
- **Full Changelog**: https://github.com///compare/v0.2.0...v0.3.0
32
+ **Full Changelog**: https://github.com/viafintech/sps_king/compare/v0.2.0...v0.3.0
22
33
 
23
34
  ## What's Changed in v0.2.0
24
- * Merge pull request #3 from viafintech/feature/update-dependencies-and-run-tests-on-github
25
- * Stick to ruby 2.7 support for now
26
- * Fix CI setup
27
- * Bump required ruby version to 2.7
28
- * Merge pull request #2 from viafintech/remove-coveralls-dependency
29
- * Update version to 0.1.1
30
- * Add missing gemfiles for testing
31
- * Remove coveralls dependency
32
- * Merge pull request #1 from Barzahlen/update-copyright-notice
33
- * Update copyright notice and author mail address
34
- * Add comment pointing to sepa_king for sepa files
35
- * Fix gem description for next release
36
-
37
- **Full Changelog**: https://github.com///compare/v0.1.0...v0.2.0
35
+ * Bump required ruby version to 2.7 by @martinseener in [#3](https://github.com/viafintech/sps_king/pull/3)
36
+ * Stick to ruby 2.7 support for now by @tobischo
37
+ * Fix CI setup by @tobischo
38
+ * Bump required ruby version to 2.7 by @tobischo
39
+ * Remove coveralls dependency by @martinseener in [#2](https://github.com/viafintech/sps_king/pull/2)
40
+ * Update version to 0.1.1 by @tobischo
41
+ * Add missing gemfiles for testing by @tobischo
42
+ * Remove coveralls dependency by @tobischo
43
+ * Update copyright notice and author mail address by @martinseener in [#1](https://github.com/viafintech/sps_king/pull/1)
44
+ * Update copyright notice and author mail address by @tobischo
45
+ * Add comment pointing to sepa_king for sepa files by @tobischo
46
+ * Fix gem description for next release by @tobischo
47
+
48
+ ## New Contributors
49
+ * @martinseener made their first contribution in [#3](https://github.com/viafintech/sps_king/pull/3)
50
+
51
+ **Full Changelog**: https://github.com/viafintech/sps_king/compare/v0.1.0...v0.2.0
38
52
 
39
53
  ## What's Changed in v0.1.0
40
- * Add .gem to gitignore
41
- * Adapt example account holder
42
- * Fix status badges
43
- * Fix copyright notice
44
- * Initial implementation after fork from sepa_king gem
54
+ * Add .gem to gitignore by @tobischo
55
+ * Adapt example account holder by @tobischo
56
+ * Fix status badges by @tobischo
57
+ * Fix copyright notice by @tobischo
58
+ * Initial implementation after fork from sepa_king gem by @tobischo
45
59
 
46
60
  <!-- generated by git-cliff -->
data/README.md CHANGED
@@ -184,6 +184,19 @@ sct.add_transaction(
184
184
  # String, max. 140 char
185
185
  remittance_information: 'Rechnung vom 22.08.2013',
186
186
 
187
+ # OPTIONAL: Structured remittance information, in German "Strukturierter Verwendungszweck". Required for e.g. Swiss QR transfers
188
+ # StructuredRemittanceInformation
189
+ structured_remittance_information: SPS::StructuredRemittanceInformation.new(
190
+ # Defines how the reference field should be interpreted for Swiss Direct Debits
191
+ # One of these strings:
192
+ # 'IPI' ("IPI-Verwendungszweck")
193
+ # 'QRR' ("QR-Referenz")
194
+ proprietary: 'QRR',
195
+ # if proprietary is 'IPI': 20 character IPI remittance
196
+ # if proprietary is 'QRR': 27 character QR reference
197
+ reference: '000008207791225857421286694'
198
+ ),
199
+
187
200
  # OPTIONAL: Requested execution date, in German "Ausführungstermin"
188
201
  # Date
189
202
  requested_date: Date.new(2013,9,5),
data/cliff.toml CHANGED
@@ -1,9 +1,9 @@
1
1
  # git-cliff ~ configuration file
2
2
  # https://git-cliff.org/docs/configuration
3
3
 
4
- # [remote.github]
5
- # owner = "orhun"
6
- # repo = "git-cliff"
4
+ [remote.github]
5
+ owner = "viafintech"
6
+ repo = "sps_king"
7
7
  # token = ""
8
8
 
9
9
  [changelog]
@@ -132,9 +132,24 @@ module SPS
132
132
  builder.IBAN(transaction.iban)
133
133
  end
134
134
  end
135
- if transaction.remittance_information
135
+ if transaction.remittance_information || transaction.structured_remittance_information
136
136
  builder.RmtInf do
137
- builder.Ustrd(transaction.remittance_information)
137
+ if transaction.remittance_information
138
+ builder.Ustrd(transaction.remittance_information)
139
+ end
140
+
141
+ if transaction.structured_remittance_information
142
+ builder.Strd do
143
+ builder.CdtrRefInf do
144
+ builder.Tp do
145
+ builder.CdOrPrtry do
146
+ builder.Prtry(transaction.structured_remittance_information.proprietary)
147
+ end
148
+ end
149
+ builder.Ref(transaction.structured_remittance_information.reference)
150
+ end
151
+ end
152
+ end
138
153
  end
139
154
  end
140
155
  end
@@ -6,7 +6,7 @@ module SPS
6
6
  attr_accessor :proprietary,
7
7
  :reference
8
8
 
9
- validates_inclusion_of :proprietary, in: %w(ESR IPI)
9
+ validates_inclusion_of :proprietary, in: %w(ESR IPI QRR)
10
10
  validates_length_of :reference, within: 1..35
11
11
 
12
12
  convert :proprietary, :reference, to: :text
@@ -1,3 +1,3 @@
1
1
  module SPS
2
- VERSION = '0.4.0'
2
+ VERSION = '0.5.0'
3
3
  end
@@ -273,8 +273,6 @@ describe SPS::CreditTransfer do
273
273
  end
274
274
 
275
275
  it 'should contain payment_information with <ChrgBr>' do
276
- puts subject
277
-
278
276
  expect(subject)
279
277
  .to have_xml('//Document/CstmrCdtTrfInitn/PmtInf[1]/ChrgBr', charge_bearer)
280
278
  end
@@ -366,6 +364,37 @@ describe SPS::CreditTransfer do
366
364
  )
367
365
  end
368
366
  end
367
+
368
+ context 'with structured remittance information given' do
369
+ subject do
370
+ sct = credit_transfer
371
+
372
+ sct.add_transaction(
373
+ name: 'Contoso AG',
374
+ iban: 'CH5481230000001998736',
375
+ bic: 'RAIFCH22',
376
+ amount: 102.50,
377
+ structured_remittance_information: SPS::StructuredRemittanceInformation.new(
378
+ proprietary: 'QRR',
379
+ reference: '185744810000000000200800628'
380
+ )
381
+ )
382
+
383
+ sct.to_xml
384
+ end
385
+
386
+ it 'should create valid XML file' do
387
+ expect(subject).to validate_against('pain.001.001.03.ch.02.xsd')
388
+ end
389
+
390
+ it 'should contain <Prtry>' do
391
+ expect(subject)
392
+ .to have_xml(
393
+ '//Document/CstmrCdtTrfInitn/PmtInf/CdtTrfTxInf[1]/RmtInf/Strd/CdtrRefInf/Tp/CdOrPrtry/Prtry',
394
+ 'QRR'
395
+ )
396
+ end
397
+ end
369
398
  end
370
399
  end
371
400
  end
@@ -12,7 +12,7 @@ describe SPS::StructuredRemittanceInformation do
12
12
 
13
13
  describe :proprietary do
14
14
  it 'should accept valid value' do
15
- expect(SPS::StructuredRemittanceInformation).to accept('ESR', 'IPI', for: :proprietary)
15
+ expect(SPS::StructuredRemittanceInformation).to accept('ESR', 'IPI', 'QRR', for: :proprietary)
16
16
  end
17
17
 
18
18
  it 'should not accept invalid value' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sps_king
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Schoknecht
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-03 00:00:00.000000000 Z
11
+ date: 2024-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel