Skip to content

Commit 988b18b

Browse files
author
xendit-devx-bot
committed
Generated Xendit python SDK
1 parent 6c60b12 commit 988b18b

File tree

134 files changed

+3658
-120
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+3658
-120
lines changed

.github/workflows/generate-release-tag.yml

+58-3
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,67 @@ on:
44
types: [create-release-tag]
55

66
jobs:
7-
build:
7+
testing:
88
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python-version: ["3.10","3.11","3.12"]
912
steps:
1013
- uses: actions/checkout@v3
14+
15+
- name: Set up Python ${{ matrix.python-version }}
16+
uses: actions/setup-python@v4
17+
with:
18+
python-version: ${{ matrix.python-version }}
19+
cache: 'pip'
20+
21+
- name: Print python version
22+
run: python --version
23+
24+
- name: Install dependencies
25+
run: pip install -r requirements.txt
26+
27+
- name: Run test
28+
run: DEVELOPMENT_API_KEY=${{ secrets.DEVELOPMENT_API_KEY }} pytest -s --log-cli-level=DEBUG
29+
30+
send-test-result:
31+
name: Slack Notification
32+
needs: [testing]
33+
if: always() && (needs.testing.result == 'success' || needs.testing.result == 'failure')
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v3
37+
38+
- name: Set Slack Color
39+
id: set_color
40+
run: |
41+
if [ "${{ needs.testing.result }}" == "success" ]; then
42+
echo "color=good" >> $GITHUB_ENV
43+
else
44+
echo "color=danger" >> $GITHUB_ENV
45+
fi
46+
47+
- name: Send Slack Notification
48+
uses: rtCamp/action-slack-notify@v2
49+
env:
50+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
51+
SLACK_TITLE: "[xendi-python] CI pipeline for ${{ github.event.client_payload.version }}"
52+
SLACK_MESSAGE: 'Test Result: ${{ needs.testing.result }}'
53+
SLACK_COLOR: ${{ steps.set_color.outputs.color }}
54+
55+
publish-release-tag:
56+
runs-on: ubuntu-latest
57+
needs: [testing]
58+
steps:
59+
- uses: actions/checkout@v3
60+
1161
- name: Set the value in bash
1262
id: parse-changelog
1363
run: |
1464
echo "changelog<<EOF" >> "$GITHUB_OUTPUT"
1565
echo "${{ github.event.client_payload.changelog }}" | sed -e 's/%0A/\n/g' >> "$GITHUB_OUTPUT"
1666
echo "EOF" >> "$GITHUB_OUTPUT"
67+
1768
- name: Create Release
1869
id: create-release
1970
uses: actions/create-release@latest
@@ -27,7 +78,7 @@ jobs:
2778
prerelease: false
2879

2980
publish-pypi:
30-
needs: [build]
81+
needs: [publish-release-tag]
3182
runs-on: ubuntu-latest
3283
environment:
3384
name: pypi
@@ -36,16 +87,20 @@ jobs:
3687
id-token: write
3788
steps:
3889
- uses: actions/checkout@v3
90+
3991
- uses: actions/setup-python@v4
4092
with:
4193
python-version: '3.10'
94+
4295
- name: Install Poetry
4396
uses: abatilo/actions-poetry@v2
4497
with:
4598
poetry-version: '1.6.1'
99+
46100
- name: Build Package
47101
run: |
48102
poetry install
49103
poetry build
104+
50105
- name: Publish a Python distribution to PyPI
51-
uses: pypa/gh-action-pypi-publish@release/v1
106+
uses: pypa/gh-action-pypi-publish@release/v1

.gitignore

+1-4
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,4 @@ target/
6666
.ipynb_checkpoints
6767

6868
.vscode/
69-
test.py
70-
71-
# virtual environment
72-
xendit-python
69+
test.py

.openapi-generator/FILES

+10
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
.gitignore
44
LICENSE
55
README.md
6+
docs/Configuration.md
67
docs/PaymentRequestApi.md
78
docs/payment_request/Capture.md
89
docs/payment_request/CaptureList.md
@@ -31,10 +32,13 @@ docs/payment_request/EWalletChannelCode.md
3132
docs/payment_request/EWalletChannelProperties.md
3233
docs/payment_request/EWalletParameters.md
3334
docs/payment_request/Error.md
35+
docs/payment_request/InvoicePartnerMetadata.md
3436
docs/payment_request/OverTheCounter.md
3537
docs/payment_request/OverTheCounterChannelCode.md
3638
docs/payment_request/OverTheCounterChannelProperties.md
3739
docs/payment_request/OverTheCounterParameters.md
40+
docs/payment_request/PaymentCallback.md
41+
docs/payment_request/PaymentCallbackData.md
3842
docs/payment_request/PaymentMethod.md
3943
docs/payment_request/PaymentMethodParameters.md
4044
docs/payment_request/PaymentMethodReusability.md
@@ -84,6 +88,9 @@ test/test_direct_debit_channel_properties_bank_account.py
8488
test/test_direct_debit_channel_properties_bank_redirect.py
8589
test/test_direct_debit_channel_properties_debit_card.py
8690
test/test_e_wallet_all_of.py
91+
test/test_invoice_partner_metadata.py
92+
test/test_payment_callback.py
93+
test/test_payment_callback_data.py
8794
test/test_payment_request.py
8895
test/test_payment_request_action.py
8996
test/test_payment_request_api.py
@@ -142,10 +149,13 @@ xendit/payment_request/model/e_wallet_channel_code.py
142149
xendit/payment_request/model/e_wallet_channel_properties.py
143150
xendit/payment_request/model/e_wallet_parameters.py
144151
xendit/payment_request/model/error.py
152+
xendit/payment_request/model/invoice_partner_metadata.py
145153
xendit/payment_request/model/over_the_counter.py
146154
xendit/payment_request/model/over_the_counter_channel_code.py
147155
xendit/payment_request/model/over_the_counter_channel_properties.py
148156
xendit/payment_request/model/over_the_counter_parameters.py
157+
xendit/payment_request/model/payment_callback.py
158+
xendit/payment_request/model/payment_callback_data.py
149159
xendit/payment_request/model/payment_method.py
150160
xendit/payment_request/model/payment_method_parameters.py
151161
xendit/payment_request/model/payment_method_reusability.py

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
The official Xendit Python SDK provides a simple and convenient way to call Xendit's REST API
66
in applications written in Python.
77

8-
* Package version: 3.6.0
8+
* Package version: 3.7.0
99

1010
## Requirements
1111

@@ -48,18 +48,18 @@ You can sign up for a free Dashboard account [here](https://dashboard.xendit.co/
4848

4949
```python
5050
import xendit
51-
from xendit.apis import BalancesApi
51+
from xendit.apis import BalanceApi
5252
from pprint import pprint
5353

5454
xendit.set_api_key('XENDIT_API_KEY')
5555

5656
client = xendit.ApiClient()
5757

5858
try:
59-
response = BalancesApi(client).get_balance('CASH')
59+
response = BalanceApi(client).get_balance('CASH')
6060
pprint(response)
6161
except xendit.XenditSdkException as e:
62-
print("Exception when calling BalancesApi->get_balance: %s\n" % e)
62+
print("Exception when calling BalanceApi->get_balance: %s\n" % e)
6363
```
6464

6565
# Documentation
@@ -80,4 +80,4 @@ All URIs are relative to *https://api.xendit.co*. For more information about ou
8080
Further Reading
8181

8282
* [Xendit Docs](https://docs.xendit.co/)
83-
* [Xendit API Reference](https://developers.xendit.co/)
83+
* [Xendit API Reference](https://developers.xendit.co/)

docs/BalanceApi.md

+1
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,5 @@ except xendit.XenditSdkException as e:
7777
print("Exception when calling BalanceApi->get_balance: %s\n" % e)
7878
```
7979

80+
8081
[[Back to README]](../README.md)

docs/Configuration.md

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Configuration
2+
3+
To start using the API, you need to configure the secret key and initiate the client instance.
4+
You can use all the configurable parameters in the `configuration.py` file to customize your client (e.g. setting up proxy)
5+
6+
## Configuration Parameters
7+
8+
Here are the parameters you can set:
9+
10+
| Name | Type | Description | Default | Example |
11+
|-------------|:----------:|:---------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------|--------------------------------------------------------------------------|
12+
| **host** | **str** | Base URL | https://api.xendit.co | https://www.example.com |
13+
| **api_key** | **str** | Xendit API Key | None | `xnd_development_abcdefghijke9112015j1nuq808912tr` |
14+
| **proxy** | **str** | Proxy URL | None | https://www.proxy.example.com |
15+
| **ssl_ca_cert** | **str** | Specifies the path to a PEM format CA certificate files, which can be used to verify the backend server certificates | None | `/path/to/your/example_cert.crt` |
16+
| **logger** | **map** | Logging Settings (e.g. `package_logger`, `urllib3_logger`) | `{"package_logger": "xendit", "urllib3_logger": "urllib3"}` | `{"package_logger": "your_logger_package", "urllib3_logger": "urllib3"}` |
17+
| **logger_format** | **str** | Log format | `%(asctime)s %(levelname)s %(message)s` | `%(asctime)s %(levelname)s %(message)s` |
18+
| **logger_file** | **str** | Debug file location | None | `/path/to/your/debug_file.txt` |
19+
| **debug** | **bool** | Debug Switch | `False` | `True` |
20+
| **connection_pool_maxsize** | **number** | urllib3 connection pool's maximum number of connections saved per pool. | `multiprocessing.cpu_count() * 5` | 5 |
21+
22+
## Sample Usage
23+
24+
Some parameters are able to set during initialization, e.g. `host`, `api_key`
25+
Some are set after initialization, e.g. `proxy`
26+
27+
```python
28+
import xendit
29+
30+
configuration = xendit.Configuration(
31+
host='https://www.example.com',
32+
api_key='xnd_development_abcdefghijke9112015j1nuq808912tr'
33+
)
34+
configuration.proxy = 'https://www.proxy.example.com'
35+
configuration.ssl_ca_cert = '/path/to/your/example_cert.crt'
36+
configuration.logger["package_logger"] = 'your_logger_package'
37+
configuration.logger["urllib3_logger"] = 'urllib3_logger'
38+
configuration.logger_format = '%(asctime)s %(levelname)s %(message)s`'
39+
configuration.logger_file = 'path/to/your/debug_file.txt'
40+
configuration.connection_pool_maxsize = 10
41+
42+
# Enter a context with an instance of the API client
43+
api_client = xendit.ApiClient(configuration)
44+
```
45+
46+

docs/CustomerApi.md

+1
Original file line numberDiff line numberDiff line change
@@ -396,4 +396,5 @@ except xendit.XenditSdkException as e:
396396
print("Exception when calling CustomerApi->update_customer: %s\n" % e)
397397
```
398398

399+
399400
[[Back to README]](../README.md)

docs/InvoiceApi.md

+47-4
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ create_invoice_request = CreateInvoiceRequest(
146146
),
147147
],
148148
) # CreateInvoiceRequest
149-
for_user_id = "62efe4c33e45694d63f585f8" # str | Business ID of the sub-account merchant (XP feature)
149+
for_user_id = "62efe4c33e45694d63f585f0" # str | Business ID of the sub-account merchant (XP feature)
150150

151151
# example passing only required values which don't have defaults set
152152
try:
@@ -204,7 +204,7 @@ api_client = xendit.ApiClient()
204204
# Create an instance of the API class
205205
api_instance = InvoiceApi(api_client)
206206
invoice_id = "62efe4c33e45294d63f585f2" # str | Invoice ID
207-
for_user_id = "62efe4c33e45694d63f585f8" # str | Business ID of the sub-account merchant (XP feature)
207+
for_user_id = "62efe4c33e45694d63f585f0" # str | Business ID of the sub-account merchant (XP feature)
208208

209209
# example passing only required values which don't have defaults set
210210
try:
@@ -275,7 +275,7 @@ xendit.set_api_key('XENDIT API KEY')
275275
api_client = xendit.ApiClient()
276276
# Create an instance of the API class
277277
api_instance = InvoiceApi(api_client)
278-
for_user_id = "62efe4c33e45694d63f585f8" # str | Business ID of the sub-account merchant (XP feature)
278+
for_user_id = "62efe4c33e45694d63f585f0" # str | Business ID of the sub-account merchant (XP feature)
279279
external_id = "test-external" # str
280280
statuses = [
281281
InvoiceStatus("["PENDING","SETTLED"]"),
@@ -342,7 +342,7 @@ api_client = xendit.ApiClient()
342342
# Create an instance of the API class
343343
api_instance = InvoiceApi(api_client)
344344
invoice_id = "5f4708b7bd394b0400b96276" # str | Invoice ID to be expired
345-
for_user_id = "62efe4c33e45694d63f585f8" # str | Business ID of the sub-account merchant (XP feature)
345+
for_user_id = "62efe4c33e45694d63f585f0" # str | Business ID of the sub-account merchant (XP feature)
346346

347347
# example passing only required values which don't have defaults set
348348
try:
@@ -362,4 +362,47 @@ except xendit.XenditSdkException as e:
362362
print("Exception when calling InvoiceApi->expire_invoice: %s\n" % e)
363363
```
364364

365+
366+
## Callback Objects
367+
Use the following callback objects provided by Xendit to receive callbacks (also known as webhooks) that Xendit sends you on events, such as successful payments. Note that the example is meant to illustrate the contents of the callback object -- you will not need to instantiate these objects in practice
368+
### InvoiceCallback Object
369+
>Invoice Callback Object
370+
371+
Model Documentation: [InvoiceCallback](/InvoiceCallback.md)
372+
#### Usage Example
373+
Note that the example is meant to illustrate the contents of the callback object -- you will not need to instantiate these objects in practice
374+
```python
375+
import xendit
376+
from xendit.invoice.model import InvoiceCallback
377+
import json
378+
from pprint import pprint
379+
380+
invoice_callback_obj = {
381+
"id" : "593f4ed1c3d3bb7f39733d83",
382+
"external_id" : "testing-invoice",
383+
"user_id" : "5848fdf860053555135587e7",
384+
"payment_method" : "RETAIL_OUTLET",
385+
"status" : "PAID",
386+
"merchant_name" : "Xendit",
387+
"amount" : 2000000,
388+
"paid_amount" : 2000000,
389+
"paid_at" : "2020-01-14T02:32:50.912Z",
390+
"payer_email" : "[email protected]",
391+
"description" : "Invoice webhook test",
392+
"created" : "2020-01-13T02:32:49.827Z",
393+
"updated" : "2020-01-13T02:32:50.912Z",
394+
"currency" : "IDR",
395+
"payment_channel" : "ALFAMART",
396+
"payment_destination" : "TEST815"
397+
}
398+
invoice_callback_json = json.dumps(invoice_callback_obj)
399+
```
400+
401+
You may then use the callback object in your webhook or callback handler like so,
402+
```python
403+
def SimulateInvoiceCallback(invoice_callback_json) {
404+
callback_obj = InvoiceCallback(**json.loads(invoice_callback_json))
405+
// do things here with the callback
406+
}
407+
```
365408
[[Back to README]](../README.md)

0 commit comments

Comments
 (0)