Skip to main content

`django-thorbanks` 为爱沙尼亚银行链接(iPizza 协议)提供了一个 Django 应用程序。

项目描述

django-thorbanks

构建状态 覆盖状态 PyPI 发布

用于将爱沙尼亚银行链接集成到您的项目中的 Django 应用程序。

特征

银行 协议 验证 支付
瑞典银行 披萨 :heavy_check_mark: :heavy_check_mark:
SEB 披萨 :heavy_check_mark: :heavy_check_mark:
丹麦 披萨 :heavy_check_mark: :heavy_check_mark:
低压 披萨 :heavy_check_mark: :heavy_check_mark:
克雷迪迪潘克 披萨 :heavy_check_mark: :heavy_check_mark:
北欧 披萨 :heavy_check_mark: :heavy_check_mark:

用法

1.安装它:

点:

pip install django-thorbanks

管道:

pipenv install django-thorbanks

诗歌:

poetry add django-thorbanks

2.添加到已安装的应用程序

INSTALLED_APPS = (
    # Add the following apps:
    "thorbanks",
    "thorbanks_models",
)

3. 配置和创建迁移:

使用 MANUAL_MODELS:

使用默认模型:

通过 settings.MIGRATION_MODULES 让 django 知道 thorbanks 迁移位于本地应用程序文件夹中:

注意:替换shop为项目中现有应用的名称。

# Tell django that thorbanks_models migrations are in shop app (in thorbanks_migrations module)
MIGRATION_MODULES = {"thorbanks_models": "shop.thorbanks_migrations"}

现在运行makemigrations thorbanks_modelsmigrate管理命令来创建和应用迁移。

4.添加设置.BANKLINKS

有关工作示例,请参见example/settings.py中的定义。

注意:每个银行集成都需要一个公钥和私钥。如果您没有公钥,您可以通过以下方式从证书中生成一个:

openssl x509 -pubkey -noout -in cert.pem  > pubkey.pem

5. 将交易链接到您的订单模型

注意:使用 MANUAL_MODELS 时,请替换thorbanks_models为您的本地应用名称

class Order(models.Model):
    # ... other fields
    transaction = models.OneToOneField(
        "thorbanks_models.Transaction", null=True, on_delete=models.SET_NULL
    )

6. 包括 thorbanks 网址

urlpatterns = [
    # This is where the user will be redirected after returning from the banklink page
    url(r"^banks/", include("thorbanks.urls")),
]

7. 添加监听器到银行链接成功和失败回调:

请参阅example.shop.models.banklink_success_callbackexample.shop.models.banklink_failed_callback

8. 创建付款视图和表单:

请参阅example.shop.viewsexample.shop.forms

iPizza 协议

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

django-thorbanks-0.6.2.tar.gz (42.1 kB 查看哈希)

已上传 source

内置分布

django_thorbanks-0.6.2-py3-none-any.whl (47.8 kB 查看哈希)

已上传 py3