Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added scrambled EPRAW raw file. I'd like my eggs scrambled, please.

  • Loading branch information...
commit f4df4e94f3a280596d89750c6057149541645b70 1 parent 06dd9bb
@Doppp Doppp authored
Showing with 119 additions and 10 deletions.
  1. +115 −10 spec/parser_spec.rb
  2. +4 −0 spec/support/dummy_epraw_raw
View
125 spec/parser_spec.rb
@@ -2,28 +2,133 @@
describe Paxmex::Parser do
let(:eptrn_file) { File.join(File.dirname(__FILE__), 'support/dummy_eptrn_raw') }
- let(:schema_key) { 'eptrn' }
- let(:parser) { Paxmex::Parser.new(eptrn_file, schema: schema_key) }
+ let(:schema_key_eptrn) { 'eptrn' }
+ let(:parser_eptrn) { Paxmex::Parser.new(eptrn_file, schema: schema_key_eptrn) }
+
+ let(:epraw_file) { File.join(File.dirname(__FILE__), 'support/dummy_epraw_raw') }
+ let(:schema_key_epraw) { 'epraw' }
+ let(:parser_epraw) { Paxmex::Parser.new(epraw_file, schema: schema_key_epraw) }
describe '#raw' do
- it 'returns the raw text for the file' do
- parser.raw.should == File.read(eptrn_file).chomp
+ it 'returns the raw text for the eptrn file' do
+ parser_eptrn.raw.should == File.read(eptrn_file).chomp
+ end
+
+ it 'returns the raw text for the epraw file' do
+ parser_epraw.raw.should == File.read(epraw_file).chomp
end
end
describe '#schema' do
- it 'returns a schema object' do
- parser.schema.should be_instance_of(Paxmex::Schema)
+ it 'returns a schema object for the eptrn file' do
+ parser_eptrn.schema.should be_instance_of(Paxmex::Schema)
+ end
+
+ it 'returns the schema for the specified key of the eptrn file' do
+ parser_eptrn.schema.to_h.should == Paxmex::Parser::SCHEMATA[schema_key_eptrn]
+ end
+
+ it 'returns a schema object for the epraw file' do
+ parser_epraw.schema.should be_instance_of(Paxmex::Schema)
end
- it 'returns the schema for the specified key' do
- parser.schema.to_h.should == Paxmex::Parser::SCHEMATA[schema_key]
+ it 'returns the schema for the specified key of the epraw file' do
+ parser_epraw.schema.to_h.should == Paxmex::Parser::SCHEMATA[schema_key_epraw]
end
end
describe '#parse' do
- it 'returns a parsed hash for the file based on the schema' do
- parser.parse.should == {
+ it 'returns a parsed hash for the eptrn file based on the schema' do
+ parser_epraw.parse.should == {
+ "DATA_FILE_TRAILER_RECORD" => {
+ "DF_TRL_RECORD_TYPE" => "DFTRL",
+ "DF_TRL_DATE" => "03082013",
+ "DF_TRL_TIME" => "0452",
+ "DF_TRL_FILE_ID" => "000000",
+ "DF_TRL_FILE_NAME" => "LUMOS LABS INC ",
+ "DF_TRL_RECIPIENT_KEY" => "00000000003491124567 0000000000",
+ "DF_TRL_RECORD_COUNT" => "0000004"
+ },
+ "DATA_FILE_HEADER_RECORD" => {
+ "DF_HDR_RECORD_TYPE" => "DFHDR",
+ "DF_HDR_DATE" => "03082013",
+ "DF_HDR_TIME" => "0452",
+ "DF_HDR_FILE_ID" => "000000",
+ "DF_HDR_FILE_NAME" => "LUMOS LABS INC "
+ },
+ "SUMMARY_RECORD" => {
+ "AMEX_PAYEE_NUMBER" => "3491124567",
+ "AMEX_SORT_FIELD_1" => "0000000000",
+ "AMEX_SORT_FIELD_2" => "0000000000",
+ "PAYMENT_YEAR" => "2013",
+ "PAYMENT_NUMBER" => "DUMT1234",
+ "RECORD_TYPE" => "1",
+ "DETAIL_RECORD_TYPE" => "00",
+ "PAYMENT_DATE" => "2013068",
+ "PAYMENT_AMOUNT" => "0000500355D",
+ "DEBIT_BALANCE_AMOUNT" => "00000000{",
+ "ABA_BANK_NUMBER" => "121140399",
+ "SE_DDA_NUMBER" => "0000004000 "
+ },
+ "SUMMARY_OF_CHARGE_DETAIL_RECORD" => [
+ {
+ "AMEX_PAYEE_NUMBER" => "3491124567",
+ "AMEX_SE_NUMBER" => "3491124567",
+ "SE_UNIT_NUMBER" => " ",
+ "PAYMENT_YEAR" => "2013",
+ "PAYMENT_NUMBER" => "DUMT1234",
+ "RECORD_TYPE" => "2",
+ "DETAIL_RECORD_TYPE" => "10",
+ "SE_BUSINESS_DATE" => "2013065",
+ "AMEX_PROCESS_DATE" => "2013065",
+ "SOC_INVOICE_NUMBER" => "000140",
+ "SOC_AMOUNT" => "0000500355D",
+ "DISCOUNT_AMOUNT" => "00008354H",
+ "SERVICE_FEE_AMOUNT" => "000073H",
+ "NET_SOC_AMOUNT" => "0000500355D",
+ "DISCOUNT_RATE" => "03500",
+ "SERVICE_FEE_RATE" => "00030",
+ "AMEX_GROSS_AMOUNT" => "0000500355D",
+ "AMEX_ROC_COUNT" => "0040E",
+ "TRACKING_ID" => "065013192",
+ "CPC_INDICATOR" => " ",
+ "AMEX_RO_COUNT_POA" => "000040E"
+ }
+ ],
+ "RECORD_OF_CHARGE_DETAIL_RECORD" => [
+ {
+ "TLRR_AMEX_PAYEE_NUMBER" => "3491124567",
+ "TLRR_AMEX_SE_NUMBER" => "3491124567",
+ "TLRR_SE_UNIT_NUMBER" => " ",
+ "TLRR_PAYMENT_YEAR" => "2013",
+ "TLRR_PAYMENT_NUMBER" => "DUMT1235",
+ "TLRR_RECORD_TYPE" => "3",
+ "TLRR_DETAIL_RECORD_TYPE" => "11",
+ "TLRR_SE_BUSINESS_DATE" => "2013065",
+ "TLRR_AMEX_PROCESS_DATE" => "2013065",
+ "TLRR_SOC_INVOICE_NUMBER" => "000141",
+ "TLRR_SOC_AMOUNT" => "1000500426EAB",
+ "TLRR_ROC_AMOUNT" => "CDEFG01234573",
+ "TLRR_CM_NUMBER" => "H000000500005JD",
+ "TLRR_CM_REF_NO" => "12345LMNA11",
+ "TLRR_SE_REF" => " ",
+ "TLRR_SE_REF_EXPANSION_FILLER" => " ",
+ "TLRR_ROC_NUMBER" => " ",
+ "TLRR_TRAN_DATE" => "2013065",
+ "TLRR_SE_REF_POA" => "0355D0040E0650131920000000000A",
+ "NON_COMPLIANT_INDICATOR" => " ",
+ "NON_COMPLIANT_ERROR_CODE_1" => " ",
+ "NON_COMPLIANT_ERROR_CODE_2" => " ",
+ "NON_COMPLIANT_ERROR_CODE_3" => " ",
+ "NON_COMPLIANT_ERROR_CODE_4" => " ",
+ "NON_SWIPED_INDICATOR" => " "
+ }
+ ]
+ }
+ end
+
+ it 'returns a parsed hash for the epraw file based on the schema' do
+ parser_epraw.parse.should == {
"DATA_FILE_TRAILER_RECORD" => {
"DF_TRL_RECORD_TYPE" => "DFTRL",
"DF_TRL_DATE" => "03082013",
View
4 spec/support/dummy_epraw_raw
@@ -0,0 +1,4 @@
+DFHDR030820130435000000LUMOS LABS INC
+1234567890000000000000000000002013066M141610020130680000226124C00000000{1231403990000123000
+20412300256740170029 2013066M6956210201304528130650001678000226124C00002254H000073H000000{0000126124C0350000030000000000000000{0000{0000244124C0040E065028576 201306610201599000040E
+DFTRL030820130435000000LUMOS LABS INC 00000000002754170029 00000000000000004
Please sign in to comment.
Something went wrong with that request. Please try again.