Skip to main content

This library purpose is helper for dinger payment encryption

Project description

Dinger Prebuild Checkout From for generate URL

Usage

import json
from urllib.parse import urlencode, quote_plus

from dinger_payment import get_prebuild_form_url

if __name__ == '__main__':
    items = [
        {"name": "DiorAct Sandal", "amount": 250, "quantity": 1},
        {"name": "Aime Leon Dore", "amount": 250, "quantity": 1},
    ]
    data = {
        # items must be string
        "items": json.dumps(items),
        "customerName": "James",
        "totalAmount": 500,
        "merchantOrderId": "123456",
        # get from checkout-form page
        "clientId": "xxxx",
        # get from data-dashboard page
        "publicKey": "xxxx",
        # get from data-dashboard page
        "merchantKey": "xxxx",
        # your project name
        "projectName": "xxxx",
        # your account username
        "merchantName": "xxxx",
    }
    secretkey = "xxxx"
    public_key = "-----BEGIN PUBLIC KEY-----\n"\
    + "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCFD4IL1suUt/TsJu6zScnvsEdLPuACgBdjX82QQf8NQlFHu2v/84dztaJEyljv3TGPuEgUftpC9OEOuEG29z7z1uOw7c9T/luRhgRrkH7AwOj4U1+eK3T1R+8LVYATtPCkqAAiomkTU+aC5Y2vfMInZMgjX0DdKMctUur8tQtvkwIDAQAB"\
    + "\n-----END PUBLIC KEY-----"
    encrypted_payload, hash_value = get_prebuild_form_url(public_key=public_key, secretkey=secretkey, **data)
    host = "form.dinger.asia" # for production
    # host = "prebuilt.dinger.asia" # for staging
    url = f"https://{host}?{urlencode({'payload': encrypted_payload, 'hashValue': hash_value}, quote_via=quote_plus)}"
    print(url)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dinger_payment-2.0.5.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dinger_payment-2.0.5-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file dinger_payment-2.0.5.tar.gz.

File metadata

  • Download URL: dinger_payment-2.0.5.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.1

File hashes

Hashes for dinger_payment-2.0.5.tar.gz
Algorithm Hash digest
SHA256 eeabf0bf1e54d0d879e7412d16f72389a0fe529c151821c2ed9bbe291363ec13
MD5 c0d8ae6c2d76faf1b7bae083d61fa45e
BLAKE2b-256 63ac870c3f9c1f8298047a6d71a86df17aa03784377d1a45966a6423d0c3d587

See more details on using hashes here.

File details

Details for the file dinger_payment-2.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for dinger_payment-2.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 9659df675951b055d3a3df16772c879368609142725347adcee565d3263eec93
MD5 a7557638cb725a6ffcb61deca1ca64ac
BLAKE2b-256 b7b4c839bd99c3584429477ceb17bea81eaa76768cf06c85eb6dd8e489a1c4c4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page