merchant_e_solutions 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/lib/merchant_e_solutions.rb +13 -2
- data/lib/merchant_e_solutions/batch_detail_report.rb +1 -1
- data/lib/merchant_e_solutions/batch_summary_report.rb +1 -1
- data/lib/merchant_e_solutions/deposit_record.rb +18 -0
- data/lib/merchant_e_solutions/deposit_report.rb +21 -0
- data/lib/merchant_e_solutions/detail_record.rb +3 -8
- data/lib/merchant_e_solutions/record.rb +12 -0
- data/lib/merchant_e_solutions/report.rb +2 -0
- data/lib/merchant_e_solutions/settlement_detail_report.rb +1 -1
- data/lib/merchant_e_solutions/settlement_summary_report.rb +1 -1
- data/lib/merchant_e_solutions/summary_record.rb +3 -1
- data/lib/merchant_e_solutions/version.rb +1 -1
- data/spec/fixtures/detail_report.csv +3 -0
- data/spec/lib/merchant_e_solutions/deposit_record_spec.rb +20 -0
- data/spec/lib/merchant_e_solutions/deposit_report_spec.rb +41 -0
- data/spec/lib/merchant_e_solutions_spec.rb +43 -1
- metadata +10 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35998008dbdf12b863aa699240c8857aaeba469a
|
4
|
+
data.tar.gz: a5165942271e73270c351152e3f5e67e463f50b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f234059d25c33dba5f2a7e19f88300f5bf034b4a0bd0b2921bae344cbbc69dfc3928dc4f7ec7bf413cf4f63c26a3d3e4445e73a2ae000fee397214ceb9d6fd20
|
7
|
+
data.tar.gz: 7aa4a3f42ca41833b94d254f71dd18c0efa642e59d924c4ac4ebfb2ea54af7b73935455c9e1c0578f8cffdcfa54028b0c4f2a2ed223be7453a00dbcc84325159
|
data/lib/merchant_e_solutions.rb
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
require 'merchant_e_solutions/configuration'
|
2
2
|
require 'merchant_e_solutions/report'
|
3
3
|
require 'merchant_e_solutions/request'
|
4
|
-
require 'merchant_e_solutions/
|
4
|
+
require 'merchant_e_solutions/deposit_report'
|
5
5
|
require 'merchant_e_solutions/batch_detail_report'
|
6
6
|
require 'merchant_e_solutions/batch_summary_report'
|
7
7
|
require 'merchant_e_solutions/settlement_detail_report'
|
8
8
|
require 'merchant_e_solutions/settlement_summary_report'
|
9
|
-
require 'merchant_e_solutions/summary_record'
|
10
9
|
|
11
10
|
module MerchantESolutions
|
12
11
|
|
@@ -15,6 +14,14 @@ module MerchantESolutions
|
|
15
14
|
yield(Configuration)
|
16
15
|
end
|
17
16
|
|
17
|
+
def batch_summary_report(options = {})
|
18
|
+
BatchSummaryReport.new(options)
|
19
|
+
end
|
20
|
+
|
21
|
+
def batch_detail_report(options = {})
|
22
|
+
BatchDetailReport.new(options)
|
23
|
+
end
|
24
|
+
|
18
25
|
def settlement_summary_report(options = {})
|
19
26
|
SettlementSummaryReport.new(options)
|
20
27
|
end
|
@@ -22,6 +29,10 @@ module MerchantESolutions
|
|
22
29
|
def settlement_detail_report(options = {})
|
23
30
|
SettlementDetailReport.new(options)
|
24
31
|
end
|
32
|
+
|
33
|
+
def deposit_report(options = {})
|
34
|
+
DepositReport.new(options)
|
35
|
+
end
|
25
36
|
end
|
26
37
|
|
27
38
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'merchant_e_solutions/record'
|
2
|
+
|
3
|
+
module MerchantESolutions
|
4
|
+
class DepositRecord < Record
|
5
|
+
|
6
|
+
attr_reader :organization_id, :organization_name,
|
7
|
+
:date, :type, :amount, :reference_id
|
8
|
+
|
9
|
+
def initialize(row)
|
10
|
+
@organization_id = row[0]
|
11
|
+
@organization_name = row[1]
|
12
|
+
@date = parse_date(row[2])
|
13
|
+
@type = row[3]
|
14
|
+
@amount = row[4]
|
15
|
+
@reference_id = row[5]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'merchant_e_solutions/deposit_record'
|
2
|
+
|
3
|
+
module MerchantESolutions
|
4
|
+
class DepositReport < Report
|
5
|
+
|
6
|
+
|
7
|
+
private
|
8
|
+
|
9
|
+
def report_id
|
10
|
+
3
|
11
|
+
end
|
12
|
+
|
13
|
+
def report_type
|
14
|
+
1
|
15
|
+
end
|
16
|
+
|
17
|
+
def record_class
|
18
|
+
DepositRecord
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -1,5 +1,7 @@
|
|
1
|
+
require 'merchant_e_solutions/record'
|
2
|
+
|
1
3
|
module MerchantESolutions
|
2
|
-
class DetailRecord
|
4
|
+
class DetailRecord < Record
|
3
5
|
|
4
6
|
attr_reader :organization_id, :organization_name, :term_number, :batch_number, :batch_date,
|
5
7
|
:transaction_date, :card_code, :card_number, :reference_number, :purchase_id, :auth_code,
|
@@ -45,12 +47,5 @@ module MerchantESolutions
|
|
45
47
|
"Business"
|
46
48
|
end
|
47
49
|
end
|
48
|
-
|
49
|
-
|
50
|
-
private
|
51
|
-
|
52
|
-
def parse_date(date)
|
53
|
-
Date.strptime(date, "%m/%d/%Y") if date
|
54
|
-
end
|
55
50
|
end
|
56
51
|
end
|
@@ -1,5 +1,7 @@
|
|
1
|
+
require 'merchant_e_solutions/record'
|
2
|
+
|
1
3
|
module MerchantESolutions
|
2
|
-
class SummaryRecord
|
4
|
+
class SummaryRecord < Record
|
3
5
|
|
4
6
|
attr_reader :organization_id, :organization_name, :credit_company,
|
5
7
|
:sales_count, :sales_amount, :credits_count, :credits_amount, :net_amount
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MerchantESolutions::SummaryRecord do
|
4
|
+
describe "#initialize" do
|
5
|
+
subject { MerchantESolutions::DepositRecord.new(csv_row) }
|
6
|
+
# "Org Id","Org Name","Card Type","Sales Cnt","Sales Amt","Credits Cnt","Credits Amt","Net Amt"
|
7
|
+
let(:csv_row) { ['42', "Hamazon", "10/24/2013", "CREDIT", 13.37, "'1777"] }
|
8
|
+
|
9
|
+
its(:organization_id) { should == '42' }
|
10
|
+
its(:organization_name) { should == "Hamazon" }
|
11
|
+
it "parses out the date of the deposit" do
|
12
|
+
subject.date.day.should == 24
|
13
|
+
subject.date.month.should == 10
|
14
|
+
subject.date.year.should == 2013
|
15
|
+
end
|
16
|
+
its(:type) { should == "CREDIT" }
|
17
|
+
its(:amount) { should == 13.37 }
|
18
|
+
its(:reference_id) { should == "'1777" }
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MerchantESolutions::DepositReport do
|
4
|
+
before { stub_net_http_requests }
|
5
|
+
|
6
|
+
describe "#initialize" do
|
7
|
+
let(:request) { double(:request, body: request_fixture('detail_report')) }
|
8
|
+
before { MerchantESolutions::Request.stub(:new).and_return(request) }
|
9
|
+
|
10
|
+
it "parses the body of the request as a CSV" do
|
11
|
+
report = MerchantESolutions::DepositReport.new
|
12
|
+
|
13
|
+
report.records.size.should be > 0
|
14
|
+
|
15
|
+
report.records.each do |record|
|
16
|
+
record.should be_a MerchantESolutions::DepositRecord
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "#request_params" do
|
22
|
+
let(:request_params) { MerchantESolutions::DepositReport.new(options).request_params }
|
23
|
+
let(:options) { Hash.new }
|
24
|
+
|
25
|
+
it "knows its dsReportId" do
|
26
|
+
request_params[:dsReportId].should == 3
|
27
|
+
end
|
28
|
+
|
29
|
+
it "knows its reportType" do
|
30
|
+
request_params[:reportType].should == 1
|
31
|
+
end
|
32
|
+
|
33
|
+
context "when options are passed in" do
|
34
|
+
let(:options) { {test: 'params'} }
|
35
|
+
|
36
|
+
it "merges in the options" do
|
37
|
+
request_params[:test].should == 'params'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -3,7 +3,35 @@ require 'spec_helper'
|
|
3
3
|
describe MerchantESolutions do
|
4
4
|
before { stub_net_http_requests }
|
5
5
|
|
6
|
-
describe ".
|
6
|
+
describe ".batch_summary_report" do
|
7
|
+
it "returns an Instance of MerchantESolution::BatchReport" do
|
8
|
+
MerchantESolutions.batch_summary_report.should be_a MerchantESolutions::BatchSummaryReport
|
9
|
+
end
|
10
|
+
|
11
|
+
it "passes all options directly through to the new BatchReport" do
|
12
|
+
options = {hash: "with", any: "keys", and: "values"}
|
13
|
+
|
14
|
+
MerchantESolutions::BatchSummaryReport.should_receive(:new).with(options)
|
15
|
+
|
16
|
+
MerchantESolutions.batch_summary_report(options)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe ".batch_detail_report" do
|
21
|
+
it "returns an Instance of MerchantESolution::BatchReport" do
|
22
|
+
MerchantESolutions.batch_detail_report.should be_a MerchantESolutions::BatchDetailReport
|
23
|
+
end
|
24
|
+
|
25
|
+
it "passes all options directly through to the new BatchReport" do
|
26
|
+
options = {hash: "with", any: "keys", and: "values"}
|
27
|
+
|
28
|
+
MerchantESolutions::BatchDetailReport.should_receive(:new).with(options)
|
29
|
+
|
30
|
+
MerchantESolutions.batch_detail_report(options)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe ".settlement_summary_report" do
|
7
35
|
it "returns an Instance of MerchantESolution::SettlementReport" do
|
8
36
|
MerchantESolutions.settlement_summary_report.should be_a MerchantESolutions::SettlementSummaryReport
|
9
37
|
end
|
@@ -30,4 +58,18 @@ describe MerchantESolutions do
|
|
30
58
|
MerchantESolutions.settlement_detail_report(options)
|
31
59
|
end
|
32
60
|
end
|
61
|
+
|
62
|
+
describe ".deposit_report" do
|
63
|
+
it "returns an Instance of MerchantESolution::SettlementReport" do
|
64
|
+
MerchantESolutions.deposit_report.should be_a MerchantESolutions::DepositReport
|
65
|
+
end
|
66
|
+
|
67
|
+
it "passes all options directly through to the new SettlementReport" do
|
68
|
+
options = {hash: "with", any: "keys", and: "values"}
|
69
|
+
|
70
|
+
MerchantESolutions::DepositReport.should_receive(:new).with(options)
|
71
|
+
|
72
|
+
MerchantESolutions.deposit_report(options)
|
73
|
+
end
|
74
|
+
end
|
33
75
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: merchant_e_solutions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Ellis
|
@@ -85,7 +85,10 @@ files:
|
|
85
85
|
- lib/merchant_e_solutions/batch_detail_report.rb
|
86
86
|
- lib/merchant_e_solutions/batch_summary_report.rb
|
87
87
|
- lib/merchant_e_solutions/configuration.rb
|
88
|
+
- lib/merchant_e_solutions/deposit_record.rb
|
89
|
+
- lib/merchant_e_solutions/deposit_report.rb
|
88
90
|
- lib/merchant_e_solutions/detail_record.rb
|
91
|
+
- lib/merchant_e_solutions/record.rb
|
89
92
|
- lib/merchant_e_solutions/report.rb
|
90
93
|
- lib/merchant_e_solutions/request.rb
|
91
94
|
- lib/merchant_e_solutions/settlement_detail_report.rb
|
@@ -94,10 +97,13 @@ files:
|
|
94
97
|
- lib/merchant_e_solutions/version.rb
|
95
98
|
- merchant_e_solutions.gemspec
|
96
99
|
- spec/fixtures/batch_summary.csv
|
100
|
+
- spec/fixtures/detail_report.csv
|
97
101
|
- spec/fixtures/settlement_detail.csv
|
98
102
|
- spec/fixtures/settlement_summary.csv
|
99
103
|
- spec/lib/merchant_e_solutions/batch_detail_report_spec.rb
|
100
104
|
- spec/lib/merchant_e_solutions/batch_summary_report_spec.rb
|
105
|
+
- spec/lib/merchant_e_solutions/deposit_record_spec.rb
|
106
|
+
- spec/lib/merchant_e_solutions/deposit_report_spec.rb
|
101
107
|
- spec/lib/merchant_e_solutions/detail_record_spec.rb
|
102
108
|
- spec/lib/merchant_e_solutions/report_spec.rb
|
103
109
|
- spec/lib/merchant_e_solutions/request_spec.rb
|
@@ -132,10 +138,13 @@ specification_version: 4
|
|
132
138
|
summary: Wrapper for the Settlement Report API
|
133
139
|
test_files:
|
134
140
|
- spec/fixtures/batch_summary.csv
|
141
|
+
- spec/fixtures/detail_report.csv
|
135
142
|
- spec/fixtures/settlement_detail.csv
|
136
143
|
- spec/fixtures/settlement_summary.csv
|
137
144
|
- spec/lib/merchant_e_solutions/batch_detail_report_spec.rb
|
138
145
|
- spec/lib/merchant_e_solutions/batch_summary_report_spec.rb
|
146
|
+
- spec/lib/merchant_e_solutions/deposit_record_spec.rb
|
147
|
+
- spec/lib/merchant_e_solutions/deposit_report_spec.rb
|
139
148
|
- spec/lib/merchant_e_solutions/detail_record_spec.rb
|
140
149
|
- spec/lib/merchant_e_solutions/report_spec.rb
|
141
150
|
- spec/lib/merchant_e_solutions/request_spec.rb
|