Class: AccountCheckService

Inherits:
BaseService show all
Defined in:
lib/popbill/accountCheck.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
13
# File 'lib/popbill/accountCheck.rb', line 7

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

Instance Method Details

#checkAccountInfo(corpNum, bankCode, accountNumber, userID = '') ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/popbill/accountCheck.rb', line 39

def checkAccountInfo(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

  uri = "/EasyFin/AccountCheck?c=#{bankCode}&n=#{accountNumber}"

  httppost(uri, corpNum, "", "", userID)
end

#checkDepositorInfo(corpNum, bankCode, accountNumber, identityNumType, identityNum, userID = '') ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/popbill/accountCheck.rb', line 56

def checkDepositorInfo(corpNum, bankCode, accountNumber, identityNumType, identityNum, 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 identityNumType == ''
    raise PopbillException.new(-99999999, '등록번호 유형이 입력되지 않았습니다.')
  end
  if not identityNumType.match('^[PB]$')
    raise PopbillException.new(-99999999,"등록번호 유형이 유효하지 않습니다.")
  end
  if identityNum == ''
    raise PopbillException.new(-99999999,"등록번호가 입력되지 않았습니다.")
  end
  if not identityNum.match('^\d+$')
    raise PopbillException.new(-99999999,"등록번호는 숫자만 입력할 수 있습니다.")
  end

  uri = "/EasyFin/DepositorCheck"
  uri += "?c="+bankCode
  uri += "&n="+accountNumber
  uri += "&t="+identityNumType
  uri += "&p="+identityNum

  httppost(uri, corpNum, "", "", userID)
end

#getChargeInfo(corpNum, userID = '', serviceType = '') ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/popbill/accountCheck.rb', line 17

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

  uri = "/EasyFin/AccountCheck/ChargeInfo?serviceType=" + serviceType
  escapeURI = URI.escape(uri)

  httpget(escapeURI, corpNum, userID)
end

#getUnitCost(corpNum, userID = '', serviceType = '') ⇒ Object



28
29
30
31
32
33
34
35
36
37
# File 'lib/popbill/accountCheck.rb', line 28

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

  uri = "/EasyFin/AccountCheck/UnitCost?serviceType=" + serviceType
  escapeURI = URI.escape(uri)

  httpget(escapeURI, corpNum, userID)['unitCost']
end