uob-payroll 1.0.1 → 1.0.2

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
  SHA1:
3
- metadata.gz: 342a1798b5d9230de027dde774c016d76e29fe25
4
- data.tar.gz: dbedb6d5bfbcda842dfea709b00a768f86696134
3
+ metadata.gz: 26ecd32fd61d7f53f77bf7261411aea6cf01b231
4
+ data.tar.gz: 6bb40fd043452f949ad7e4b536c52a6921d4ea92
5
5
  SHA512:
6
- metadata.gz: ec2470d0bbda2b4940a40b66e1537428031ef5793a625ebe470b00c7f7b27a4f2e559ec65d6558902c18e56adc7770c116cb5ba96647e7e6f9e144d6e80a1789
7
- data.tar.gz: 226c5b9b9ecf50e968e65d137534602cd67494c343b2c46d3c9d7a7dcc59c0f5245e5195c419ea89f5d94ea24aafdc5f3680ab5cd50fed3f662477ecfb91eb4c
6
+ metadata.gz: 3cc27e12c24c32ecc9ee9a39722b0ff3123445b974655d8b7445970e36d229348ad29713b8047da84b22e7544d5d7bace035df0df49ec9aa9d9300d3299c4d9f
7
+ data.tar.gz: eda4045e762e5d3a030df8423f9def14a832fc4261533e823cc9a310e7989ac504224af74013823ffda818432e12b0f3d9ac7ab95b0ae15b36f49d5fb6e28380
@@ -20,8 +20,7 @@ module UOB
20
20
 
21
21
  def calculate
22
22
  sum_header +
23
- sum_rows +
24
- 22 # Payment Type is always 'R' for Payroll and Hash Code will always be 1. See p16.
23
+ sum_rows
25
24
  end
26
25
 
27
26
  attr_reader :header, :rows
@@ -33,19 +32,33 @@ module UOB
33
32
  end
34
33
 
35
34
  def sum_rows
36
- rows.each.with_index(1).map { |row, index|
37
- calculate_string(row.receiving_bic_code) +
35
+ index = 1
36
+ sum = 0
37
+
38
+ rows.each.map do |row|
39
+ index = 1 if index == 9
40
+
41
+ sum += calculate_string(row.receiving_bic_code) +
38
42
  index * calculate_padded_string(string: row.receiving_account_number, size: 34) +
39
43
  index * calculate_padded_string(string: row.receiving_account_name, size: 140) +
40
44
  calculate_payment_type(index) +
41
45
  calculate_string('SGD') +
42
46
  calculate_padded_string(string: row.formatted_amount, size: 18, pad: '0', just: :right) +
43
47
  calculate_string('SALA')
44
- }.reduce(0, :+)
48
+
49
+ index += 1
50
+ end
51
+
52
+ sum
45
53
  end
46
54
 
47
55
  private
48
56
 
57
+ def calculate_index(index)
58
+ index = 0 if index == 9
59
+ index += 1
60
+ end
61
+
49
62
  # Payment Type is always 'R', so Payment Code = 22
50
63
  def calculate_payment_type(index)
51
64
  22 * (index)
@@ -1,5 +1,5 @@
1
1
  module Uob
2
2
  module Payroll
3
- VERSION = "1.0.1"
3
+ VERSION = "1.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uob-payroll
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Paca
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-22 00:00:00.000000000 Z
11
+ date: 2016-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler