merchant_e_solutions 0.4.1 → 0.4.2

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: 3f190c95e55c362af2bbbe74e6e753f894422fd1
4
- data.tar.gz: dfdd06de461ee1f4ae5fb423a5bb93acd11dc600
3
+ metadata.gz: 711eff0d6ae2129abe6b4ca1870bf1e41e282c55
4
+ data.tar.gz: 19c5204ecbd1dd9f4559151c552c5f724ef16f6f
5
5
  SHA512:
6
- metadata.gz: 71d5ffa5a8ea0259101a23cf565c62962a8ad8392bc893ac116047f4c3c0a4d26519e3d14a75b5eeee71775252654dc133ed0299ed700aeb2bbf3bda2a07d993
7
- data.tar.gz: bf44ef4d8fdf635c290f8a9ab3a2dffbe32660e586ab2869e6f3e1861fb59e0840703765c232967ed128b2a3905291a583ab3dbb88e042f55facbb77bfd6048d
6
+ metadata.gz: 6598c2a6dcb1601be52e6bdcb279c1aed463b6e6a9e96bc6ea4b784e47983ade0b02fe3107e48041dbe85565491e0919479af7a71dae4ea400692e43229f1f66
7
+ data.tar.gz: aad781319bb3f9f950e4099519f45c5f1b4f819acdabaf0041568c2d909e58f4ed04911fe0fa5281faa06a870b5711d794992401fb2b2903e217cf08e05735b8
data/README.md CHANGED
@@ -45,6 +45,34 @@ echo $MERCHANT_E_SOLUTIONS_USER_ID # yourUserID
45
45
  echo $MERCHANT_E_SOLUTIONS_PASSWORD # yourPassword
46
46
  ```
47
47
 
48
+ ## A Note on Acquirer Reference Numbers (ARNs)
49
+
50
+ The MeS detailed report APIs return an acquirer reference number for every
51
+ transaction. Take a look at the MeS reporting API documentation under 'Links'
52
+ for more.
53
+
54
+ One issue we've seen is that the MeS API always returns reference numbers
55
+ pre-pended with an apostrophe. Instead of `123456789`, we consistently see
56
+ `'123456789`.
57
+
58
+ The MeS docs are inconsistent in its examples, showing apostrophes pre-pended
59
+ to some and none pre-pended to others. The MeS reporting front-end never shows
60
+ apostrophes in reference numbers, and the apostrophe is never addressed in the
61
+ documentation.
62
+
63
+ Further, the reference number is documented as a 23-character field. The apostrophe
64
+ consistently brings this field's length to 24 characters.
65
+
66
+ This is probably sloppiness on MeS' end, so by default this library removes these
67
+ apostrophes. If you want to keep the apostrophe for any reason -- personal preference,
68
+ interfacing with legacy records that have them -- you can get the reference number
69
+ unchanged from a record thusly:
70
+
71
+ reference_number = record.reference_number(:unchanged => true)
72
+
73
+ ## Links
74
+
75
+ * [MeS Reporting API documentation](http://resources.merchante-solutions.com/display/TPGPUB/MeS+Payment+Gateway+Developer's+Guide#MeSPaymentGatewayDeveloper%27sGuide-5.ReportingOptions)
48
76
 
49
77
  ## Contributing
50
78
 
@@ -4,7 +4,7 @@ module MerchantESolutions
4
4
  class DetailRecord < Record
5
5
 
6
6
  attr_reader :organization_id, :organization_name, :term_number, :batch_number, :batch_date,
7
- :transaction_date, :card_code, :card_number, :reference_number, :purchase_id, :auth_code,
7
+ :transaction_date, :card_code, :card_number, :purchase_id, :auth_code,
8
8
  :entry_mode, :transaction_amount, :trident_transaction_id, :client_reference_number
9
9
 
10
10
  def initialize(row)
@@ -25,6 +25,11 @@ module MerchantESolutions
25
25
  @client_reference_number = row[14]
26
26
  end
27
27
 
28
+ def reference_number(options={})
29
+ return @reference_number if options[:unchanged]
30
+ cleaned_reference_number
31
+ end
32
+
28
33
  def credit_company
29
34
  {
30
35
  "AM" => "American Express",
@@ -47,5 +52,16 @@ module MerchantESolutions
47
52
  "Business"
48
53
  end
49
54
  end
55
+
56
+
57
+ private
58
+
59
+ def cleaned_reference_number
60
+ if @reference_number.start_with?("'")
61
+ @reference_number[1..-1]
62
+ else
63
+ @reference_number
64
+ end
65
+ end
50
66
  end
51
67
  end
@@ -1,3 +1,3 @@
1
1
  module MerchantESolutions
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
@@ -24,15 +24,41 @@ describe MerchantESolutions::DetailRecord do
24
24
  its("transaction_date.month") { should == 10 }
25
25
  its(:card_code) { should == "AM" }
26
26
  its(:card_number) { should == "000000xxxxxx1234" }
27
- its(:reference_number) { "'0000213"}
28
- its(:purchase_id) { "AAAAAAAAAAA0" }
29
- its(:auth_code) { "AAAAAAAAAAA0" }
30
- its(:entry_mode) { "AAAAAAAAAAA0" }
27
+ its(:reference_number) { should == "0000213"}
28
+ its(:purchase_id) { should == "AAAAAAAAAAA0" }
29
+ its(:auth_code) { should == "100000" }
30
+ its(:entry_mode) { should == "KEYED" }
31
31
  its(:transaction_amount) { should == 7.09 }
32
32
  its(:trident_transaction_id) { should == "T.T.ID" }
33
33
  its(:client_reference_number) { should == "clientRefNumber" }
34
34
  end
35
35
 
36
+ describe "#reference_number" do
37
+ let(:reference_number) { "'0000213" }
38
+ let(:record) { MerchantESolutions::DetailRecord.new([nil, nil, nil, nil, nil, nil, nil, nil, reference_number])}
39
+
40
+ context "when no arguments are given" do
41
+ it "removes the pre-pended apostrophe from the reference number" do
42
+ record.reference_number.should == "0000213"
43
+ end
44
+ end
45
+
46
+ context "when the :unchanged option is set to true" do
47
+ it "returns the reference number verbatim, the pre-pended apostrophe intact" do
48
+ record.reference_number(:unchanged => true).should == "'0000213"
49
+ end
50
+ end
51
+
52
+ context "when the reference number doesn't contain an apostrophe" do
53
+ let (:reference_number) { "0000213" }
54
+
55
+ it "returns the reference number verbatim, regardless of the :unchanged argument" do
56
+ record.reference_number.should == "0000213"
57
+ record.reference_number(:unchanged => true).should == "0000213"
58
+ end
59
+ end
60
+ end
61
+
36
62
  describe "credit cards" do
37
63
  subject { MerchantESolutions::DetailRecord.new([nil, nil, nil, nil, nil, nil, card_code]) }
38
64
 
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.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Ellis
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-15 00:00:00.000000000 Z
12
+ date: 2013-11-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler