Skip to content

Commit

Permalink
Merge pull request #6 from gray-adeyi/v2.1.0-dev
Browse files Browse the repository at this point in the history
V2.1.0 dev
  • Loading branch information
gray-adeyi authored Oct 8, 2024
2 parents 6706e9b + 0c238f8 commit b50b013
Show file tree
Hide file tree
Showing 31 changed files with 998 additions and 290 deletions.
42 changes: 42 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,48 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## unreleased

### Changed

- Charge.setAddress -> Charge.submitAddress

## [2.1.0] - 2024-10-08

### Added

- Param documentation for ApplePay.unregister_domain
- Param documentation for AsyncApplePay.unregister_domain
- `meta`, `type` and `code` fields to `Response`

### Changed

- Bumped httpx to 0.27.2
- Transaction.get_transactions(customer: Optional[int]) -> Transaction.get_transactions(customer: Optional[str])
- AsyncTransaction.get_transactions(customer: Optional[int]) -> AsyncTransaction.get_transactions(customer:
Optional[str])
- Transaction.export(customer: Optional[int]) -> Transaction.export(customer: Optional[str])
- AsyncTransaction.export(customer: Optional[int]) -> AsyncTransaction.export(customer: Optional[str])
- Transaction.export(settlement: Optional[int]) -> Transaction.export(settlement: Optional[str])
- AsyncTransaction.export(settlement: Optional[int]) -> AsyncTransaction.export(settlement: Optional[str])
- Transaction.export(payment_page: Optional[int]) -> Transaction.export(payment_page: Optional[str])
- AsyncTransaction.export(payment_page: Optional[int]) -> AsyncTransaction.export(payment_page: Optional[str])
- PaymentRequest.update `line_item` and `tax` parameter to use `Tax` and `LineItem` inplace of `list`
- AsyncPaymentRequest.update `line_item` and `tax` parameter to use `Tax` and `LineItem` inplace of `list`
- PaymentPage.metadata type
- AsyncPaymentPage.metadata type
- Plan.update documentation

## Fixed

- Use of literal "POST" in TransactionSplit.add_or_update
- Use of literal "POST" in AsyncTransactionSplit.add_or_update

## Removed

- Redundant payload from Subscription.send_update_link
- Redundant payload from AsyncSubscription.send_update_link

## [2.0.3] - 2024-03-24

### Added
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
docs-serve:
mkdocs serve
docs-build:
mkdocs build
27 changes: 9 additions & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "pypaystack2"
version = "2.0.3"
version = "2.1.0"
description = "A developer-friendly client library for Paystack"
readme = "README.md"
license = "MIT"
Expand All @@ -14,32 +14,23 @@ classifiers = [
"Programming Language :: Python :: 3",
]


requires-python = ">= 3.9"
dependencies = [
"httpx>=0.27.0",
"httpx>=0.27.2",
]
requires-python = ">= 3.9"

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.rye]
managed = true
[tool.uv]
dev-dependencies = [
"mkdocs>=1.6.1",
"mkdocs-material>=9.5.39",
"mkdocstrings[python]>=0.26.1",
"pytest>=8.3.3",
"python-dotenv>=1.0.1",
"mkdocs>=1.5.3",
"mkdocs-material>=9.5.15",
"typer>=0.9.0",
"mkdocstrings[python]>=0.24.1",
"pytest>=8.1.1",
"tomli>=2.0.1",
]
[tool.rye.scripts]
docs = "mkdocs serve"
docs-build = "mkdocs build"

[tool.hatch.metadata]
allow-direct-references = true

[tool.hatch.build.targets.wheel]
packages = ["src/pypaystack2"]
129 changes: 0 additions & 129 deletions requirements-dev.lock

This file was deleted.

31 changes: 0 additions & 31 deletions requirements.lock

This file was deleted.

2 changes: 1 addition & 1 deletion src/pypaystack2/_metadata.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__title__ = "pypaystack2"
__version__ = "2.0.3"
__version__ = "2.1.0"
__author__ = [{"name": "Gbenga Adeyi", "email": "adeyigbenga005@gmail.com"}]
__license__ = "MIT"
__copyright__ = "Copyright 2023."
14 changes: 10 additions & 4 deletions src/pypaystack2/api/apple_pay.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ def get_domains(
def unregister_domain(self, domain_name: str) -> Response:
"""Unregister a top-level domain or subdomain previously used for your Apple Pay integration.
Args:
domain_name: Domain name to be unregistered
Note
* This feature is available to businesses in all markets except South Africa.
Expand Down Expand Up @@ -140,11 +143,14 @@ async def get_domains(
async def unregister_domain(self, domain_name: str) -> Response:
"""Unregister a top-level domain or subdomain previously used for your Apple Pay integration.
Note
* This feature is available to businesses in all markets except South Africa.
Args:
domain_name: Domain name to be unregistered
Returns:
A named tuple containing the response gotten from paystack's server.
Note
* This feature is available to businesses in all markets except South Africa.
Returns:
A named tuple containing the response gotten from paystack's server.
"""

url = self._parse_url("/apple-pay/domain")
Expand Down
6 changes: 3 additions & 3 deletions src/pypaystack2/api/payment_pages.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Optional
from typing import Optional, Any

from pypaystack2.baseapi import BaseAPI, BaseAsyncAPI
from pypaystack2.utils import add_to_payload, append_query_params, HTTPMethod, Response
Expand All @@ -18,7 +18,7 @@ def create(
amount: Optional[int] = None,
split_code: Optional[str] = None,
slug: Optional[str] = None,
metadata: Optional[str] = None,
metadata: Optional[dict[str, Any]] = None,
redirect_url: Optional[str] = None,
custom_fields: Optional[list] = None,
) -> Response:
Expand Down Expand Up @@ -180,7 +180,7 @@ async def create(
amount: Optional[int] = None,
split_code: Optional[str] = None,
slug: Optional[str] = None,
metadata: Optional[str] = None,
metadata: Optional[dict[str, Any]] = None,
redirect_url: Optional[str] = None,
custom_fields: Optional[list] = None,
) -> Response:
Expand Down
18 changes: 14 additions & 4 deletions src/pypaystack2/api/payment_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ def update(
amount: int,
due_date: Optional[str] = None,
description: Optional[str] = None,
line_items: Optional[list[dict]] = None,
tax: Optional[list[dict]] = None,
line_items: Optional[list[LineItem]] = None,
tax: Optional[list[Tax]] = None,
currency: Optional[Currency] = None,
send_notification: Optional[bool] = None,
draft: Optional[bool] = None,
Expand Down Expand Up @@ -226,6 +226,11 @@ def update(

amount = validate_amount(amount)

if line_items:
line_items = [item.dict for item in line_items]
if tax:
tax = [unit_tax.dict for unit_tax in tax]

url = self._parse_url(f"/paymentrequest/{id_or_code}")
payload = {
"customer": customer,
Expand Down Expand Up @@ -437,8 +442,8 @@ async def update(
amount: int,
due_date: Optional[str] = None,
description: Optional[str] = None,
line_items: Optional[list[dict]] = None,
tax: Optional[list[dict]] = None,
line_items: Optional[list[LineItem]] = None,
tax: Optional[list[Tax]] = None,
currency: Optional[Currency] = None,
send_notification: Optional[bool] = None,
draft: Optional[bool] = None,
Expand Down Expand Up @@ -470,6 +475,11 @@ async def update(

amount = validate_amount(amount)

if line_items:
line_items = [item.dict for item in line_items]
if tax:
tax = [unit_tax.dict for unit_tax in tax]

url = self._parse_url(f"/paymentrequest/{id_or_code}")
payload = {
"customer": customer,
Expand Down
4 changes: 2 additions & 2 deletions src/pypaystack2/api/splits.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def add_or_update(self, id: str, subaccount: str, share: int) -> Response:
share = validate_amount(share)
payload = {"subaccount": subaccount, "share": share}
url = self._parse_url(f"/split/{id}/subaccount/add")
return self._handle_request("POST", url, payload)
return self._handle_request(HTTPMethod.POST, url, payload)

def remove(self, id: str, subaccount: str) -> Response:
"""Remove a subaccount from a transaction split
Expand Down Expand Up @@ -339,7 +339,7 @@ async def add_or_update(self, id: str, subaccount: str, share: int) -> Response:
share = validate_amount(share)
payload = {"subaccount": subaccount, "share": share}
url = self._parse_url(f"/split/{id}/subaccount/add")
return await self._handle_request("POST", url, payload)
return await self._handle_request(HTTPMethod.POST, url, payload)

async def remove(self, id: str, subaccount: str) -> Response:
"""Remove a subaccount from a transaction split
Expand Down
Loading

0 comments on commit b50b013

Please sign in to comment.