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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 54025cfff6c29e03b95f121166c159066a5c4ffb
4
- data.tar.gz: bec14e977478642df29e3c967096cb69b34766ef
3
+ metadata.gz: 5873525845d592185e8e2588efb4ae4780f891e5
4
+ data.tar.gz: 23c0e7b3fde8695b4e1bdcf31258ff37b4f64b68
5
5
  SHA512:
6
- metadata.gz: 8eba6219bfb10225a9d9ac28e6d1e6d75d1897781e78abc82f123ef955a5bd85e6d9bbd8c839405dbab369320631088acb63e9d17c8ee979fb66503c944aac57
7
- data.tar.gz: 4b7d8620a44aceb424979484501c301898502d3aa59c494851e2090d988e283875b38eb621dca7f4ec84e3fa8b1725f406e05b3a844e6d4294bf416bfc7667b0
6
+ metadata.gz: c114810c6d7a56388a2e8c9f6bec660719bb1344c8e5c40711892bd316c0095f2f21f43f93ec02fe41e9f08e6be3286d5b27f365ddc0c6e327584285e7be71e1
7
+ data.tar.gz: 85cb877a0b3506166048addfaeb236605c6c18e2452a760ddbf73829248f6da365f42894844bb43f349c68a685f284a82c3ef7b2be5e35cac347cdee4023060e
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bankline_csv_import_file (0.2.0)
4
+ bankline_csv_import_file (0.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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
- file = BanklineCsvImportFile.new
14
+ ``` ruby
15
+ file = BanklineCsvImportFile.new
15
16
 
16
- file.add_domestic_payment(…)
17
- file.add_domestic_payment(…)
18
- file.add_international_payment(…)
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 fields are required unless stated otherwise.
26
+ All these arguments are required unless stated otherwise.
26
27
 
27
- file = BanklineCsvImportFile.new
28
+ ``` ruby
29
+ file = BanklineCsvImportFile.new
28
30
 
29
- file.add_domestic_payment(
30
- payer_sort_code: "151000",
31
- payer_account_number: "31806542",
32
- amount: "123.45", # Strings and BigDecimal are allowed. (Floats are not advisable for money.) Rounded to 2 decimals.
33
- beneficiary_sort_code: "151000",
34
- beneficiary_account_number: "44298801",
35
- beneficiary_name: "John Doe", # Truncated to a max length of 35.
36
- beneficiary_reference: "Invoice 123", # Truncated to a max length of 18.
37
- payment_date: Date.new(2018, 1, 1), # Optional. Defaults to Date.current if available, otherwise Date.today. See note below.
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
- file.generate # => "foo,bar,…"
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 fields.
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 fields are required unless stated otherwise.
60
+ All these arguments are required unless stated otherwise.
58
61
 
59
- file = BanklineCsvImportFile.new
60
- file.add_international_payment(
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
- # Optional but recommended, see below. Truncated to 35 chars per line and max 3 lines.
70
- beneficiary_address: "10 Foo Street\nBartown, Baz County\nABC 123"
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
- beneficiary_reference: "Invoice 123", # Optional. Truncated to 35 chars per line and max 4 lines.
73
- )
74
- file.generate # => "foo,bar,…"
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 fields.
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: nil)
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: nil)
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)
@@ -1,3 +1,3 @@
1
1
  class BanklineCsvImportFile
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
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.2.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-05 00:00:00.000000000 Z
11
+ date: 2018-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler