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_GA_REAL, BaseService::ServiceURL_GA_TEST, BaseService::ServiceURL_REAL, BaseService::ServiceURL_Static_REAL, BaseService::ServiceURL_Static_TEST, BaseService::ServiceURL_TEST

Instance Attribute Summary

Attributes inherited from BaseService

#ipRestrictOnOff, #isTest, #linkhub, #scopes, #token_table, #useGAIP, #useLocalTimeYN, #useStaticIP

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseService

#addScope, #checkID, #checkIsMember, #getAccessURL, #getBalance, #getChargeURL, #getContactInfo, #getCorpInfo, #getPartnerBalance, #getPartnerURL, #getPaymentURL, #getPopbillURL, #getServiceID, #getServiceURL, #getSession_Token, #getUseHistoryURL, #gzip_parse, #httpget, #httppost, #httppostbulk, #httppostfile, #httppostfiles, #joinMember, #listContact, #registContact, #setIpRestrictOnOff, #setIsTest, #setUseGAIP, #setUseLocalTimeYN, #setUseStaticIP, #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

#deleteBankAccount(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
133
134
135
136
# File 'lib/popbill/easyFinBank.rb', line 112

def deleteBankAccount(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/Delete"

  postData = {}
  postData["BankCode"] = bankCode
  postData["AccountNumber"] = accountNumber

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

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



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/popbill/easyFinBank.rb', line 138

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



168
169
170
171
172
173
174
# File 'lib/popbill/easyFinBank.rb', line 168

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



161
162
163
164
165
166
# File 'lib/popbill/easyFinBank.rb', line 161

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

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



278
279
280
281
282
283
284
# File 'lib/popbill/easyFinBank.rb', line 278

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



286
287
288
289
290
291
292
293
294
295
296
297
298
299
# File 'lib/popbill/easyFinBank.rb', line 286

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



206
207
208
209
210
211
212
213
214
215
# File 'lib/popbill/easyFinBank.rb', line 206

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



217
218
219
220
221
222
223
# File 'lib/popbill/easyFinBank.rb', line 217

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

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

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



176
177
178
179
180
181
182
# File 'lib/popbill/easyFinBank.rb', line 176

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



184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/popbill/easyFinBank.rb', line 184

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



264
265
266
267
268
269
270
271
272
273
274
275
276
# File 'lib/popbill/easyFinBank.rb', line 264

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



225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/popbill/easyFinBank.rb', line 225

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



246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# File 'lib/popbill/easyFinBank.rb', line 246

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