sps_king 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd70e12d3810143618272131a6c71f938e0f3a38d12a3922b1096798bd56906d
4
- data.tar.gz: d3f2d858ed88af261d8fa635a04a1625e30d0b8b572477c91b672665999a0b1b
3
+ metadata.gz: 7110f83251be28b1fcd5bc66d2071ac1587c7ddd9ab19a3fed3c8e0c593bc87b
4
+ data.tar.gz: 02b6280f380d1648bd8d1d905d96676e4ac7f299eb07d968780cad25967164d4
5
5
  SHA512:
6
- metadata.gz: 202f18b83b35c8ba940eb8bb0827b65933893bf5ca307399940f8990146bdd69970e24c3ab9938067ea7f0343884f3c8523c891a394700d3ba83af0611305829
7
- data.tar.gz: 2bae9c411fcb2a036219ca61ca2c701a2f69a57431ec8a89375e6c5764e11e6390db65e2ecb60819bc44744050f55d108fb4a654151341cfe389f8e6514fbec0
6
+ metadata.gz: 8533d776ca0a69f4f675f5717ebe4cb6a4060d85c90dfdba2d6d360e5f04017be111e78a4668d38834138406f6af7d064f20e8863dd96633bde73d693f462d31
7
+ data.tar.gz: f318b2e263415392387480e4d15d97e9da8a66ecbf69dd5f40c8df32e630ea717bfdcf89af824903a2b3bbed7dd0fbc2d3138f6f28af9289fe76ca65f8551bbe
data/CHANGELOG.md ADDED
@@ -0,0 +1,46 @@
1
+ ## What's Changed
2
+ * Make charge bearer optional instead of constant set to `SLEV`
3
+
4
+ ## What's Changed in v0.3.1
5
+ * Bump version to 0.3.1
6
+ * Merge pull request #5 from viafintech/bug/use-correct-default-currency
7
+ * Revert to old gemfile definition
8
+ * Re-add bundle install step
9
+ * Fix indentation
10
+ * Improve test setup
11
+ * Add newer ruby versions to test matrix
12
+ * Fix default currency on transactions
13
+
14
+ **Full Changelog**: https://github.com///compare/v0.3.0...v0.3.1
15
+
16
+ ## What's Changed in v0.3.0
17
+ * Bump gem version
18
+ * Update tested activemodel versions
19
+ * Update test ruby version to 3.0
20
+
21
+ **Full Changelog**: https://github.com///compare/v0.2.0...v0.3.0
22
+
23
+ ## 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
38
+
39
+ ## 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
45
+
46
+ <!-- generated by git-cliff -->
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2018-2023 viafintech GmbH
1
+ Copyright (c) 2018-2024 viafintech GmbH
2
2
 
3
3
  Copyright (c) 2013-2017 Georg Leciejewski (Sales King GmbH) & Georg Ledermann for portions of this project copied from sepa_king
4
4
 
data/README.md CHANGED
@@ -91,7 +91,7 @@ sdd.add_transaction(
91
91
  # One of these strings:
92
92
  # 'CHTA' ("Banklastschrift") - Only for Swiss Direct Debits
93
93
  # 'CHDD' ("PostFinance-Lastschrift") - Only for Swiss Direct Debits
94
- service_level: 'CHTA'
94
+ service_level: 'CHTA',
95
95
 
96
96
  # Local instrument, in German "Lastschriftart"
97
97
  # One of these strings:
@@ -198,6 +198,14 @@ sct.add_transaction(
198
198
  # 'URGP' ("Taggleiche Eilüberweisung")
199
199
  service_level: 'URGP'
200
200
 
201
+ # OPTIONAL: Charge Bearer
202
+ # One of these strings:
203
+ # 'DEBT' (Borne by Debitor)
204
+ # 'CRED' (Borne by Creditor)
205
+ # 'SHAR' (Shared)
206
+ # 'SLEV' (Service Level) - Must be SLEV for SEPA transfers
207
+ charge_bearer: 'SHAR',
208
+
201
209
  # OPTIONAL: Unstructured information to indicate the purpose of the payment
202
210
  # String, max. 4 char
203
211
  category_purpose: 'SALA',
data/cliff.toml ADDED
@@ -0,0 +1,88 @@
1
+ # git-cliff ~ configuration file
2
+ # https://git-cliff.org/docs/configuration
3
+
4
+ # [remote.github]
5
+ # owner = "orhun"
6
+ # repo = "git-cliff"
7
+ # token = ""
8
+
9
+ [changelog]
10
+ # template for the changelog body
11
+ # https://keats.github.io/tera/docs/#introduction
12
+ body = """
13
+ ## What's Changed
14
+
15
+ {%- if version %} in {{ version }}{%- endif -%}
16
+ {% for commit in commits %}
17
+ {% if commit.github.pr_title -%}
18
+ {%- set commit_message = commit.github.pr_title -%}
19
+ {%- else -%}
20
+ {%- set commit_message = commit.message -%}
21
+ {%- endif -%}
22
+ * {{ commit_message | split(pat="\n") | first | trim }}\
23
+ {% if commit.github.username %} by @{{ commit.github.username }}{%- endif -%}
24
+ {% if commit.github.pr_number %} in \
25
+ [#{{ commit.github.pr_number }}]({{ self::remote_url() }}/pull/{{ commit.github.pr_number }}) \
26
+ {%- endif %}
27
+ {%- endfor -%}
28
+
29
+ {%- if github -%}
30
+ {% if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %}
31
+ {% raw %}\n{% endraw -%}
32
+ ## New Contributors
33
+ {%- endif %}\
34
+ {% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}
35
+ * @{{ contributor.username }} made their first contribution
36
+ {%- if contributor.pr_number %} in \
37
+ [#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \
38
+ {%- endif %}
39
+ {%- endfor -%}
40
+ {%- endif -%}
41
+
42
+ {% if version %}
43
+ {% if previous.version %}
44
+ **Full Changelog**: {{ self::remote_url() }}/compare/{{ previous.version }}...{{ version }}
45
+ {% endif %}
46
+ {% else -%}
47
+ {% raw %}\n{% endraw %}
48
+ {% endif %}
49
+
50
+ {%- macro remote_url() -%}
51
+ https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
52
+ {%- endmacro -%}
53
+ """
54
+ # remove the leading and trailing whitespace from the template
55
+ trim = true
56
+ # changelog footer
57
+ footer = """
58
+ <!-- generated by git-cliff -->
59
+ """
60
+ # postprocessors
61
+ postprocessors = []
62
+
63
+ [git]
64
+ # parse the commits based on https://www.conventionalcommits.org
65
+ conventional_commits = false
66
+ # filter out the commits that are not conventional
67
+ filter_unconventional = true
68
+ # process each line of a commit as an individual commit
69
+ split_commits = false
70
+ # regex for preprocessing the commit messages
71
+ commit_preprocessors = [
72
+ # remove issue numbers from commits
73
+ { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "" },
74
+ ]
75
+ # protect breaking changes from being skipped due to matching a skipping commit_parser
76
+ protect_breaking_commits = false
77
+ # filter out the commits that are not matched by commit parsers
78
+ filter_commits = false
79
+ # regex for matching git tags
80
+ tag_pattern = "v[0-9].*"
81
+ # regex for skipping tags
82
+ skip_tags = "beta|alpha"
83
+ # regex for ignoring tags
84
+ ignore_tags = "rc"
85
+ # sort the tags topologically
86
+ topo_order = false
87
+ # sort the commits inside sections by oldest/newest order
88
+ sort_commits = "newest"
@@ -16,7 +16,8 @@ module SPS
16
16
  requested_date: transaction.requested_date,
17
17
  batch_booking: transaction.batch_booking,
18
18
  service_level: transaction.service_level,
19
- category_purpose: transaction.category_purpose
19
+ category_purpose: transaction.category_purpose,
20
+ charge_bearer: transaction.charge_bearer,
20
21
  }
21
22
  end
22
23
 
@@ -56,7 +57,9 @@ module SPS
56
57
  builder.BIC(account.bic)
57
58
  end
58
59
  end
59
- builder.ChrgBr('SLEV')
60
+ if group[:charge_bearer]
61
+ builder.ChrgBr(group[:charge_bearer])
62
+ end
60
63
 
61
64
  transactions.each do |transaction|
62
65
  build_transaction(builder, transaction)
@@ -3,10 +3,15 @@ module SPS
3
3
  class CreditTransferTransaction < Transaction
4
4
  attr_accessor :service_level,
5
5
  :creditor_address,
6
- :category_purpose
6
+ :category_purpose,
7
+ :charge_bearer
8
+
9
+ CHARGE_BEARERS = ['DEBT', 'CRED', 'SHAR', 'SLEV'].freeze
7
10
 
8
11
  validates_length_of :category_purpose, within: 1..4, allow_nil: true
9
12
 
13
+ validates :charge_bearer, inclusion: CHARGE_BEARERS, allow_nil: true
14
+
10
15
  validate { |t| t.validate_requested_date_after(Date.today) }
11
16
 
12
17
  def schema_compatible?(schema_name)
@@ -1,3 +1,3 @@
1
1
  module SPS
2
- VERSION = '0.3.1'
2
+ VERSION = '0.4.0'
3
3
  end
@@ -261,6 +261,27 @@ describe SPS::CreditTransfer do
261
261
  end
262
262
  end
263
263
 
264
+ context 'with charge bearer' do
265
+ SPS::CreditTransferTransaction::CHARGE_BEARERS.each do |charge_bearer|
266
+ context "with value #{charge_bearer}" do
267
+ subject do
268
+ sct = credit_transfer
269
+
270
+ sct.add_transaction(credit_transfer_transaction.merge(charge_bearer: charge_bearer))
271
+
272
+ sct.to_xml
273
+ end
274
+
275
+ it 'should contain payment_information with <ChrgBr>' do
276
+ puts subject
277
+
278
+ expect(subject)
279
+ .to have_xml('//Document/CstmrCdtTrfInitn/PmtInf[1]/ChrgBr', charge_bearer)
280
+ end
281
+ end
282
+ end
283
+ end
284
+
264
285
  context 'with different batch_booking given' do
265
286
  subject do
266
287
  sct = credit_transfer
@@ -11,7 +11,7 @@ describe SPS::CreditTransferTransaction do
11
11
  bic: 'RAIFCH22',
12
12
  amount: 102.50,
13
13
  reference: 'XYZ-1234/123',
14
- remittance_information: 'Rechnung 123 vom 22.08.2013'
14
+ remittance_information: 'Rechnung 123 vom 22.08.2013',
15
15
  )
16
16
  ).to be_valid
17
17
  end
@@ -50,4 +50,16 @@ describe SPS::CreditTransferTransaction do
50
50
  expect(SPS::CreditTransferTransaction).not_to accept('', 'X' * 5, for: :category_purpose)
51
51
  end
52
52
  end
53
+
54
+ context 'Charge Bearer' do
55
+ it 'should allow valid value' do
56
+ expect(SPS::CreditTransferTransaction)
57
+ .to accept(nil, 'DEBT', 'CRED', 'SHAR', 'SLEV', for: :charge_bearer)
58
+ end
59
+
60
+ it 'should not allow invalid value' do
61
+ expect(SPS::CreditTransferTransaction)
62
+ .not_to accept('', 'X' * 5, 'X' * 4, for: :charge_bearer)
63
+ end
64
+ end
53
65
  end
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.3.1
4
+ version: 0.4.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-06-20 00:00:00.000000000 Z
11
+ date: 2024-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -119,11 +119,13 @@ files:
119
119
  - ".github/workflows/test.yml"
120
120
  - ".gitignore"
121
121
  - ".rspec"
122
+ - CHANGELOG.md
122
123
  - CONTRIBUTING.md
123
124
  - Gemfile
124
125
  - LICENSE.txt
125
126
  - README.md
126
127
  - Rakefile
128
+ - cliff.toml
127
129
  - gemfiles/Gemfile-activemodel-6.1.x
128
130
  - gemfiles/Gemfile-activemodel-7.0.x
129
131
  - gemfiles/Gemfile-activemodel-7.1.x