Back to project page SMSAlive.
The source code is released under:
Apache License
If you think the Android project SMSAlive listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.futuretech.app.smsalive.Application.Services.impl; //from w ww.j a v a 2s .c o m import android.content.Context; import com.futuretech.app.smsalive.Domain.models.AccountTransaction; import com.futuretech.app.smsalive.Application.Services.TranscactionTypeHandler; import com.futuretech.app.smsalive.Domain.crud.AccountTransactionCrudService; import com.futuretech.app.smsalive.Domain.crud.impl.AccountTransactionCrudServiceImpl; import org.joda.time.LocalDate; import org.joda.time.format.DateTimeFormat; /** * Created by ironhulk on 2014/12/02. */ public class PurchaseHandler extends TranscactionTypeHandler { private AccountTransactionCrudService atcs; private AccountTransaction accountTransaction; @Override public void handleAccountType(String message, Context c) { atcs = new AccountTransactionCrudServiceImpl(c); accountTransaction = new AccountTransaction(); if(message.substring(0, 4).contains("Absa")){ String witDrawPassOn = message.substring(6); accountTransaction.setAccountNumber(witDrawPassOn.substring(4, 8)); accountTransaction.setAccountType(witDrawPassOn.substring(0, 4)); LocalDate d = LocalDate.parse(witDrawPassOn.substring(9,18), DateTimeFormat.forPattern("dd/MM/yyyy")); accountTransaction.setTransactionDate(d); accountTransaction.setTransactionPlace(witDrawPassOn.substring(18,witDrawPassOn.indexOf("reserved"))); String transactionAmount = witDrawPassOn.substring(witDrawPassOn.indexOf("reserved")+10,witDrawPassOn.indexOf("for")-2); accountTransaction.setTransactionAmount(Double.valueOf(transactionAmount)); accountTransaction.setTransactionType("Payment"); String balance = witDrawPassOn.substring(witDrawPassOn.indexOf(" balance: R")+11,witDrawPassOn.indexOf("Help")-2); accountTransaction.setAccountBalance(Double.valueOf(balance.replace(",",""))); } } }