Skip to content

Commit

Permalink
Readme/Accept Docs Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
muhammedattif committed Jun 14, 2023
1 parent b733d5b commit 059ebec
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ pip install --upgrade paymob
Each API Call retrieves a tuple which contains three values (Code, Data, Message)

- **Code**: A Number that represents API state. [Codes Reference](#codes-reference) <span id="code"></span>
- **Data**: The returned data of the API.
- **Message**: A human readable description of the [Code](#code). You can use this message for debugging. <span id="message"></span>
- **Data**: The returned data from the API.
- **Message**: A human readable description of the [Code](#code). (You can use this message for debugging) <span id="message"></span>


Successful API calls will return the following values:
**Successful API calls will return the following values:**

- **Code**: [One of the Following Codes](#success-codes)
- **Data**: `dict` or `list` (Depending on the API response)
- **Message**: Success meesage (Varies depending on what the API done)

Unsuccessful API calls will return the following values:
**Unsuccessful API calls will return the following values:**

- **Code**: [One of the Following Codes](#error-codes)
- **Data**: `None`
Expand All @@ -71,6 +71,11 @@ Unsuccessful API calls will return the following values:
| `UNHANDLED_EXCEPTION` | `23` | Unhandled Exception [comment]: # Trace Error will be provided in the [message](#message) |


You can import these code from
```python
from paymob.accept.response_codes import SUCCESS, JSON_DECODE_EXCEPTION, REQUEST_EXCEPTION, HTTP_EXCEPTION, UNHANDLED_EXCEPTION
```

# Settings

You can customized some behaves of `Paymob` by following settings in `.env` file.
Expand Down
29 changes: 16 additions & 13 deletions docs/services/accept.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Requirements

Before starting to use Accept APIs it needs to be configured with your account's secret keys which is
available in your [Accept Paymob Dashboard][accept-dashboard]. in `.env` Set the following variables:
available in your [Accept Dashboard][accept-dashboard]. in `.env` Set the following variables:
```
ACCEPT_API_KEY=<YOUR API KEY>
ACCEPT_HMAC_SECRET=<YOUR HMAC SECRET>
Expand All @@ -24,24 +24,24 @@ Payment Flow for `Kiosk`, `Wallet`, `Cash` Payment
flowchart TD
A(Create Order) --> B(Create Payment Key)
B --> C{Proceed}
B --> D[Kiosk]
B --> E[Wallet]
C --> D[Kiosk]
C --> E[Wallet]
```


# APIs

#### Initialize `AcceptAPIClient`
## Initialize `AcceptAPIClient`

```python
from paymob.accept import AcceptAPIClient

accept_api_client = AcceptAPIClient()
```

by initializing an object from `AcceptAPIClient` a TCP connection session is established with Paymob and an `Auth Token` is automatically retrieved.
by initializing an object from `AcceptAPIClient` a TCP connection session is established with Paymob server and an `Auth Token` is automatically retrieved.

#### Create Order
## Create Order

**Example**

Expand Down Expand Up @@ -77,7 +77,7 @@ code, order_data, message = accept_api_client.create_order(
| `shipping_details` | `No` | `dict` | Mandatory if your order needs to be delivered, otherwise you can delete the whole object |


#### Get Order
## Get Order

**Example**

Expand All @@ -100,7 +100,7 @@ code, order_data, message = accept_api_client.get_order(
| `order_id` | `Yes` | - | Order ID retrieved from [Create Order API](#create-order) |


#### Create Payment Key
## Create Payment Key

**Example**

Expand Down Expand Up @@ -138,7 +138,7 @@ code, payment_key, message = accept_api_client.create_payment_key(
| `lock_order_when_paid` | `No` | `False` | A flag prevent this order to be paid again if it is paid |


#### Wallet Payment
## Wallet Payment

After creating the payment key, you may need to processed to `Mobile Wallets` payment, so you need to use the following API to get the `redirect URL`.

Expand All @@ -165,7 +165,7 @@ code, payment_data, message = accept_api_client.proceed_wallet_payment(
| `identifier` | `Yes` | - | Wallet Mobile Number |


#### Kiosk Payment
## Kiosk Payment

After creating the payment key, you may need to processed to `Kiosk` payment, so you need to use the following API to get the `bill_reference`.

Expand All @@ -184,9 +184,11 @@ code, payment_data, message = accept_api_client.proceed_kiosk_payment(

**Parameters**

| Parameter | Required? | Default | Description |
| --- | --- | --- | --- |
| `payment_key` | `Yes` | - | Payment Key obtained from [Create Payment Key](#create-payment-key) |
| Parameter | Required? | Description |
| --- | --- | --- |
| `payment_key` | `Yes` | Payment Key obtained from [Create Payment Key](#create-payment-key) |

---

# HMAC Validation

Expand Down Expand Up @@ -216,6 +218,7 @@ is_valid = AcceptUtils.validate_processed_hmac(
| `payment_key` | `Yes` | - | Payment Key obtained from [Create Payment Key](#create-payment-key) |


---

# Utility Methods

Expand Down

0 comments on commit 059ebec

Please sign in to comment.