Method: TaxinvoiceService#checkMgtKeyInUse

Defined in:
lib/popbill/taxinvoice.rb

#checkMgtKeyInUse(corpNum, mgtKeyType, mgtKey) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/popbill/taxinvoice.rb', line 52

def checkMgtKeyInUse(corpNum, mgtKeyType, mgtKey)
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if mgtKey.to_s == ''
    raise PopbillException.new('-99999999', '문서번호가 올바르지 않습니다.')
  end

  begin
    response = httpget("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum)
    return response['itemKey'].length != 0
  rescue PopbillException => pe
    if pe.code == -11000005
      return false
    end
    raise PopbillException.new(pe.code, pe.message)
  end
end