class EasyFinBankService

팝빌 계좌조회 API Service Implementation

Public Class Methods

instance(linkID, secretKey) click to toggle source
Calls superclass method BaseService::instance
# File lib/popbill/easyFinBank.rb, line 6
def instance(linkID, secretKey)
  super(linkID, secretKey)
  @instance ||= new
  @instance.addScope("180")
  return @instance
end

Public Instance Methods

closeBankAccount(corpNum, bankCode, accountNumber, closeType, userID = "") click to toggle source
# File lib/popbill/easyFinBank.rb, line 63
def closeBankAccount(corpNum, bankCode, accountNumber, closeType, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end

  if bankCode.to_s == ''
    raise PopbillException.new('-99999999', '은행코드가 입력되지 않았습니다.')
  end

  if bankCode.length != 4
    raise PopbillException.new('-99999999', '은행코드가 올바르지 않습니다.')
  end

  if accountNumber.to_s == ''
    raise PopbillException.new('-99999999', '은행 계좌번호가 입력되지 않았습니다.')
  end

  if closeType.to_s == ''
    raise PopbillException.new('-99999999', '정액제 해지유형이 입력되지 않았습니다.')
  end

  uri = "/EasyFin/Bank/BankAccount/Close/?BankCode=#{bankCode}&AccountNumber=#{accountNumber}&CloseType=#{closeType}"

  httppost(URI.escape(uri), corpNum, "", "", userID)
end
getBankAccountInfo(corpNum, bankCode, accountNumber, userID = "") click to toggle source
# File lib/popbill/easyFinBank.rb, line 111
def getBankAccountInfo(corpNum, bankCode, accountNumber, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end

  if bankCode.to_s == ''
    raise PopbillException.new('-99999999', '은행코드가 입력되지 않았습니다.')
  end

  if bankCode.length != 4
    raise PopbillException.new('-99999999', '은행코드가 올바르지 않습니다.')
  end

  if accountNumber.to_s == ''
    raise PopbillException.new('-99999999', '은행 계좌번호가 입력되지 않았습니다.')
  end

  uri = "/EasyFin/Bank/BankAccount/#{bankCode}/#{accountNumber}"

  httpget(uri, corpNum, userID)
end
getBankAccountMgtURL(corpNum, userID = "") click to toggle source
# File lib/popbill/easyFinBank.rb, line 141
def getBankAccountMgtURL(corpNum, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end

  httpget("/EasyFin/Bank?TG=BankAccount", corpNum, userID)['url']
end
getChargeInfo(corpNum, userID = "") click to toggle source
# File lib/popbill/easyFinBank.rb, line 134
def getChargeInfo(corpNum, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  httpget("/EasyFin/Bank/ChargeInfo", corpNum, userID)
end
getFlatRatePopUpURL(corpNum, userID = "") click to toggle source
# File lib/popbill/easyFinBank.rb, line 251
def getFlatRatePopUpURL(corpNum, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end

  httpget("/EasyFin/Bank?TG=CHRG", corpNum, userID)['url']
end
getFlatRateState(corpNum, bankCode, accountNumber, userID = "") click to toggle source
# File lib/popbill/easyFinBank.rb, line 259
def getFlatRateState(corpNum, bankCode, accountNumber, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end

  if bankCode.to_s == ''
    raise PopbillException.new('-99999999', '은행코드가 입력되지 않았습니다.')
  end
  if accountNumber.to_s == ''
    raise PopbillException.new('-99999999', '계좌번호가 입력되지 않았습니다.')
  end

  httpget("/EasyFin/Bank/Contract/#{bankCode}/#{accountNumber}", corpNum, userID)
end
getJobState(corpNum, jobID, userID = "") click to toggle source
# File lib/popbill/easyFinBank.rb, line 179
def getJobState(corpNum, jobID, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if jobID.to_s == ''
    raise PopbillException.new('-99999999', '작업아이디(jobID)가 입력되지 않았습니다.')
  end

  httpget("/EasyFin/Bank/#{jobID}/State", corpNum, userID)
end
listActiveJob(corpNum, userID = "") click to toggle source
# File lib/popbill/easyFinBank.rb, line 190
def listActiveJob(corpNum, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end

  httpget("/EasyFin/Bank/JobList", corpNum, userID)
end
listBankAccount(corpNum, userID = "") click to toggle source
# File lib/popbill/easyFinBank.rb, line 149
def listBankAccount(corpNum, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end

  httpget("/EasyFin/Bank/ListBankAccount", corpNum, userID)
end
registBankAccount(corpNum, bankAccountInfo, userID = "") click to toggle source
# File lib/popbill/easyFinBank.rb, line 15
def registBankAccount(corpNum, bankAccountInfo, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end

  if bankAccountInfo["BankCode"].to_s == ''
    raise PopbillException.new('-99999999', '은행코드가 입력되지 않았습니다.')
  end

  if bankAccountInfo["BankCode"].length != 4
    raise PopbillException.new('-99999999', '은행코드가 올바르지 않습니다.')
  end

  if bankAccountInfo["AccountNumber"].to_s == ''
    raise PopbillException.new('-99999999', '은행 계좌번호가 입력되지 않았습니다.')
  end

  uri = "/EasyFin/Bank/BankAccount/Regist"

  if bankAccountInfo["UsePeriod"].to_s != ''
    uri += "?UsePeriod=" + bankAccountInfo["UsePeriod"]
  end

  httppost(uri, corpNum, bankAccountInfo.to_json, "", userID)
end
requestJob(corpNum, bankCode, accountNumber, sDate, eDate, userID = "") click to toggle source
# File lib/popbill/easyFinBank.rb, line 157
def requestJob(corpNum, bankCode, accountNumber, sDate, eDate, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if bankCode.to_s == ''
    raise PopbillException.new('-99999999', '은행코드가 입력되지 않았습니다.')
  end
  if accountNumber.to_s == ''
    raise PopbillException.new('-99999999', '계좌번호가 입력되지 않았습니다.')
  end
  if sDate.to_s == ''
    raise PopbillException.new('-99999999', '시작일자가 입력되지 않았습니다.')
  end
  if eDate.to_s == ''
    raise PopbillException.new('-99999999', '종료일자가 입력되지 않았습니다.')
  end

  uri = "/EasyFin/Bank/BankAccount?BankCode=#{bankCode}&AccountNumber=#{accountNumber}&SDate=#{sDate}&EDate=#{eDate}"

  httppost(uri, corpNum, "", "", userID)['jobID']
end
revokeCloseBankAccount(corpNum, bankCode, accountNumber, userID = "") click to toggle source
# File lib/popbill/easyFinBank.rb, line 89
def revokeCloseBankAccount(corpNum, bankCode, accountNumber, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end

  if bankCode.to_s == ''
    raise PopbillException.new('-99999999', '은행코드가 입력되지 않았습니다.')
  end

  if bankCode.length != 4
    raise PopbillException.new('-99999999', '은행코드가 올바르지 않습니다.')
  end

  if accountNumber.to_s == ''
    raise PopbillException.new('-99999999', '은행 계좌번호가 입력되지 않았습니다.')
  end

  uri = "/EasyFin/Bank/BankAccount/RevokeClose/?BankCode=#{bankCode}&AccountNumber=#{accountNumber}"

  httppost(uri, corpNum, "", "", userID)
end
saveMemo(corpNum, tid, memo, userID = "") click to toggle source
# File lib/popbill/easyFinBank.rb, line 237
def saveMemo(corpNum, tid, memo, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if tid.to_s == ''
    raise PopbillException.new('-99999999', '거래내역 아이디가 입력되지 않았습니다.')
  end


  uri = "/EasyFin/Bank/SaveMemo?TID=#{tid}&Memo=#{memo}"

  httppost(uri, corpNum, "", "", userID)
end
summary(corpNum, jobID, tradeType, searchString, userID = '') click to toggle source
# File lib/popbill/easyFinBank.rb, line 219
def summary(corpNum, jobID, tradeType, searchString, userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if jobID.length != 18
    raise PopbillException.new('-99999999', '작업아이디(jobID)가 올바르지 않습니다.')
  end

  uri = "/EasyFin/Bank/#{jobID}/Summary"
  uri += "?TradeType=" + tradeType.join(',')

  if searchString.to_s != ''
    uri += "&SearchString=" + searchString
  end

  httpget(URI.escape(uri), corpNum, userID)
end
updateBankAccount(corpNum, bankAccountInfo, userID = "") click to toggle source
# File lib/popbill/easyFinBank.rb, line 41
def updateBankAccount(corpNum, bankAccountInfo, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end

  if bankAccountInfo["BankCode"].to_s == ''
    raise PopbillException.new('-99999999', '은행코드가 입력되지 않았습니다.')
  end

  if bankAccountInfo["BankCode"].length != 4
    raise PopbillException.new('-99999999', '은행코드가 올바르지 않습니다.')
  end

  if bankAccountInfo["AccountNumber"].to_s == ''
    raise PopbillException.new('-99999999', '은행 계좌번호가 입력되지 않았습니다.')
  end

  uri = "/EasyFin/Bank/BankAccount/#{bankAccountInfo["BankCode"]}/#{bankAccountInfo["AccountNumber"]}/Update"

  httppost(uri, corpNum, bankAccountInfo.to_json, "", userID)
end