django-barobill 0.1.0__py3-none-any.whl → 0.1.2__py3-none-any.whl

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.
@@ -1,2 +0,0 @@
1
- # django_barobill/__init__.py
2
- __version__ = "0.1.0"
django_barobill/models.py CHANGED
@@ -53,8 +53,21 @@ class BankHelper:
53
53
  web_pwd: Optional[str] = None,
54
54
  identity_num: Optional[str] = None
55
55
  ):
56
- # need test
57
- result = self.client.service.RegisterBankAccount(
56
+ """
57
+ 신규 계좌를 등록한다.
58
+ :param alias: 별칭
59
+ :param collect_cycle: 수거주기
60
+ :param bank: 은행
61
+ :param account_type: 법인/개인계좌 여부
62
+ :param account_no: 계좌번호
63
+ :param password: 계좌 비밀번호
64
+ :param usage: (선택)적요
65
+ :param web_id: (선택)간편조회 아이디
66
+ :param web_pwd: (선택)간편조회 비밀번호
67
+ :param identity_num: (선택)간편조회 사업자등록번호 혹은 생년월일
68
+ :return: 생성된 BankAccount 인스턴스
69
+ """
70
+ result = self.client.service.RegistBankAccount(
58
71
  CERTKEY=self.partner.api_key,
59
72
  CorpNum=self.partner.brn,
60
73
  CollectCycle=collect_cycle,
@@ -72,7 +85,7 @@ class BankHelper:
72
85
  raise BarobillAPIError(result)
73
86
  account, created = BankAccount.objects.update_or_create(
74
87
  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
88
+ collect_cycle=collect_cycle, bank=bank, account_type=account_type, alias=alias, usage=usage, is_stop=False
76
89
  )
77
90
  )
78
91
  return account
@@ -88,11 +101,32 @@ class BankHelper:
88
101
  ).update(is_stop=True, stop_date=timezone.localdate())
89
102
 
90
103
 
104
+ class PartnerManager(models.Manager):
105
+ def register_partner(self, name, brn, api_key, userid, dev=False):
106
+ """
107
+ 신규 파트너를 등록한다.
108
+ :param name: 파트너사명
109
+ :param brn: 바로빌에 등록한 파트너 사업자등록번호
110
+ :param api_key: 바로빌에서 발급한 파트너 api_key
111
+ :param userid: 바로빌에서 발급한 파트너 Id
112
+ :param dev: 개발모드 여부
113
+ :return: Partner
114
+ """
115
+ partner, created = self.get_or_create(
116
+ brn=brn, userid=userid, defaults=dict(name=name, api_key=api_key, dev=dev)
117
+ )
118
+ return partner
119
+
120
+
91
121
  class Partner(models.Model):
92
122
  class Meta:
93
123
  verbose_name = '파트너'
94
124
  verbose_name_plural = verbose_name
125
+ constraints = [
126
+ models.UniqueConstraint(fields=['brn', 'userid', 'dev'], name='unique_partner_brn_userid'),
127
+ ]
95
128
 
129
+ objects = PartnerManager()
96
130
  name = models.CharField(max_length=255, unique=True, verbose_name='파트너사명')
97
131
  brn = models.CharField(max_length=10, unique=True, verbose_name='사업자등록번호')
98
132
  api_key = models.CharField(max_length=36, verbose_name='인증키')
@@ -329,7 +363,6 @@ class BankAccount(models.Model):
329
363
  raise BarobillAPIError(result.CurrentPage)
330
364
  return result
331
365
 
332
-
333
366
  def get_monthly_log(
334
367
  self,
335
368
  base_month: str,
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 cuhong
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,119 @@
1
+ Metadata-Version: 2.2
2
+ Name: django-barobill
3
+ Version: 0.1.2
4
+ Summary: A reusable Django app for integration with BaroBill services.
5
+ Home-page: https://github.com/cuhong/django-barobill
6
+ Author: cuhong
7
+ Author-email: hongcoilhouse@gmail.com
8
+ License: MIT License
9
+ Classifier: Environment :: Web Environment
10
+ Classifier: Framework :: Django
11
+ Classifier: Framework :: Django :: 4.0
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
17
+ Requires-Python: >=3.8
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: django>=4.0
21
+ Requires-Dist: requests==2.32.3
22
+ Requires-Dist: zeep==4.3.1
23
+ Dynamic: author
24
+ Dynamic: author-email
25
+ Dynamic: classifier
26
+ Dynamic: description
27
+ Dynamic: description-content-type
28
+ Dynamic: home-page
29
+ Dynamic: license
30
+ Dynamic: requires-dist
31
+ Dynamic: requires-python
32
+ Dynamic: summary
33
+
34
+ # Django Barobill
35
+ 바로빌 연동을 위한 reusable package
36
+
37
+ ## 설치
38
+ 아래 명령어로 패키지 설치한 후
39
+
40
+ ```pip install django-barobill```
41
+
42
+ `django`의 `settings.py` 내 `INSTALLED_APPS`에 `django_barobill`을 추가합니다.
43
+
44
+ ```shell
45
+ INSTALLED_APPS = [
46
+ ...
47
+ 'django.contrib.staticfiles',
48
+ 'django_barobill'
49
+ ]
50
+ ```
51
+
52
+ 마지막으로 마이그레이션을 수행하여 필요한 테이블을 생성합니다.
53
+
54
+ ```shell
55
+ python manage.py migrate
56
+ ```
57
+
58
+ ## 구성
59
+ ### 파트너
60
+ 이 패키지는 기본적으로 여러개의 파트너사를 한 앱에서 관리할 수 있게 구성되어 있습니다.
61
+
62
+ 파트너사는 `models.Partner`에 저장되며 신규 파트너를 아래와 같이 등록할 수 있습니다.
63
+
64
+ ```python
65
+ from django_barobill.models import Partner
66
+ 상세 학목은 메서드의 docstring 참고
67
+
68
+ partner = Partner.objects.register_partner(
69
+ '회사명', '사업자등록번호', 'api key', 'userid', dev=False
70
+ )
71
+ ```
72
+
73
+ ## 계좌조회
74
+ ### 계좌조회 관련 client
75
+ 아래와 같이 은행 계좌 조회와 관련된 client를 생성한다.
76
+
77
+ ```python
78
+ from django_barobill.models import Partner
79
+
80
+ partner = Partner.objects.first()
81
+
82
+ bank_client = partner.bank.client
83
+ ```
84
+ ### 계좌 등록
85
+ 생성된 client에서 아래와 같이 계좌를 생성한다.
86
+ 상세 학목은 메서드의 docstring 참고
87
+
88
+ ```python
89
+ bank_account = bank_client.register_bank_account(
90
+ '수금계좌', BankAccountCollectCycle.MINUTE10, BankAccountBank.HANA,
91
+ BankAccountAccountType.C, '21223451241', '1234'
92
+ )
93
+ ```
94
+
95
+ ### 계좌 거래내역
96
+
97
+ #### 조회만
98
+ 아래와 같은 형태로 거래내역을 조회힌다. 응답은 barobill의 응답을 변경없이 반환한다.
99
+ 자세한 내용은 각 메서드의 docstring 참고
100
+ ```python
101
+ # 기간 조회
102
+ log_duration = bank_client.get_log('20240101', '20240105', 1)
103
+ # 특정일 조회
104
+ log_day = bank_client.get_daily_log('20240101', 1)
105
+ # 특정월 조회
106
+ log_month = bank_client.get_monthly_log('202401', 1)
107
+ ```
108
+
109
+ #### 조회 및 데이터베이스 등록
110
+ 조회 후 데이터베이스 등록 까지 진행
111
+ 자세한 내용은 각 메서드의 docstring 참고
112
+ ```python
113
+ # 특정일 조회 및 등록
114
+ log_day = bank_client.update_date_log('20240101')
115
+ # 오늘 조회 및 등록
116
+ log_today = bank_client.update_today_log()
117
+ # 어제 조회 및 등록
118
+ log_yesterday = bank_client.update_yesterday_log()
119
+ ```
@@ -1,17 +1,19 @@
1
- django_barobill/__init__.py,sha256=6APRtokGxem92Eirujfn1lSSABIc2gFsVvfwDIOEf7c,52
1
+ django_barobill/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  django_barobill/admin.py,sha256=suMo4x8I3JBxAFBVIdE-5qnqZ6JAZV0FESABHOSc-vg,63
3
3
  django_barobill/apps.py,sha256=VUIGjvRJJKmOM0WaBbqoU5QULCvC0YGKhKIMFYGpXxI,161
4
4
  django_barobill/choices.py,sha256=qkh5baFFCycTOKcTiU2DSu2iDJTiIQyhFgQ8uNSWyDo,1236
5
5
  django_barobill/errors.py,sha256=lKEEEKzAdwAueQOLhoSLe-B9VLT-S7hqUCrkfpkRXp8,3555
6
- django_barobill/models.py,sha256=Utls8E_l_dh8Yb8O8HibuaUQara6KakHqQk_RfmZ5K0,16134
6
+ django_barobill/models.py,sha256=PvAsCqSpQZ0W61y6wWnLkz6A0HHQMlj_oq-l5_SLC7E,17527
7
7
  django_barobill/parsers.py,sha256=boBB9ePTRJrOmoEql23VQk_TDcaWqbEwJhxtW9Gx2Yc,1027
8
8
  django_barobill/tests.py,sha256=iG0hzKegA86ls4QxLY_p6sgZ0fkb_CD0HyzY-aO28ic,1661
9
9
  django_barobill/utils.py,sha256=eKSI-QgM8WTHA1vUukbZnVKEhiMcX7wzxLPcJ_6VKVE,200
10
10
  django_barobill/views.py,sha256=xc1IQHrsij7j33TUbo-_oewy3vs03pw_etpBWaMYJl0,63
11
11
  django_barobill/migrations/0001_initial.py,sha256=Uh8Nx0mOJQjXnPhzXmT7mrQx5zTbE8bNQSJJXTqHNpU,5176
12
12
  django_barobill/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- django_barobill-0.1.0.dist-info/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- django_barobill-0.1.0.dist-info/METADATA,sha256=kyC3pz_IHWpZX05M7_5JhfpWEkQmxi5Sg6AyLCnZx7s,996
15
- django_barobill-0.1.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
16
- django_barobill-0.1.0.dist-info/top_level.txt,sha256=RmcbZUqTKXVI1jksKTaeennFkcSemFHwgxSMPqE7YgU,16
17
- django_barobill-0.1.0.dist-info/RECORD,,
13
+ django_barobill/migrations/__pycache__/0001_initial.cpython-312.pyc,sha256=e9D59BlhPF0qvZ_QM6iSS53LkFe0LpaJ8t0RlzKqzzw,5537
14
+ django_barobill/migrations/__pycache__/__init__.cpython-312.pyc,sha256=vKIJDzcsTZu8PdXPuC052vkL9-T0Fi69yIxRo4BI57s,181
15
+ django_barobill-0.1.2.dist-info/LICENSE,sha256=o5IEBFE4Yr1q_q2_HvPqL2YXAfakEBi0X2WS9CDJlyY,1063
16
+ django_barobill-0.1.2.dist-info/METADATA,sha256=KneDIWMjsDhSqXcn2eOdpKKZvdb6bx0kTPJfou5bpqk,3389
17
+ django_barobill-0.1.2.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
18
+ django_barobill-0.1.2.dist-info/top_level.txt,sha256=RmcbZUqTKXVI1jksKTaeennFkcSemFHwgxSMPqE7YgU,16
19
+ django_barobill-0.1.2.dist-info/RECORD,,
File without changes
@@ -1,31 +0,0 @@
1
- Metadata-Version: 2.2
2
- Name: django-barobill
3
- Version: 0.1.0
4
- Summary: A reusable Django app for integration with BaroBill services.
5
- Home-page: https://github.com/cuhong/django-barobill
6
- Author: cuhong
7
- Author-email: hongcoilhouse@gmail.com
8
- License: MIT License
9
- Classifier: Environment :: Web Environment
10
- Classifier: Framework :: Django
11
- Classifier: Framework :: Django :: 4.0
12
- Classifier: Intended Audience :: Developers
13
- Classifier: License :: OSI Approved :: MIT License
14
- Classifier: Programming Language :: Python
15
- Classifier: Programming Language :: Python :: 3.8
16
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
17
- Requires-Python: >=3.8
18
- Description-Content-Type: text/markdown
19
- License-File: LICENSE
20
- Requires-Dist: django>=4.0
21
- Requires-Dist: requests==2.32.3
22
- Requires-Dist: zeep==4.3.1
23
- Dynamic: author
24
- Dynamic: author-email
25
- Dynamic: classifier
26
- Dynamic: description-content-type
27
- Dynamic: home-page
28
- Dynamic: license
29
- Dynamic: requires-dist
30
- Dynamic: requires-python
31
- Dynamic: summary