Permalink
Browse files

Merge pull request #1 from lumoslabs/eptrn_yml

Eptrn yml
  • Loading branch information...
Doppp committed Apr 3, 2013
2 parents a57fdfb + 7b1d4ca commit 8b1893a04cf86f23165ac133fc3b0468870d438a
View
@@ -2,14 +2,10 @@ PATH
remote: .
specs:
paxmex (0.0.1)
- rails (~> 3.2.12)
GEM
remote: http://rubygems.org/
specs:
- actionmailer (3.2.12)
- actionpack (= 3.2.12)
- mail (~> 2.4.4)
actionpack (3.2.12)
activemodel (= 3.2.12)
activesupport (= 3.2.12)
@@ -23,18 +19,9 @@ GEM
activemodel (3.2.12)
activesupport (= 3.2.12)
builder (~> 3.0.0)
- activerecord (3.2.12)
- activemodel (= 3.2.12)
- activesupport (= 3.2.12)
- arel (~> 3.0.2)
- tzinfo (~> 0.3.29)
- activeresource (3.2.12)
- activemodel (= 3.2.12)
- activesupport (= 3.2.12)
activesupport (3.2.12)
i18n (~> 0.6)
multi_json (~> 1.0)
- arel (3.0.2)
builder (3.0.4)
diff-lcs (1.1.3)
erubis (2.7.0)
@@ -45,28 +32,14 @@ GEM
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.7.7)
- mail (2.4.4)
- i18n (>= 0.4.0)
- mime-types (~> 1.16)
- treetop (~> 1.4.8)
- mime-types (1.21)
multi_json (1.6.1)
- polyglot (0.3.3)
rack (1.4.5)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.3)
rack
rack-test (0.6.2)
rack (>= 1.0)
- rails (3.2.12)
- actionmailer (= 3.2.12)
- actionpack (= 3.2.12)
- activerecord (= 3.2.12)
- activeresource (= 3.2.12)
- activesupport (= 3.2.12)
- bundler (~> 1.0)
- railties (= 3.2.12)
railties (3.2.12)
actionpack (= 3.2.12)
activesupport (= 3.2.12)
@@ -77,35 +50,26 @@ GEM
rake (10.0.3)
rdoc (3.12.1)
json (~> 1.4)
+ rspec (2.12.0)
+ rspec-core (~> 2.12.0)
+ rspec-expectations (~> 2.12.0)
+ rspec-mocks (~> 2.12.0)
rspec-core (2.12.2)
rspec-expectations (2.12.1)
diff-lcs (~> 1.1.3)
rspec-mocks (2.12.2)
- rspec-rails (2.12.2)
- actionpack (>= 3.0)
- activesupport (>= 3.0)
- railties (>= 3.0)
- rspec-core (~> 2.12.0)
- rspec-expectations (~> 2.12.0)
- rspec-mocks (~> 2.12.0)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
- sqlite3 (1.3.7)
thor (0.17.0)
tilt (1.3.3)
- treetop (1.4.12)
- polyglot
- polyglot (>= 0.3.1)
- tzinfo (0.3.35)
PLATFORMS
ruby
DEPENDENCIES
- paxmex!
jquery-rails
- rspec-rails
- sqlite3
+ paxmex!
+ rspec
View
@@ -1,3 +1,58 @@
# Paxmex
This gem parses your Amex data files into human readable data.
+
+## Installation
+
+### From RubyGems.org
+
+```sh
+% gem install paxmex
+```
+
+## Available Methods
+
+* parse_eptrn(file_path)
+* parse_epraw(file_path)
+
+Both methods return a readable hash in the following format:
+
+```ruby
+{
+ "DATA_FILE_TRAILER_RECORD" => {
+ "DF_TRL_RECORD_TYPE" => "DFTRL",
+ "DF_TRL_DATE" => "03082013",
+ "DF_TRL_TIME" => "0435",
+ "DF_TRL_FILE_ID" => "000000",
+ "DF_TRL_FILE_NAME" => "LUMOS LABS INC ",
+ "DF_TRL_RECIPIENT_KEY" => "00000000002754170029 0000000000",
+ "DF_TRL_RECORD_COUNT" => "0000004"
+ },
+ "DATA_FILE_HEADER_RECORD" => {
+ "DF_HDR_RECORD_TYPE" => "DFHDR",
+ "DF_HDR_DATE" => "03082013",
+ "DF_HDR_TIME" => "0435",
+ "DF_HDR_FILE_ID" => "000000",
+ "DF_HDR_FILE_NAME" => "LUMOS LABS INC"
+ },
+ ...
+}
+```
+
+## Example
+
+```ruby
+require 'paxmex'
+Paxmex.parse_eptrn('/path/to/amex/eptrn/raw/file')
+Paxmex.parse_epraw('/path/to/amex/epraw/raw/file')
+```
+
+The input files for either methods is a data report file provided by American Express. These files are in either EPRAW or EPTRN format so use the relevant method to parse them. We have provided dummy EPRAW and EPTRN files in `spec/support`. Output and key-value pairs vary depending on whether you choose to parse an EPTRN or EPRAW file.
+
+## Contributing
+
+Fork and submit a pull request and make sure you add a test for any feature you add.
+
+## License
+
+LICENSE: (The MIT License)
View
@@ -0,0 +1,134 @@
+DATA_FILE_HEADER_RECORD:
+ FIELDS:
+ DF_HDR_RECORD_TYPE: [0, 4]
+ DF_HDR_DATE: [5, 12]
+ DF_HDR_TIME: [13, 16]
+ DF_HDR_FILE_ID: [17, 22]
+ DF_HDR_FILE_NAME: [23, 42]
+SUMMARY_RECORD:
+ FIELDS:
+ AMEX_PAYEE_NUMBER: [0, 9]
+ AMEX_SORT_FIELD_1: [10, 19]
+ AMEX_SORT_FIELD_2: [20, 29]
+ PAYMENT_YEAR: [30, 33]
+ PAYMENT_NUMBER: [34, 41]
+ RECORD_TYPE: [42, 42]
+ DETAIL_RECORD_TYPE: [43, 44]
+ PAYMENT_DATE: [45, 51]
+ PAYMENT_AMOUNT: [52, 62]
+ DEBIT_BALANCE_AMOUNT: [63, 71]
+ ABA_BANK_NUMBER: [72, 80]
+ SE_DDA_NUMBER: [81, 97]
+DETAIL_RECORD:
+ ABSTRACT: true
+ RECURRING: true
+ TYPE_FIELD: [43, 44]
+ TYPE_MAPPING:
+ '00': SUMMARY_RECORD
+ '10': SUMMARY_OF_CHARGE_DETAIL_RECORD
+ '20': CHARGEBACK_DETAIL_RECORD
+ '30': ADJUSTMENT_DETAIL_RECORD
+ '50': OTHER_FEES_AND_REVENUES_DETAIL_RECORDS
+ TYPES:
+ SUMMARY_OF_CHARGE_DETAIL_RECORD:
+ RECURRING: true
+ FIELDS:
+ AMEX_PAYEE_NUMBER: [0, 9]
+ AMEX_SE_NUMBER: [10, 19]
+ SE_UNIT_NUMBER: [20, 29]
+ PAYMENT_YEAR: [30, 33]
+ PAYMENT_NUMBER: [34, 41]
+ RECORD_TYPE: [42, 42]
+ DETAIL_RECORD_TYPE: [43, 44]
+ SE_BUSINESS_DATE: [45, 51]
+ AMEX_PROCESS_DATE: [52, 58]
+ SOC_INVOICE_NUMBER: [59, 64]
+ SOC_AMOUNT: [65, 75]
+ DISCOUNT_AMOUNT: [76, 84]
+ SERVICE_FEE_AMOUNT: [85, 91]
+ OPTIMA_DIVIDEND_AMOUNT: [92, 98]
+ NET_SOC_AMOUNT: [99, 109]
+ DISCOUNT_RATE: [110, 114]
+ SERVICE_FEE_RATE: [115, 119]
+ OPTIMA_DIVIDEND_RATE: [120, 124]
+ OPTIMA_GROSS_AMOUNT: [125, 135]
+ OPTIMA_ROC_COUNT: [136, 140]
+ AMEX_GROSS_AMOUNT: [141, 151]
+ AMEX_ROC_COUNT: [152, 156]
+ TRACKING_ID: [157, 165]
+ CPC_INDICATOR: [166, 166]
+ CHARGEBACK_DETAIL_RECORD:
+ RECURRING: true
+ FIELDS:
+ AMEX_PAYEE_NUMBER: [0, 9]
+ AMEX_SE_NUMBER: [10, 19]
+ SE_UNIT_NUMBER: [20, 29]
+ PAYMENT_YEAR: [30, 33]
+ PAYMENT_NUMBER: [34, 41]
+ RECORD_TYPE: [42, 42]
+ DETAIL_RECORD_TYPE: [43, 44]
+ SE_BUSINESS_DATE: [45, 51]
+ AMEX_PROCESS_DATE: [52, 58]
+ SOC_INVOICE_NUMBER: [59, 64]
+ SOC_AMOUNT: [65, 75]
+ CHARGEBACK_AMOUNT: [76, 84]
+ DISCOUNT_AMOUNT: [85, 93]
+ SERVICE_FEE_AMOUNT: [94, 100]
+ OPTIMA_DIVIDEND_AMOUNT: [101, 107]
+ NET_CHARGEBACK_AMOUNT: [108, 116]
+ DISCOUNT_RATE: [117, 121]
+ SERVICE_FEE_RATE: [122, 126]
+ OPTIMA_DIVIDEND_RATE: [127, 131]
+ OPTIMA_GROSS_AMOUNT: [132, 142]
+ CHARGEBACK_REASON: [143, 422]
+ ADJUSTMENT_DETAIL_RECORD:
+ RECURRING: true
+ FIELDS:
+ AMEX_PAYEE_NUMBER: [0, 9]
+ AMEX_SE_NUMBER: [10, 19]
+ SE_UNIT_NUMBER: [20, 29]
+ PAYMENT_YEAR: [30, 33]
+ PAYMENT_NUMBER: [34, 41]
+ RECORD_TYPE: [42, 42]
+ DETAIL_RECORD_TYPE: [43, 44]
+ AMEX_PROCESS_DATE: [45, 51]
+ ADJUSTMENT_NUMBER: [52, 57]
+ ADJUSTMENT_AMOUNT: [58, 66]
+ DISCOUNT_AMOUNT: [67, 75]
+ SERVICE_FEE_AMOUNT: [76, 82]
+ OPTIMA_DIVIDEND_AMOUNT: [83, 89]
+ NET_ADJUSTMENT_AMOUNT: [90, 98]
+ DISCOUNT_RATE: [99, 103]
+ SERVICE_FEE_RATE: [104, 108]
+ OPTIMA_DIVIDEND_RATE: [109, 113]
+ OPTIMA_GROSS_AMOUNT: [114, 124]
+ CARDMEMBER_NUMBER: [125, 141]
+ ADJUSTMENT_REASON: [142, 421]
+ OTHER_FEES_AND_REVENUES_DETAIL_RECORDS:
+ RECURRING: true
+ FIELDS:
+ AMEX_PAYEE_NUMBER: [0, 9]
+ AMEX_SE_NUMBER: [10, 19]
+ SE_UNIT_NUMBER: [20, 29]
+ PAYMENT_YEAR: [30, 33]
+ PAYMENT_NUMBER: [34, 41]
+ RECORD_TYPE: [42, 42]
+ DETAIL_RECORD_TYPE: [43, 44]
+ AMEX_PROCESS_DATE: [45, 51]
+ ASSET_BILLING_AMOUNT: [52, 60]
+ ASSET_BILLING_DESCRIPTION: [61, 126]
+ TAKE_ONE_COMMISSION_AMOUNT: [126, 134]
+ TAKE_ONE_DESCRIPTION: [135, 214]
+ OTHER_FEE_AMOUNT: [215, 223]
+ OTHER_FEE_DESCRIPTION: [224, 303]
+ ASSET_BILLING_TAX: [304, 312]
+DATA_FILE_TRAILER_RECORD:
+ TRAILER: true
+ FIELDS:
+ DF_TRL_RECORD_TYPE: [0, 4]
+ DF_TRL_DATE: [5, 12]
+ DF_TRL_TIME: [13, 16]
+ DF_TRL_FILE_ID: [17, 22]
+ DF_TRL_FILE_NAME: [23, 42]
+ DF_TRL_RECIPIENT_KEY: [43, 82]
+ DF_TRL_RECORD_COUNT: [83, 89]
Oops, something went wrong.

0 comments on commit 8b1893a

Please sign in to comment.