python-nicepay


Namepython-nicepay JSON
Version 1.0.2 PyPI version JSON
download
home_pagehttps://github.com/nicepay-dev/python-nicepay
SummaryThis is the Official Python API client / library for NICEPAY Payment API
upload_time2024-12-19 18:48:45
maintainerNone
docs_urlNone
authorHarfa Thandila
requires_pythonNone
licenseNone
keywords pypi config nicepay
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## PYTHON - NICEPAY

NICEPAY ❤️ Python!

This is the Official Python API client / library for NICEPAY Payment API. Visit [Python Library](https://github.com/nicepay-dev/python-nicepay).
More information about the product and see documentation at [NICEPAY Docs](https://docs.nicepay.co.id/) for more technical details.

This library provides access to Nicepay BI SNAP and V2 APIs.
- `SNAP`
- `v2 Enterprise`
- `v2 professional`

## 1. Installation
You can clone or [download](https://github.com/nicepay-dev/python-nicepay) our source code, then import the folder manually into your project.
#####
Clone Repository :
```bash
git clone https://github.com/nicepay-dev/python-nicepay.git
```

#### 1.1 Requirement 
**Language :** 
Python `v.3.11.9`

**Library :**

- `pycryptodome`
- `requests`


## 2. Usage
Get your credentials from [Nicepay Dashboard](http://103.20.51.40:8012/logIn.do)
initialize Nicepay config

#### 2.1 Client Initialization and Configuration

Credentials used here are for testing purposes only [snap]
```bash
_CLIENT_KEY = "IONPAYTEST"
_PRIVATE_KEY = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAInJe1G22R2fMchIE6BjtYRqyMj6lurP/zq6vy79WaiGKt0Fxs4q3Ab4ifmOXd97ynS5f0JRfIqakXDcV/e2rx9bFdsS2HORY7o5At7D5E3tkyNM9smI/7dk8d3O0fyeZyrmPMySghzgkR3oMEDW1TCD5q63Hh/oq0LKZ/4Jjcb9AgMBAAECgYA4Boz2NPsjaE+9uFECrohoR2NNFVe4Msr8/mIuoSWLuMJFDMxBmHvO+dBggNr6vEMeIy7zsF6LnT32PiImv0mFRY5fRD5iLAAlIdh8ux9NXDIHgyera/PW4nyMaz2uC67MRm7uhCTKfDAJK7LXqrNVDlIBFdweH5uzmrPBn77foQJBAMPCnCzR9vIfqbk7gQaA0hVnXL3qBQPMmHaeIk0BMAfXTVq37PUfryo+80XXgEP1mN/e7f10GDUPFiVw6Wfwz38CQQC0L+xoxraftGnwFcVN1cK/MwqGS+DYNXnddo7Hu3+RShUjCz5E5NzVWH5yHu0E0Zt3sdYD2t7u7HSr9wn96OeDAkEApzB6eb0JD1kDd3PeilNTGXyhtIE9rzT5sbT0zpeJEelL44LaGa/pxkblNm0K2v/ShMC8uY6Bbi9oVqnMbj04uQJAJDIgTmfkla5bPZRR/zG6nkf1jEa/0w7i/R7szaiXlqsIFfMTPimvRtgxBmG6ASbOETxTHpEgCWTMhyLoCe54WwJATmPDSXk4APUQNvX5rr5OSfGWEOo67cKBvp5Wst+tpvc6AbIJeiRFlKF4fXYTb6HtiuulgwQNePuvlzlt2Q8hqQ=="
_CLIENT_SECRET = "33F49GnCMS1mFYlGXisbUDzVf2ATWCl9k3R++d5hDd3Frmuos/XLx8XhXpe+LDYAbpGKZYSwtlyyLOtS/8aD7A=="
```

#### 2.2 Request for Access-Token
```bash
from data.builder.snap import builderAccessToken
from service.snapService import SnapService

class testAccessToken:
    bodyCreateToken = (
        builderAccessToken.BuildAccessToken()
        .setGrantType("client_credentials")
        .setAdditionalInfo("")
        .build()
    )

Result = SnapService.serviceOAUTH(bodyCreateToken.jsonAccessToken())
```
Here's the result 
```bash
AccessToken : eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJJT05QQVlURVNUIiwiaXNzIjoiTklDRVBBWSIsIm5hbWUiOiJCRElOIiwiZXhwIjoiMjAyNC0xMS0xMlQyMDowNTo1NFoifQ==.RfeDzCn7sk5VT54f8NTPnbbeQvaPmQg6wtLWXIbmBCI=
```

#### 2.3 Request for Generate VA (i.e. Virtual Account)
```bash
from data.builder.snap import builderVirtualAccount
from data.builder.snap import builderAccessToken
from constants.constantsEndpoint import ConstantsEndpoints
from service.snapService import SnapService
from util.utilLogging import Log

log = Log()

class testVirtualAccount:
    bodyCreateToken = (
        builderAccessToken.BuildAccessToken()
        .setGrantType("client_credentials")
        .setAdditionalInfo("")
        .build()
    )

    totalAmount = {"value": "10000.00",
                   "currency": "IDR"
                   }

    additionalInfo = {"bankCd": "BRIN",
                      "goodsNm": "Merchant Goods 1",
                      "dbProcessUrl": "https://webhook.site/e15ef201-98a9-428c-85d4-a0c6458939c3",
                      "vacctValidDt": "",
                      "vacctValidTm": "",
                      "msId": "",
                      "msFee": "",
                      "msFeeType": "",
                      "mbFee": "",
                      "mbFeeType": ""
                      }

    bodyCreateVA = (
        builderVirtualAccount.BuildCreateVA()
        .setPartnerServiceId("")
        .setCustomerNo("")
        .setVirtualAccountNo("")
        .setVirtualAccountName("John Doe")
        .setTrxId("123")
        .setTotalAmount(totalAmount)
        .setAdditionalInfo(additionalInfo)
        .build()
    )

    result = SnapService.serviceTransaction(bodyCreateToken.jsonAccessToken(),
                                            bodyCreateVA.jsonVACreate(),
                                            ConstantsEndpoints.createVA())
```
Here's the result 
```bash
body request :
{"partnerServiceId": "", "customerNo": "", "virtualAccountNo": "", "virtualAccountName": "John Doe", "trxId": "123", "totalAmount": {"value": "10000.00", "currency": "IDR"}, "additionalInfo": {"bankCd": "BRIN", "goodsNm": "Merchant Goods 1", "dbProcessUrl": "https://webhook.site/e15ef201-98a9-428c-85d4-a0c6458939c3", "vacctValidDt": "", "vacctValidTm": "", "msId": "", "msFee": "", "msFeeType": "", "mbFee": "", "mbFeeType": ""}}

body response :
{"responseCode": "2002700", "responseMessage": "Successful", "virtualAccountData": {"partnerServiceId": "", "customerNo": "", "virtualAccountNo": "884800040254370152", "virtualAccountName": "John Doe", "trxId": "123", "totalAmount": {"value": "10000.00", "currency": "IDR"}, "additionalInfo": {"msId": "", "msFee": "", "msFeeType": "", "mbFee": "", "mbFeeType": "", "bankCd": "BRIN", "tXidVA": "IONPAYTEST02202411130254370152", "goodsNm": "Merchant Goods 1", "vacctValidDt": "20241115", "vacctValidTm": "025437"}}}
```
#### 2.4 Verify Signature 
- Import
```bash
import hashlib
import hmac
from Crypto.Hash import SHA256
from Crypto.PublicKey import RSA
from Crypto.Signature import PKCS1_v1_5
from util.utilLogging import Log
```

- for Access Token
```bash
class Signature:
    log = Log()

    @staticmethod
    def signSHA256RSA(stringToSign, privateKey):
        try:
            b1 = base64.b64decode(privateKey)
            key = RSA.importKey(b1)
            signer = PKCS1_v1_5.new(key)
            digest = SHA256.new()
            digest.update(stringToSign.encode('utf-8'))
            signature = signer.sign(digest)
            hexSignature = base64.b64encode(signature).decode('utf-8')
            return hexSignature
        except Exception as e:
            Signature.log.error("Error Generate Signature:" + e)
            return ''


@staticmethod
    def sha256EncodeHex(data):
        sha256Hash = hashlib.sha256(data.encode('utf-8')).digest()
        hexEncoded = sha256Hash.hex()
        return hexEncoded
```
- for Signature Service
```bash
@staticmethod
    def getSignature(accessToken, requestBody, endpoint, timestamp, staticKey, httpMethod):
        Signature.log.info("util - Request Endpoint : " + endpoint)
        data = f"{httpMethod}:{endpoint}:{accessToken}:{requestBody}:{timestamp}"
        Signature.log.info("util - StringDataToSign: " + data)
        try:
            sign = Signature.hmacSHA512EncodeBase64(staticKey, data)
            Signature.log.info("util - Signature: " + sign)
            return sign
        except:
            Signature.log.error("Error Generate Signature - getSignature")

 @staticmethod
    def hmacSHA512EncodeBase64(key, data):
        hmacObj = hmac.new(key.encode('utf-8'), data.encode('utf-8'), hashlib.sha512)
        hmacBytes = hmacObj.digest()
        base64Encoded = base64.b64encode(hmacBytes).decode('utf-8')
        return base64Encoded
```
Here's the result
```bash
StringDataToSign: POST:/api/v1.0/transfer-va/create-va:eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJJT05QQVlURVNUIiwiaXNzIjoiTklDRVBBWSIsIm5hbWUiOiJCRElOIiwiZXhwIjoiMjAyNC0xMS0xMlQyMDowOTozN1oifQ==.4djzd9Z1jZE8AXkFRmCrxm8IMfdhuk2RjFz0LSzRXIY=:d04af00b1f17c7045dde178f377b77e385a3d6cecd22fe6822de1ee053489078:2024-11-13T02:54:37+07:00

Signature: w7BpJ392jzRkAgvWC79Zawvztm/l1D+bxIJWgGq59xih0SuAi4PoTtUAUIXcOLuvZ3pYaSs8Mc1QZxhbVMMBqQ==
```

You can view a code example in the following **[UtilSignature.py](https://github.com/nicepay-dev/python-nicepay/blob/main/util/utilSignature.py)** class.
## 3. Other Sample

Integration test are available for SNAP :
- [Virtual Account Regist Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/snap/testVirtualAccount.py)
- [Virtual Account Inquiry Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/snap/testVirtualAccountInquiry.py)
- [Virtual Account Cancel Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/snap/testVirtualAccountCancel.py)
- [E-Wallet Regist Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/snap/testDirectDebit.py)
- [E-Wallet Inquiry Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/snap/testDirectDebitInquiry.py)
- [E-Wallet Refund Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/snap/testDirectDebitRefund.py)
- [Qris Regist Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/snap/testQris.py)
- [Qris Inquiry Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/snap/testQrisInquiry.py)
- [Qris Refund Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/snap/testQrisRefund.py)
- [Payout Regist Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/snap/testPayout.py)
- [Payout Inquiry Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/snap/testPayoutInquiry.py)
- [Payout Approve Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/snap/testPayoutApprove.py)
- [Payout Reject Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/snap/testPayoutReject.py)
- [Payout Cancel Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/snap/testPayoutReject.py)
- [Payout Balance Inquiry Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/snap/testPayoutBalanceInquiry.py)

##### Integration test are available for V2 APIs :
- [Virtual Account V2 Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/v2/enterprise/testVirtualAccount.py)
- [Inquiry V2 Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/v2/enterprise/testInquiry.py)
- [Payment V2 Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/v2/enterprise/testPayment.py)
- [Cancel V2 Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/v2/enterprise/testCancel.py)

or you can view a example in the following [V2 APIs](https://github.com/nicepay-dev/python-nicepay/tree/main/test/v2)

## 4. Get Help
- [Nicepay Docs](https://docs.nicepay.co.id/)
- [Nicepay Dashboard](http://103.20.51.40:8012/logIn.do)
- [SNAP documentation](https://docs.nicepay.co.id/nicepay-api-snap)
- [V2 Enterprise documentation](https://docs.nicepay.co.id/nicepay-api-v2-payment-api)
- [V2 Professional documentation](https://docs.nicepay.co.id/nicepay-api-v2-checkout-api)


Can't find answer you looking for? email to `cs@nicepay.co.id`

**Thank you and Have a NICEPAY!** 

![Logo](https://nicepay.co.id/wp-content/uploads/2019/09/logo-150.svg )


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/nicepay-dev/python-nicepay",
    "name": "python-nicepay",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "pypi, config, nicepay",
    "author": "Harfa Thandila",
    "author_email": "harfa.thandila@nicepay.co.id",
    "download_url": "https://files.pythonhosted.org/packages/f5/cc/cab7f276b12496266f146f10eb8350b269ae66adabb6eee2f98059b0cd43/python-nicepay-1.0.2.tar.gz",
    "platform": null,
    "description": "## PYTHON - NICEPAY\r\n\r\nNICEPAY \u2764\ufe0f Python!\r\n\r\nThis is the Official Python API client / library for NICEPAY Payment API. Visit [Python Library](https://github.com/nicepay-dev/python-nicepay).\r\nMore information about the product and see documentation at [NICEPAY Docs](https://docs.nicepay.co.id/) for more technical details.\r\n\r\nThis library provides access to Nicepay BI SNAP and V2 APIs.\r\n- `SNAP`\r\n- `v2 Enterprise`\r\n- `v2 professional`\r\n\r\n## 1. Installation\r\nYou can clone or [download](https://github.com/nicepay-dev/python-nicepay) our source code, then import the folder manually into your project.\r\n#####\r\nClone Repository :\r\n```bash\r\ngit clone https://github.com/nicepay-dev/python-nicepay.git\r\n```\r\n\r\n#### 1.1 Requirement \r\n**Language :** \r\nPython `v.3.11.9`\r\n\r\n**Library :**\r\n\r\n- `pycryptodome`\r\n- `requests`\r\n\r\n\r\n## 2. Usage\r\nGet your credentials from [Nicepay Dashboard](http://103.20.51.40:8012/logIn.do)\r\ninitialize Nicepay config\r\n\r\n#### 2.1 Client Initialization and Configuration\r\n\r\nCredentials used here are for testing purposes only [snap]\r\n```bash\r\n_CLIENT_KEY = \"IONPAYTEST\"\r\n_PRIVATE_KEY = \"MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAInJe1G22R2fMchIE6BjtYRqyMj6lurP/zq6vy79WaiGKt0Fxs4q3Ab4ifmOXd97ynS5f0JRfIqakXDcV/e2rx9bFdsS2HORY7o5At7D5E3tkyNM9smI/7dk8d3O0fyeZyrmPMySghzgkR3oMEDW1TCD5q63Hh/oq0LKZ/4Jjcb9AgMBAAECgYA4Boz2NPsjaE+9uFECrohoR2NNFVe4Msr8/mIuoSWLuMJFDMxBmHvO+dBggNr6vEMeIy7zsF6LnT32PiImv0mFRY5fRD5iLAAlIdh8ux9NXDIHgyera/PW4nyMaz2uC67MRm7uhCTKfDAJK7LXqrNVDlIBFdweH5uzmrPBn77foQJBAMPCnCzR9vIfqbk7gQaA0hVnXL3qBQPMmHaeIk0BMAfXTVq37PUfryo+80XXgEP1mN/e7f10GDUPFiVw6Wfwz38CQQC0L+xoxraftGnwFcVN1cK/MwqGS+DYNXnddo7Hu3+RShUjCz5E5NzVWH5yHu0E0Zt3sdYD2t7u7HSr9wn96OeDAkEApzB6eb0JD1kDd3PeilNTGXyhtIE9rzT5sbT0zpeJEelL44LaGa/pxkblNm0K2v/ShMC8uY6Bbi9oVqnMbj04uQJAJDIgTmfkla5bPZRR/zG6nkf1jEa/0w7i/R7szaiXlqsIFfMTPimvRtgxBmG6ASbOETxTHpEgCWTMhyLoCe54WwJATmPDSXk4APUQNvX5rr5OSfGWEOo67cKBvp5Wst+tpvc6AbIJeiRFlKF4fXYTb6HtiuulgwQNePuvlzlt2Q8hqQ==\"\r\n_CLIENT_SECRET = \"33F49GnCMS1mFYlGXisbUDzVf2ATWCl9k3R++d5hDd3Frmuos/XLx8XhXpe+LDYAbpGKZYSwtlyyLOtS/8aD7A==\"\r\n```\r\n\r\n#### 2.2 Request for Access-Token\r\n```bash\r\nfrom data.builder.snap import builderAccessToken\r\nfrom service.snapService import SnapService\r\n\r\nclass testAccessToken:\r\n    bodyCreateToken = (\r\n        builderAccessToken.BuildAccessToken()\r\n        .setGrantType(\"client_credentials\")\r\n        .setAdditionalInfo(\"\")\r\n        .build()\r\n    )\r\n\r\nResult = SnapService.serviceOAUTH(bodyCreateToken.jsonAccessToken())\r\n```\r\nHere's the result \r\n```bash\r\nAccessToken : eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJJT05QQVlURVNUIiwiaXNzIjoiTklDRVBBWSIsIm5hbWUiOiJCRElOIiwiZXhwIjoiMjAyNC0xMS0xMlQyMDowNTo1NFoifQ==.RfeDzCn7sk5VT54f8NTPnbbeQvaPmQg6wtLWXIbmBCI=\r\n```\r\n\r\n#### 2.3 Request for Generate VA (i.e. Virtual Account)\r\n```bash\r\nfrom data.builder.snap import builderVirtualAccount\r\nfrom data.builder.snap import builderAccessToken\r\nfrom constants.constantsEndpoint import ConstantsEndpoints\r\nfrom service.snapService import SnapService\r\nfrom util.utilLogging import Log\r\n\r\nlog = Log()\r\n\r\nclass testVirtualAccount:\r\n    bodyCreateToken = (\r\n        builderAccessToken.BuildAccessToken()\r\n        .setGrantType(\"client_credentials\")\r\n        .setAdditionalInfo(\"\")\r\n        .build()\r\n    )\r\n\r\n    totalAmount = {\"value\": \"10000.00\",\r\n                   \"currency\": \"IDR\"\r\n                   }\r\n\r\n    additionalInfo = {\"bankCd\": \"BRIN\",\r\n                      \"goodsNm\": \"Merchant Goods 1\",\r\n                      \"dbProcessUrl\": \"https://webhook.site/e15ef201-98a9-428c-85d4-a0c6458939c3\",\r\n                      \"vacctValidDt\": \"\",\r\n                      \"vacctValidTm\": \"\",\r\n                      \"msId\": \"\",\r\n                      \"msFee\": \"\",\r\n                      \"msFeeType\": \"\",\r\n                      \"mbFee\": \"\",\r\n                      \"mbFeeType\": \"\"\r\n                      }\r\n\r\n    bodyCreateVA = (\r\n        builderVirtualAccount.BuildCreateVA()\r\n        .setPartnerServiceId(\"\")\r\n        .setCustomerNo(\"\")\r\n        .setVirtualAccountNo(\"\")\r\n        .setVirtualAccountName(\"John Doe\")\r\n        .setTrxId(\"123\")\r\n        .setTotalAmount(totalAmount)\r\n        .setAdditionalInfo(additionalInfo)\r\n        .build()\r\n    )\r\n\r\n    result = SnapService.serviceTransaction(bodyCreateToken.jsonAccessToken(),\r\n                                            bodyCreateVA.jsonVACreate(),\r\n                                            ConstantsEndpoints.createVA())\r\n```\r\nHere's the result \r\n```bash\r\nbody request :\r\n{\"partnerServiceId\": \"\", \"customerNo\": \"\", \"virtualAccountNo\": \"\", \"virtualAccountName\": \"John Doe\", \"trxId\": \"123\", \"totalAmount\": {\"value\": \"10000.00\", \"currency\": \"IDR\"}, \"additionalInfo\": {\"bankCd\": \"BRIN\", \"goodsNm\": \"Merchant Goods 1\", \"dbProcessUrl\": \"https://webhook.site/e15ef201-98a9-428c-85d4-a0c6458939c3\", \"vacctValidDt\": \"\", \"vacctValidTm\": \"\", \"msId\": \"\", \"msFee\": \"\", \"msFeeType\": \"\", \"mbFee\": \"\", \"mbFeeType\": \"\"}}\r\n\r\nbody response :\r\n{\"responseCode\": \"2002700\", \"responseMessage\": \"Successful\", \"virtualAccountData\": {\"partnerServiceId\": \"\", \"customerNo\": \"\", \"virtualAccountNo\": \"884800040254370152\", \"virtualAccountName\": \"John Doe\", \"trxId\": \"123\", \"totalAmount\": {\"value\": \"10000.00\", \"currency\": \"IDR\"}, \"additionalInfo\": {\"msId\": \"\", \"msFee\": \"\", \"msFeeType\": \"\", \"mbFee\": \"\", \"mbFeeType\": \"\", \"bankCd\": \"BRIN\", \"tXidVA\": \"IONPAYTEST02202411130254370152\", \"goodsNm\": \"Merchant Goods 1\", \"vacctValidDt\": \"20241115\", \"vacctValidTm\": \"025437\"}}}\r\n```\r\n#### 2.4 Verify Signature \r\n- Import\r\n```bash\r\nimport hashlib\r\nimport hmac\r\nfrom Crypto.Hash import SHA256\r\nfrom Crypto.PublicKey import RSA\r\nfrom Crypto.Signature import PKCS1_v1_5\r\nfrom util.utilLogging import Log\r\n```\r\n\r\n- for Access Token\r\n```bash\r\nclass Signature:\r\n    log = Log()\r\n\r\n    @staticmethod\r\n    def signSHA256RSA(stringToSign, privateKey):\r\n        try:\r\n            b1 = base64.b64decode(privateKey)\r\n            key = RSA.importKey(b1)\r\n            signer = PKCS1_v1_5.new(key)\r\n            digest = SHA256.new()\r\n            digest.update(stringToSign.encode('utf-8'))\r\n            signature = signer.sign(digest)\r\n            hexSignature = base64.b64encode(signature).decode('utf-8')\r\n            return hexSignature\r\n        except Exception as e:\r\n            Signature.log.error(\"Error Generate Signature:\" + e)\r\n            return ''\r\n\r\n\r\n@staticmethod\r\n    def sha256EncodeHex(data):\r\n        sha256Hash = hashlib.sha256(data.encode('utf-8')).digest()\r\n        hexEncoded = sha256Hash.hex()\r\n        return hexEncoded\r\n```\r\n- for Signature Service\r\n```bash\r\n@staticmethod\r\n    def getSignature(accessToken, requestBody, endpoint, timestamp, staticKey, httpMethod):\r\n        Signature.log.info(\"util - Request Endpoint : \" + endpoint)\r\n        data = f\"{httpMethod}:{endpoint}:{accessToken}:{requestBody}:{timestamp}\"\r\n        Signature.log.info(\"util - StringDataToSign: \" + data)\r\n        try:\r\n            sign = Signature.hmacSHA512EncodeBase64(staticKey, data)\r\n            Signature.log.info(\"util - Signature: \" + sign)\r\n            return sign\r\n        except:\r\n            Signature.log.error(\"Error Generate Signature - getSignature\")\r\n\r\n @staticmethod\r\n    def hmacSHA512EncodeBase64(key, data):\r\n        hmacObj = hmac.new(key.encode('utf-8'), data.encode('utf-8'), hashlib.sha512)\r\n        hmacBytes = hmacObj.digest()\r\n        base64Encoded = base64.b64encode(hmacBytes).decode('utf-8')\r\n        return base64Encoded\r\n```\r\nHere's the result\r\n```bash\r\nStringDataToSign: POST:/api/v1.0/transfer-va/create-va:eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJJT05QQVlURVNUIiwiaXNzIjoiTklDRVBBWSIsIm5hbWUiOiJCRElOIiwiZXhwIjoiMjAyNC0xMS0xMlQyMDowOTozN1oifQ==.4djzd9Z1jZE8AXkFRmCrxm8IMfdhuk2RjFz0LSzRXIY=:d04af00b1f17c7045dde178f377b77e385a3d6cecd22fe6822de1ee053489078:2024-11-13T02:54:37+07:00\r\n\r\nSignature: w7BpJ392jzRkAgvWC79Zawvztm/l1D+bxIJWgGq59xih0SuAi4PoTtUAUIXcOLuvZ3pYaSs8Mc1QZxhbVMMBqQ==\r\n```\r\n\r\nYou can view a code example in the following **[UtilSignature.py](https://github.com/nicepay-dev/python-nicepay/blob/main/util/utilSignature.py)** class.\r\n## 3. Other Sample\r\n\r\nIntegration test are available for SNAP :\r\n- [Virtual Account Regist Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/snap/testVirtualAccount.py)\r\n- [Virtual Account Inquiry Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/snap/testVirtualAccountInquiry.py)\r\n- [Virtual Account Cancel Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/snap/testVirtualAccountCancel.py)\r\n- [E-Wallet Regist Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/snap/testDirectDebit.py)\r\n- [E-Wallet Inquiry Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/snap/testDirectDebitInquiry.py)\r\n- [E-Wallet Refund Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/snap/testDirectDebitRefund.py)\r\n- [Qris Regist Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/snap/testQris.py)\r\n- [Qris Inquiry Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/snap/testQrisInquiry.py)\r\n- [Qris Refund Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/snap/testQrisRefund.py)\r\n- [Payout Regist Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/snap/testPayout.py)\r\n- [Payout Inquiry Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/snap/testPayoutInquiry.py)\r\n- [Payout Approve Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/snap/testPayoutApprove.py)\r\n- [Payout Reject Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/snap/testPayoutReject.py)\r\n- [Payout Cancel Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/snap/testPayoutReject.py)\r\n- [Payout Balance Inquiry Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/snap/testPayoutBalanceInquiry.py)\r\n\r\n##### Integration test are available for V2 APIs :\r\n- [Virtual Account V2 Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/v2/enterprise/testVirtualAccount.py)\r\n- [Inquiry V2 Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/v2/enterprise/testInquiry.py)\r\n- [Payment V2 Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/v2/enterprise/testPayment.py)\r\n- [Cancel V2 Unit Test](https://github.com/nicepay-dev/python-nicepay/blob/main/test/v2/enterprise/testCancel.py)\r\n\r\nor you can view a example in the following [V2 APIs](https://github.com/nicepay-dev/python-nicepay/tree/main/test/v2)\r\n\r\n## 4. Get Help\r\n- [Nicepay Docs](https://docs.nicepay.co.id/)\r\n- [Nicepay Dashboard](http://103.20.51.40:8012/logIn.do)\r\n- [SNAP documentation](https://docs.nicepay.co.id/nicepay-api-snap)\r\n- [V2 Enterprise documentation](https://docs.nicepay.co.id/nicepay-api-v2-payment-api)\r\n- [V2 Professional documentation](https://docs.nicepay.co.id/nicepay-api-v2-checkout-api)\r\n\r\n\r\nCan't find answer you looking for? email to `cs@nicepay.co.id`\r\n\r\n**Thank you and Have a NICEPAY!** \r\n\r\n![Logo](https://nicepay.co.id/wp-content/uploads/2019/09/logo-150.svg )\r\n\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "This is the Official Python API client / library for NICEPAY Payment API",
    "version": "1.0.2",
    "project_urls": {
        "Documentation": "https://github.com/nicepay-dev/python-nicepay/blob/main/README.md",
        "Homepage": "https://github.com/nicepay-dev/python-nicepay",
        "Source": "https://github.com/nicepay-dev/python-nicepay"
    },
    "split_keywords": [
        "pypi",
        " config",
        " nicepay"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7f93b9376f83920e80dad10f959503a846180293d88e130340c9da5e3da15312",
                "md5": "4a896655fc768fd407604942cede0b6d",
                "sha256": "7722f10e7a980f83112dd88fd7824a2b12680652d530f8a853042717f1ed994e"
            },
            "downloads": -1,
            "filename": "python_nicepay-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4a896655fc768fd407604942cede0b6d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 4930,
            "upload_time": "2024-12-19T18:48:41",
            "upload_time_iso_8601": "2024-12-19T18:48:41.889061Z",
            "url": "https://files.pythonhosted.org/packages/7f/93/b9376f83920e80dad10f959503a846180293d88e130340c9da5e3da15312/python_nicepay-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f5cccab7f276b12496266f146f10eb8350b269ae66adabb6eee2f98059b0cd43",
                "md5": "0cfc45b364537385e93bf744fdd2ff4d",
                "sha256": "db13d299619bd70914ed095c6e7b5456cfb786d9df0c6830b3645e79e3dd8273"
            },
            "downloads": -1,
            "filename": "python-nicepay-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "0cfc45b364537385e93bf744fdd2ff4d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5241,
            "upload_time": "2024-12-19T18:48:45",
            "upload_time_iso_8601": "2024-12-19T18:48:45.370114Z",
            "url": "https://files.pythonhosted.org/packages/f5/cc/cab7f276b12496266f146f10eb8350b269ae66adabb6eee2f98059b0cd43/python-nicepay-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-19 18:48:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "nicepay-dev",
    "github_project": "python-nicepay",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "python-nicepay"
}
        
Elapsed time: 0.46246s