bankline_csv_import_file 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +43 -36
- data/lib/bankline_csv_import_file.rb +2 -8
- data/lib/bankline_csv_import_file/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5873525845d592185e8e2588efb4ae4780f891e5
|
4
|
+
data.tar.gz: 23c0e7b3fde8695b4e1bdcf31258ff37b4f64b68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c114810c6d7a56388a2e8c9f6bec660719bb1344c8e5c40711892bd316c0095f2f21f43f93ec02fe41e9f08e6be3286d5b27f365ddc0c6e327584285e7be71e1
|
7
|
+
data.tar.gz: 85cb877a0b3506166048addfaeb236605c6c18e2452a760ddbf73829248f6da365f42894844bb43f349c68a685f284a82c3ef7b2be5e35cac347cdee4023060e
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -11,37 +11,40 @@ USER BEWARE: At the time of writing, we have not yet verified that the produced
|
|
11
11
|
|
12
12
|
Add any number of payments as described below, then generate the CSV content:
|
13
13
|
|
14
|
-
|
14
|
+
``` ruby
|
15
|
+
file = BanklineCsvImportFile.new
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
file.generate # => "foo,bar,…"
|
17
|
+
file.add_domestic_payment(…)
|
18
|
+
file.add_domestic_payment(…)
|
19
|
+
file.add_international_payment(…)
|
21
20
|
|
21
|
+
file.generate # => "foo,bar,…"
|
22
|
+
```
|
22
23
|
|
23
24
|
### Domestic payment
|
24
25
|
|
25
|
-
All these
|
26
|
+
All these arguments are required unless stated otherwise.
|
26
27
|
|
27
|
-
|
28
|
+
``` ruby
|
29
|
+
file = BanklineCsvImportFile.new
|
28
30
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
31
|
+
file.add_domestic_payment(
|
32
|
+
payer_sort_code: "151000",
|
33
|
+
payer_account_number: "31806542",
|
34
|
+
amount: "123.45", # Strings and BigDecimal are allowed. (Floats are not advisable for money.) Rounded to 2 decimals.
|
35
|
+
beneficiary_sort_code: "151000",
|
36
|
+
beneficiary_account_number: "44298801",
|
37
|
+
beneficiary_name: "John Doe", # Truncated to a max length of 35.
|
38
|
+
beneficiary_reference: "Invoice 123", # Truncated to a max length of 18.
|
39
|
+
payment_date: Date.new(2018, 1, 1), # See note below.
|
40
|
+
)
|
39
41
|
|
40
|
-
|
42
|
+
file.generate # => "foo,bar,…"
|
43
|
+
```
|
41
44
|
|
42
45
|
Currency is assumed to be GBP.
|
43
46
|
|
44
|
-
Texts are converted to UPPERCASE and characters other than A-Z, 0-9, space and .-/& are automatically removed from free-text
|
47
|
+
Texts are converted to UPPERCASE and characters other than A-Z, 0-9, space and .-/& are automatically removed from free-text values.
|
45
48
|
|
46
49
|
Sort codes and account numbers are automatically normalised to the expected format.
|
47
50
|
|
@@ -54,28 +57,32 @@ Bankline says this about the payment date:
|
|
54
57
|
|
55
58
|
### International payment
|
56
59
|
|
57
|
-
All these
|
60
|
+
All these arguments are required unless stated otherwise.
|
58
61
|
|
59
|
-
|
60
|
-
|
61
|
-
payer_sort_code: "151000", # Any non-digits will be stripped automatically.
|
62
|
-
payer_account_number: "31806542", # Any non-digits will be stripped automatically.
|
63
|
-
amount: "123.45", # Strings and BigDecimal are allowed. (Floats are not advisable for money.)
|
64
|
-
payment_date: Date.new(2018, 1, 1), # Optional. Defaults to Date.current if available, otherwise Date.today. See note below.
|
65
|
-
beneficiary_bic: "SPKHDE2H",
|
66
|
-
beneficiary_iban: "DE53250501800039370089",
|
67
|
-
beneficiary_name: "John Doe",
|
62
|
+
``` ruby
|
63
|
+
file = BanklineCsvImportFile.new
|
68
64
|
|
69
|
-
|
70
|
-
|
65
|
+
file.add_international_payment(
|
66
|
+
payer_sort_code: "151000", # Any non-digits will be stripped automatically.
|
67
|
+
payer_account_number: "31806542", # Any non-digits will be stripped automatically.
|
68
|
+
amount: "123.45", # Strings and BigDecimal are allowed. (Floats are not advisable for money.)
|
69
|
+
payment_date: Date.new(2018, 1, 1), # See note below.
|
70
|
+
beneficiary_bic: "SPKHDE2H",
|
71
|
+
beneficiary_iban: "DE53250501800039370089",
|
72
|
+
beneficiary_name: "John Doe",
|
71
73
|
|
72
|
-
|
73
|
-
|
74
|
-
|
74
|
+
# Optional but recommended, see below. Truncated to 35 chars per line and max 3 lines.
|
75
|
+
beneficiary_address: "10 Foo Street\nBartown, Baz County\nABC 123"
|
76
|
+
|
77
|
+
beneficiary_reference: "Invoice 123", # Optional. Truncated to 35 chars per line and max 4 lines.
|
78
|
+
)
|
79
|
+
|
80
|
+
file.generate # => "foo,bar,…"
|
81
|
+
```
|
75
82
|
|
76
83
|
Currency is assumed to be GBP.
|
77
84
|
|
78
|
-
Characters other than a-z, A-Z, 0-9, space and .-/?:(),+' are automatically removed from free-text
|
85
|
+
Characters other than a-z, A-Z, 0-9, space and .-/?:(),+' are automatically removed from free-text values.
|
79
86
|
|
80
87
|
Sort codes, account numbers, IBAN and BIC are automatically normalised to the expected format.
|
81
88
|
|
@@ -9,11 +9,8 @@ class BanklineCsvImportFile
|
|
9
9
|
@records = []
|
10
10
|
end
|
11
11
|
|
12
|
-
def add_domestic_payment(payer_sort_code:, payer_account_number:, amount:, beneficiary_sort_code:, beneficiary_account_number:, beneficiary_name:, beneficiary_reference:, payment_date:
|
13
|
-
# Use Ruby on Rails' `Date.current` when available, since it will be in the app time zone rather than the server time zone.
|
14
|
-
payment_date ||= Date.respond_to?(:current) ? Date.current : Date.today
|
12
|
+
def add_domestic_payment(payer_sort_code:, payer_account_number:, amount:, beneficiary_sort_code:, beneficiary_account_number:, beneficiary_name:, beneficiary_reference:, payment_date:)
|
15
13
|
formatted_payment_date = payment_date.strftime("%d%m%Y")
|
16
|
-
|
17
14
|
payer_account_with_sort_code = normalize_account("#{payer_sort_code}#{payer_account_number}")
|
18
15
|
|
19
16
|
record = Record.new
|
@@ -32,11 +29,8 @@ class BanklineCsvImportFile
|
|
32
29
|
@records << record
|
33
30
|
end
|
34
31
|
|
35
|
-
def add_international_payment(payer_sort_code:, payer_account_number:, amount:, beneficiary_bic:, beneficiary_iban:, beneficiary_name:, beneficiary_address: nil, beneficiary_reference:, payment_date:
|
36
|
-
# Use Ruby on Rails' `Date.current` when available, since it will be in the app time zone rather than the server time zone.
|
37
|
-
payment_date ||= Date.respond_to?(:current) ? Date.current : Date.today
|
32
|
+
def add_international_payment(payer_sort_code:, payer_account_number:, amount:, beneficiary_bic:, beneficiary_iban:, beneficiary_name:, beneficiary_address: nil, beneficiary_reference:, payment_date:)
|
38
33
|
formatted_payment_date = payment_date.strftime("%d%m%Y")
|
39
|
-
|
40
34
|
payer_account_with_sort_code = normalize_account("#{payer_sort_code}#{payer_account_number}")
|
41
35
|
|
42
36
|
normalized_iban = normalize_iban(beneficiary_iban)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bankline_csv_import_file
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henrik Nyh
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|