django-barobill 0.1.1__tar.gz → 0.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. {django_barobill-0.1.1/django_barobill.egg-info → django_barobill-0.1.3}/PKG-INFO +1 -1
  2. django_barobill-0.1.3/django_barobill/migrations/0002_partner_unique_partner_brn_userid.py +17 -0
  3. django_barobill-0.1.3/django_barobill/migrations/__init__.py +0 -0
  4. django_barobill-0.1.3/django_barobill/migrations/__pycache__/0001_initial.cpython-312.pyc +0 -0
  5. django_barobill-0.1.3/django_barobill/migrations/__pycache__/__init__.cpython-312.pyc +0 -0
  6. {django_barobill-0.1.1 → django_barobill-0.1.3}/django_barobill/models.py +40 -6
  7. {django_barobill-0.1.1 → django_barobill-0.1.3/django_barobill.egg-info}/PKG-INFO +1 -1
  8. {django_barobill-0.1.1 → django_barobill-0.1.3}/django_barobill.egg-info/SOURCES.txt +3 -0
  9. {django_barobill-0.1.1 → django_barobill-0.1.3}/setup.py +1 -1
  10. django_barobill-0.1.1/django_barobill/__init__.py +0 -2
  11. {django_barobill-0.1.1 → django_barobill-0.1.3}/LICENSE +0 -0
  12. {django_barobill-0.1.1 → django_barobill-0.1.3}/MANIFEST.in +0 -0
  13. {django_barobill-0.1.1 → django_barobill-0.1.3}/README.md +0 -0
  14. {django_barobill-0.1.1/django_barobill/migrations → django_barobill-0.1.3/django_barobill}/__init__.py +0 -0
  15. {django_barobill-0.1.1 → django_barobill-0.1.3}/django_barobill/admin.py +0 -0
  16. {django_barobill-0.1.1 → django_barobill-0.1.3}/django_barobill/apps.py +0 -0
  17. {django_barobill-0.1.1 → django_barobill-0.1.3}/django_barobill/choices.py +0 -0
  18. {django_barobill-0.1.1 → django_barobill-0.1.3}/django_barobill/errors.py +0 -0
  19. {django_barobill-0.1.1 → django_barobill-0.1.3}/django_barobill/migrations/0001_initial.py +0 -0
  20. {django_barobill-0.1.1 → django_barobill-0.1.3}/django_barobill/parsers.py +0 -0
  21. {django_barobill-0.1.1 → django_barobill-0.1.3}/django_barobill/tests.py +0 -0
  22. {django_barobill-0.1.1 → django_barobill-0.1.3}/django_barobill/utils.py +0 -0
  23. {django_barobill-0.1.1 → django_barobill-0.1.3}/django_barobill/views.py +0 -0
  24. {django_barobill-0.1.1 → django_barobill-0.1.3}/django_barobill.egg-info/dependency_links.txt +0 -0
  25. {django_barobill-0.1.1 → django_barobill-0.1.3}/django_barobill.egg-info/requires.txt +0 -0
  26. {django_barobill-0.1.1 → django_barobill-0.1.3}/django_barobill.egg-info/top_level.txt +0 -0
  27. {django_barobill-0.1.1 → django_barobill-0.1.3}/setup.cfg +0 -0
  28. {django_barobill-0.1.1 → django_barobill-0.1.3}/tests/test_app.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: django-barobill
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: A reusable Django app for integration with BaroBill services.
5
5
  Home-page: https://github.com/cuhong/django-barobill
6
6
  Author: cuhong
@@ -0,0 +1,17 @@
1
+ # Generated by Django 5.1.5 on 2025-07-21 04:42
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ('django_barobill', '0001_initial'),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.AddConstraint(
14
+ model_name='partner',
15
+ constraint=models.UniqueConstraint(fields=('brn', 'userid', 'dev'), name='unique_partner_brn_userid'),
16
+ ),
17
+ ]
@@ -3,7 +3,7 @@ from typing import Optional
3
3
 
4
4
  from django.db import models
5
5
  from django.utils import timezone
6
- from zeep import Client
6
+ from zeep import Client, Transport
7
7
 
8
8
  from django_barobill.choices import BankAccountCollectCycle, BankAccountBank, BankAccountAccountType, BankAccountTransactionDirection
9
9
  from django_barobill.errors import BarobillAPIError, BarobillError
@@ -20,7 +20,8 @@ class BankHelper:
20
20
  endpoint = "https://testws.baroservice.com/BANKACCOUNT.asmx?wsdl"
21
21
  else:
22
22
  endpoint = "https://ws.baroservice.com/BANKACCOUNT.asmx?wsdl"
23
- return Client(endpoint)
23
+ transport = Transport(timeout=60)
24
+ return Client(endpoint, transport=transport)
24
25
 
25
26
  def get_bank_account_management_url(self):
26
27
  return self.client.service.GetBankAccountManagementURL(
@@ -53,8 +54,21 @@ class BankHelper:
53
54
  web_pwd: Optional[str] = None,
54
55
  identity_num: Optional[str] = None
55
56
  ):
56
- # need test
57
- result = self.client.service.RegisterBankAccount(
57
+ """
58
+ 신규 계좌를 등록한다.
59
+ :param alias: 별칭
60
+ :param collect_cycle: 수거주기
61
+ :param bank: 은행
62
+ :param account_type: 법인/개인계좌 여부
63
+ :param account_no: 계좌번호
64
+ :param password: 계좌 비밀번호
65
+ :param usage: (선택)적요
66
+ :param web_id: (선택)간편조회 아이디
67
+ :param web_pwd: (선택)간편조회 비밀번호
68
+ :param identity_num: (선택)간편조회 사업자등록번호 혹은 생년월일
69
+ :return: 생성된 BankAccount 인스턴스
70
+ """
71
+ result = self.client.service.RegistBankAccount(
58
72
  CERTKEY=self.partner.api_key,
59
73
  CorpNum=self.partner.brn,
60
74
  CollectCycle=collect_cycle,
@@ -72,7 +86,7 @@ class BankHelper:
72
86
  raise BarobillAPIError(result)
73
87
  account, created = BankAccount.objects.update_or_create(
74
88
  partner=self.partner, account_no=account_no, defaults=dict(
75
- collect_cycle=collect_cycle, bank=bank, account_type=account_type, alias=alias, usage=usage, is_delete=False
89
+ collect_cycle=collect_cycle, bank=bank, account_type=account_type, alias=alias, usage=usage, is_stop=False
76
90
  )
77
91
  )
78
92
  return account
@@ -88,11 +102,32 @@ class BankHelper:
88
102
  ).update(is_stop=True, stop_date=timezone.localdate())
89
103
 
90
104
 
105
+ class PartnerManager(models.Manager):
106
+ def register_partner(self, name, brn, api_key, userid, dev=False):
107
+ """
108
+ 신규 파트너를 등록한다.
109
+ :param name: 파트너사명
110
+ :param brn: 바로빌에 등록한 파트너 사업자등록번호
111
+ :param api_key: 바로빌에서 발급한 파트너 api_key
112
+ :param userid: 바로빌에서 발급한 파트너 Id
113
+ :param dev: 개발모드 여부
114
+ :return: Partner
115
+ """
116
+ partner, created = self.get_or_create(
117
+ brn=brn, userid=userid, defaults=dict(name=name, api_key=api_key, dev=dev)
118
+ )
119
+ return partner
120
+
121
+
91
122
  class Partner(models.Model):
92
123
  class Meta:
93
124
  verbose_name = '파트너'
94
125
  verbose_name_plural = verbose_name
126
+ constraints = [
127
+ models.UniqueConstraint(fields=['brn', 'userid', 'dev'], name='unique_partner_brn_userid'),
128
+ ]
95
129
 
130
+ objects = PartnerManager()
96
131
  name = models.CharField(max_length=255, unique=True, verbose_name='파트너사명')
97
132
  brn = models.CharField(max_length=10, unique=True, verbose_name='사업자등록번호')
98
133
  api_key = models.CharField(max_length=36, verbose_name='인증키')
@@ -329,7 +364,6 @@ class BankAccount(models.Model):
329
364
  raise BarobillAPIError(result.CurrentPage)
330
365
  return result
331
366
 
332
-
333
367
  def get_monthly_log(
334
368
  self,
335
369
  base_month: str,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: django-barobill
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: A reusable Django app for integration with BaroBill services.
5
5
  Home-page: https://github.com/cuhong/django-barobill
6
6
  Author: cuhong
@@ -19,5 +19,8 @@ django_barobill.egg-info/dependency_links.txt
19
19
  django_barobill.egg-info/requires.txt
20
20
  django_barobill.egg-info/top_level.txt
21
21
  django_barobill/migrations/0001_initial.py
22
+ django_barobill/migrations/0002_partner_unique_partner_brn_userid.py
22
23
  django_barobill/migrations/__init__.py
24
+ django_barobill/migrations/__pycache__/0001_initial.cpython-312.pyc
25
+ django_barobill/migrations/__pycache__/__init__.cpython-312.pyc
23
26
  tests/test_app.py
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
  long_description=open("README.md").read()
3
3
  setup(
4
4
  name="django-barobill", # 패키지 이름 (PyPI에 등록될 이름)
5
- version="0.1.1", # 초기 버전
5
+ version="0.1.3", # 초기 버전
6
6
  packages=find_packages(exclude=["tests*", "docs*"]), # 'django_barobill' 폴더 포함
7
7
  include_package_data=True, # MANIFEST.in 파일에 포함된 파일도 추가
8
8
  license="MIT License", # 라이선스
@@ -1,2 +0,0 @@
1
- # django_barobill/__init__.py
2
- __version__ = "0.1.0"
File without changes