Class: EasyFinBankService

Inherits:
BaseService show all
Defined in:
lib/popbill/easyFinBank.rb

Overview

팝빌 계좌조회 API Service Implementation

Constant Summary

Constants inherited from BaseService

BaseService::BOUNDARY, BaseService::POPBILL_APIVersion, BaseService::ServiceID_REAL, BaseService::ServiceID_TEST, BaseService::ServiceURL_REAL, BaseService::ServiceURL_TEST

Instance Attribute Summary

Attributes inherited from BaseService

#ipRestrictOnOff, #isTest, #linkhub, #scopes, #token_table

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseService

#addScope, #checkID, #checkIsMember, #getAccessURL, #getBalance, #getChargeURL, #getCorpInfo, #getPartnerBalance, #getPartnerURL, #getPopbillURL, #getServiceID, #getServiceURL, #getSession_Token, #gzip_parse, #httpget, #httppost, #httppostfile, #httppostfiles, #joinMember, #listContact, #registContact, #setIpRestrictOnOff, #setIsTest, #updateContact, #updateCorpInfo

Class Method Details

.instance(linkID, secretKey) ⇒ Object



7
8
9
10
11
12
# File 'lib/popbill/easyFinBank.rb', line 7

def instance(linkID, secretKey)
  super(linkID, secretKey)
  @instance ||= new
  @instance.addScope("180")
  return @instance
end

Instance Method Details

#closeBankAccount(corpNum, bankCode, accountNumber, closeType, userID = "") ⇒ Object



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/popbill/easyFinBank.rb', line 64

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 = "") ⇒ Object



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/popbill/easyFinBank.rb', line 112

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 = "") ⇒ Object



142
143
144
145
146
147
148
# File 'lib/popbill/easyFinBank.rb', line 142

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 = "") ⇒ Object



135
136
137
138
139
140
# File 'lib/popbill/easyFinBank.rb', line 135

def getChargeInfo(corpNum, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  httpget("/EasyFin/Bank/ChargeInfo", corpNum, userID)
end

#getFlatRatePopUpURL(corpNum, userID = "") ⇒ Object



252
253
254
255
256
257
258
# File 'lib/popbill/easyFinBank.rb', line 252

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 = "") ⇒ Object



260
261
262
263
264
265
266
267
268
269
270
271
272
273
# File 'lib/popbill/easyFinBank.rb', line 260

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 = "") ⇒ Object



180
181
182
183
184
185
186
187
188
189
# File 'lib/popbill/easyFinBank.rb', line 180

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 = "") ⇒ Object



191
192
193
194
195
196
197
# File 'lib/popbill/easyFinBank.rb', line 191

def listActiveJob(corpNum, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end

  httpget("/EasyFin/Bank/JobList", corpNum, userID)
end

#listBankAccount(corpNum, userID = "") ⇒ Object



150
151
152
153
154
155
156
# File 'lib/popbill/easyFinBank.rb', line 150

def listBankAccount(corpNum, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end

  httpget("/EasyFin/Bank/ListBankAccount", corpNum, userID)
end

#registBankAccount(corpNum, bankAccountInfo, userID = "") ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/popbill/easyFinBank.rb', line 16

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 = "") ⇒ Object



158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/popbill/easyFinBank.rb', line 158

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 = "") ⇒ Object



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/popbill/easyFinBank.rb', line 90

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 = "") ⇒ Object



238
239
240
241
242
243
244
245
246
247
248
249
250
# File 'lib/popbill/easyFinBank.rb', line 238

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

#search(corpNum, jobID, tradeType, searchString, page, perPage, order, userID = '') ⇒ Object



199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/popbill/easyFinBank.rb', line 199

def search(corpNum, jobID, tradeType, searchString, page, perPage, order, userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if jobID.length != 18
    raise PopbillException.new('-99999999', '작업아이디(jobID)가 올바르지 않습니다.')
  end

  uri = "/EasyFin/Bank/#{jobID}"
  uri += "?TradeType=" + tradeType.join(',')
  uri += "&Page=" + page.to_s
  uri += "&PerPage=" + perPage.to_s
  uri += "&Order=" + order

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

  httpget(URI.escape(uri), corpNum, userID)
end

#summary(corpNum, jobID, tradeType, searchString, userID = '') ⇒ Object



220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# File 'lib/popbill/easyFinBank.rb', line 220

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 = "") ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/popbill/easyFinBank.rb', line 42

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