Skip to content
This repository has been archived by the owner on Jul 1, 2018. It is now read-only.

Add IBK card type #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/net/wisedog/android/whooing/sms/br/SmsFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@
public class SmsFilter {
static public final String KEY_ITEM = "item";
static public final String KEY_CARDNAME = "cardname";
static public final String KEY_INOUT = "inout";
static public final int TYPE_INOUT_INCOMING = 1;
static public final int TYPE_INOUT_OUTGOING = 2;
static public final String KEY_DATE = "date";
static public final String KEY_MONEY = "money";
static public final String KEY_CARDNUMBER = "cardnumber";
static public final String KEY_CHECKCARD = "checkcard";

/**
Expand Down Expand Up @@ -145,6 +149,16 @@ public Bundle filterMessage(String msg, int cardCode){
}
break;

case SmsFilterData.CODE_IBK:
b = new Bundle();
b.putInt(KEY_DATE, WhooingSmsUtil.convertWhooingDate(tokens[0]));
b.putString(KEY_ITEM, tokens[6]);
b.putInt(KEY_MONEY, convertToInt(tokens[3]));
b.putInt(KEY_INOUT, tokens[2].equals("출금") ? TYPE_INOUT_OUTGOING : TYPE_INOUT_INCOMING);
b.putString(KEY_CARDNUMBER, tokens[7]);
b.putBoolean(KEY_CHECKCARD, true);
break;

default:
break;
}
Expand Down
11 changes: 7 additions & 4 deletions src/net/wisedog/android/whooing/sms/br/SmsFilterData.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class SmsFilterData {
static public final int CODE_SHINHAN = 8;
static public final int CODE_HANA = 9;
static public final int CODE_NH = 10;
static public final int CODE_IBK = 11;

static public final String[] CARD_COMPANY_NAME = {
"",
Expand All @@ -39,22 +40,24 @@ public class SmsFilterData {
"현대카드",
"신한카드",
"하나SK카드",
"농협카드"
"농협카드",
"기업은행"
};


// Be sure to check that below order and upper constants must be matched.
static public final String[] SENDER_NUMBER = {
"", // None
"15886700", //외환
"15886700", //외환
"15888900", //삼성
"15888300", //롯데
"15881688", //KB
"15889955", //우리
"15884000", //우리체크
"15884000", //우리체크
"15776200", //현대
"15447200", //신한
"15991155", //하나
"15881600" //농협
"15881600", //농협
"15662566", //기업
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ public void testAddAllAccountEntity(){
assertEquals("내카드", info.title);
assertEquals("creditcard", info.category);
assertEquals(20990101, info.close_date);
}

public void testGetAllRecord(){
ArrayList<AccountInfo> array = mDb.getAllRecord();
assertEquals(4, array.size());
}
Expand Down
24 changes: 24 additions & 0 deletions tests/src/net/wisedog/android/whooing/sms/test/SmsFilterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,28 @@ public void testFilterMsgHyundai(){
assertEquals(true, b.getBoolean(SmsFilter.KEY_CHECKCARD, false));
}

public void testFilterMsgIBKOutgoing(){
Bundle b = mFilter.filterMessage("11/06 18:06\n출금 530,463원\n잔액 2,256,323원\nGOOGLE\n123***12312300\n기업", SmsFilterData.CODE_IBK);
assertNotNull(b);

assertEquals(20131106, b.getInt(SmsFilter.KEY_DATE, -1));
assertEquals("GOOGLE", b.getString(SmsFilter.KEY_ITEM));
assertEquals(530463, b.getInt(SmsFilter.KEY_MONEY));
assertEquals(SmsFilterData.CODE_IBK, b.getInt(SmsFilter.KEY_CARDNAME, -1));
assertEquals(true, b.getBoolean(SmsFilter.KEY_CHECKCARD, false));
assertEquals(SmsFilter.TYPE_INOUT_OUTGOING, b.getInt(SmsFilter.KEY_INOUT, -1));
assertEquals("123***12312300", b.getString(SmsFilter.KEY_CARDNUMBER));
}
public void testFilterMsgIBKIncoming(){
Bundle b = mFilter.filterMessage("10/15 09:57\n입금 3,114원\n잔액 5,016,561원\n체크입금\n123***12312300\n기업", SmsFilterData.CODE_IBK);
assertNotNull(b);

assertEquals(20131015, b.getInt(SmsFilter.KEY_DATE, -1));
assertEquals("체크입금", b.getString(SmsFilter.KEY_ITEM));
assertEquals(3114, b.getInt(SmsFilter.KEY_MONEY));
assertEquals(SmsFilterData.CODE_IBK, b.getInt(SmsFilter.KEY_CARDNAME, -1));
assertEquals(true, b.getBoolean(SmsFilter.KEY_CHECKCARD, false));
assertEquals(SmsFilter.TYPE_INOUT_INCOMING, b.getInt(SmsFilter.KEY_INOUT, -1));
assertEquals("123***12312300", b.getString(SmsFilter.KEY_CARDNUMBER));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class WhooingSmsTest extends ActivityInstrumentationTestCase2<WhooingSms>
private ListView mListView;
private TextView mTextBoard;

@SuppressWarnings("deprecation")
public WhooingSmsTest(){
super("net.wisedog.android.whooing.sms.activity.WhooingSms", WhooingSms.class);
}
Expand All @@ -58,7 +59,7 @@ public void testPreconditions(){
}

public void testBoardText(){
int itemCount = mListView.getAdapter().getCount();
int itemCount = mListView.getCount();
String msg = mTextBoard.getText().toString();
String msgNoData = mActivity.getString(
net.wisedog.android.whooing.sms.R.string.whoochoo_sms_board_no_data);
Expand Down