Skip to content

Commit

Permalink
Additions to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
hoosnick authored Nov 24, 2023
2 parents ab0025d + 89fc1f9 commit 3665aba
Show file tree
Hide file tree
Showing 23 changed files with 3,632 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
venv/
env/
env/
.idea/
35 changes: 34 additions & 1 deletion docs/src/en/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,37 @@ hide:
- toc
---

# **Welcome!**
# **PayTechUz guides!**


Welcome to our guides. This documentation dedicated to providing you with a collection of comprehensive documentation and guides related to the financial technology solutions and projects developed by our [organization](https://github.com/PayTechUz){:target="_blank"}. We are excited to have you on board and explore the possibilities that our payment integration solutions bring to your projects.

### **Who We Are:**
PayTechUz - we are passionate about simplifying the world of payments. Our team has crafted a suite of packages designed to empower developers, startups and enterprises in enhancing their payment processing capabilities.


### **Explore Our Packages:**
Dive into our collection of packages available on the Python Package Index (PyPI). Each package is crafted to address specific needs in payment integration. Find the perfect fit for your project and elevate your payment processing experience.

- [payme-pkg](https://github.com/PayTechUz/payme-pkg){:target="_blank"}


### **Join Our Community:**
Your journey with PayTechUz doesn't end here. Join our community to share insights, ask questions and collaborate with fellow developers. We believe in the power of community and collective knowledge.


- Telegram Group: [PayTechUz in Telegram](https://t.me/+7Gn-JZ99TfgwZDNi){:target="_blank"}
- GitHub Organization: [PayTechUz in GitHub](https://github.com/PayTechUz/){:target="_blank"}
- WebSite: [PayTechUz](https://pay-tech.uz){:target="_blank"}


!!! info ""
**Thank you for choosing us! We're here to make your payment integration experience not only seamless but also enjoyable.**

<br>

**Happy coding!**

<p align="center">
<img style="width: 40%;" src="https://i.postimg.cc/nzykWKNd/result.gif">
</p>
6 changes: 5 additions & 1 deletion docs/src/en/payme-pkg/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@
title: Introduction
---

# **Welcome!**
# **Introduction**

Welcome to our [payme-pkg](https://github.com/PayTechUz/payme-pkg/tree/master){:target="_blank"} package's documentation.

You can keep reading the docs. See [setup section](setup/).
49 changes: 49 additions & 0 deletions docs/src/en/payme-pkg/initializing-payments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
title: Initializing payments
description: Initializing payments
---

# [Generate pay link](https://github.com/PayTechUz/payme-pkg/blob/master/lib/payme/methods/generate_link.py){:target="_blank"}

> Example
```python
from pprint import pprint

from payme.methods.generate_link import GeneratePayLink

pay_link = GeneratePayLink(
order_id="999",
amount=9999,
callback_url="your-callback-url"
).generate_link()

pprint(pay_link)
```
> Output
```shell
https://checkout.paycom.uz/bT01ZTczMGU4ZTBiODUyYTQxN2FhNDljZWI7YWMub3JkZXItaWQ9OTk5O2E9OTk5OTtjPXlvdXItY2FsbGJhY2stdXJs
```

- Parameters

| Argument | Type | Description |
|--------------|---------|----------------------------------------------------------------------------------------------------------------------------------|
| order_id | str | _Required_. The order_id for paying |
| amount | Decimal | _Required_. The amount belong to the order |
| callback_url | str | _Optional_. The merchant api callback url to redirect after payment. By default, it takes PAYME_CALL_BACK_URL from your settings |

### Methods
- generate_link() -> to generate payment link.
> **Does not take any arguments**
- to_tiyin() -> convert from sum to tiyin.

| Argument | Type | Description |
|----------|---------|------------------------------|
| amount | Decimal | _Required_. The order amount |

- to_sum() -> convert from tiyin to sum.

| Argument | Type | Description |
|----------|---------|------------------------------|
| amount | Decimal | _Required_. The order amount |
36 changes: 36 additions & 0 deletions docs/src/en/payme-pkg/merchant-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,39 @@ description: Merchant API methods
---

# Merchant API methods

### [CheckPerformTransaction](https://github.com/PayTechUz/payme-pkg/blob/master/lib/payme/methods/check_perform_transaction.py){:target="_blank"}
_That's used to check perform transaction_
> **Has no methods**

### [CreateTransaction](https://github.com/PayTechUz/payme-pkg/blob/master/lib/payme/methods/create_transaction.py){:target="_blank"}
_That's used to create transaction_


#### Methods
- _convert_ms_to_datetime() -> convert from time ms to datetime format

| Argument | Type | Description |
|----------|------|------------------------------------|
| time_ms | int | _Required_. The time ms to convert |


### [PerformTransaction](https://github.com/PayTechUz/payme-pkg/blob/master/lib/payme/methods/perform_transaction.py){:target="_blank"}
_That's used to perform a transaction_
> **Has no methods**

### [CancelTransaction](https://github.com/PayTechUz/payme-pkg/blob/master/lib/payme/methods/cancel_transaction.py){:target="_blank"}
_That is used to cancel a transaction_
> **Has no methods**

### [CheckTransaction](https://github.com/PayTechUz/payme-pkg/blob/master/lib/payme/methods/check_transaction.py){:target="_blank"}
_That's used to check transaction_
> **Has no methods**

### [GetStatement](https://github.com/PayTechUz/payme-pkg/blob/master/lib/payme/methods/get_statement.py){:target="_blank"}
_Transaction information is used for reconciliation of merchant and Payme Business transactions_
> **Has no methods**
226 changes: 226 additions & 0 deletions docs/src/en/payme-pkg/sandbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,229 @@ description: Sandbox
---

# Sandbox


!!! info
Testing on a production server creates additional load. Accounts associated with malfunctioning applications are blocked.

### About sandbox

**Sandbox**_environment for safe testing of the implemented [Merchant API](merchant-api.md){:target="_blank"}. Sandbox tests will help verify the interaction of the implemented API with Payme Business. Sandbox testing allows you to get a detailed description of the [errors](https://developer.help.paycom.uz/protokol-merchant-api/obschie-oshibki){:target="_blank"}._

???+ info
The merchant developer initiates testing and runs tests. Testing is carried out using [requests](https://developer.help.paycom.uz/protokol-merchant-api/format-zaprosa){:target="_blank"} and [responses](https://developer.help.paycom.uz/protokol-merchant-api/format-otveta){:target="_blank"}. Requests are sent by the Payme Business server, responses are sent by the merchant server.


### Preparing for testing

Add a web cash register in the merchant's account. After creating a web cash register, Payme Business will issue 2 keys:

- key for cabinet — key;
- key for sandbox — TEST_KEY.

!!! info ""
**Go to [sandbox](https://test.paycom.uz/){:target="_blank"}. In the sandbox, enter Merchant ID (web cash register ID) and TEST_KEY.**

!!! info
Merchant ID is stored in the web cash register developer settings.

<img src="https://i.ibb.co/jVY9Lzq/image.png" width="100%" border="0">

!!! info
It is important that the Endpoint URL is specified in the cash register settings - the billing web address. Payme Business will send inquiries to this address.

When creating transactions in the sandbox, it is important to correctly specify the account type:

- Money can be transferred to your **savings account** an unlimited number of times. An example of a savings account is a mobile operator account;
- To a **one-time account**, money can be received only 1 time. An example of a one-time invoice is an order in an online store.

!!! info
Testing of [payment initialization](initializing-payments.md){:target="_blank"} is recommended to be carried out only after successful completion of testing in the sandbox: first test the payment initialization in the sandbox, then in production.

**Sandbox url:** [https://test.paycom.uz](https://test.paycom.uz){:target="_blank"}

**URL for sending a check to the sandbox:** [https://test.paycom.uz](https://test.paycom.uz){:target="_blank"}

**URL for sending a check to the production:** [https://checkout.paycom.uz](https://checkout.paycom.uz){:target="_blank"}


### Testing

Testing is carried out according to 2 scenarios:

1. [Creating and canceling an unconfirmed transaction](#_4)
2. [Creating, confirming and canceling a confirmed financial transaction](#_5)

The first scenario includes a security check, so the first scenario is tested first, then the second.

!!! info
The Merchant API has already been implemented in the payment plugin, so testing of the payment plugin is carried out according to the same scenarios.

#### Creating and canceling an unconfirmed transaction

Log in to the store as a customer. Add the item to your cart and pay for your order using Payme. After payment there will be an automatic transition to the “Sandbox” to the page for creating a financial transaction.

**Check authorization with incorrect credentials**

In the “Invalid Data” section, click on the “Invalid Authorization” link and run the test.

<img src="https://i.ibb.co/DkyRw6m/image.png" width="25%" border="0">

!!! info
For requests to implemented methods, the implemented Merchant API returns responses with error -32504: “Insufficient privileges to execute the method.”

**Check payment with incorrect or invalid amount**

In the “Incorrect Data” section, click on the “Invalid Amount” link.

<img src="https://i.ibb.co/QX1ybh3/image.png" width="25%" border="0">

In the test parameters, specify a valid order number, an incorrect amount and run the test.

<img src="https://i.ibb.co/6v5QBYR/image.png" width="100%" border="0">

!!! info
For requests to the implemented methods [CheckPerformTransaction](merchant-api.md#checkperformtransaction){:target="_blank"} and [CreateTransaction](merchant-api.md#checktransaction){:target="_blank"}, implemented by the Merchant API returns responses with error -31001: "Invalid amount."

**Check payment of a non-existent invoice**

In the “Invalid data” section, click on the “Nonexistent account” link.

<img src="https://i.ibb.co/Dw4hnR5/image.png" width="25%" border="0">

In the test parameters, specify the actual order amount, an incorrect order number and run the test.

<img src="https://i.ibb.co/DMcCcsh/image.png" width="100%" border="0">

!!! info
For requests to the implemented methods [CheckPerformTransaction](merchant-api.md#checkperformtransaction){:target="_blank"} and [CreateTransaction](merchant-api.md#checktransaction){:target="_blank"}, implemented by the Merchant API returns responses with errors -31050 - -31099: “Invalid order code.”

**Check the possibility of creating a financial transaction**

!!! info
Checking the possibility of creating a financial transaction is ensured by the implemented method [CheckPerformTransaction](merchant-api.md#checkperformtransaction){:target="_blank"}.

In the “Payment Requests” section, click on the “CheckPerformTransaction” link.

<img src="https://i.ibb.co/rfTnDZL/image.png" width="25%" border="0">

Make sure that the test parameters include the value of the Account parameter and the payment amount in tiyins and run the test.

<img src="https://i.ibb.co/T4NsGQ7/image.png" width="100%" border="0">

When a request is made to the implemented CheckPerformTransaction method, the implemented Merchant API returns a response without errors.

**Create a transaction**

!!! info
The creation of a transaction is ensured by the implemented method [CreateTransaction](merchant-api.md#checktransaction){:target="_blank"}.

In the Payment Requests section, click on the “CreateTransaction” link.

<img src="https://i.ibb.co/S5d5qsK/image.png" width="25%" border="0">

Make sure that in the test launch parameters the account type is “One-time” and the account status is “Awaiting payment” and run the test.

<img src="https://i.ibb.co/mv3ZFhb/image.png" width="100%" border="0">

!!! info
Requests for the CreateTransaction, PerformTransaction, and CancelTransaction methods are sent twice. If the first request fails, the second one will definitely pass. When repeated calls to the CreateTransaction, PerformTransaction, CancelTransaction methods, the response must match the response from the first request.

The implemented Merchant API returns:

- to a request to the implemented method [CheckPerformTransaction](merchant-api.md#checkperformtransaction){:target="_blank"} - response with the result “allow”: true;
- to a request to the implemented method [CreateTransaction](merchant-api.md#createtransaction){:target="_blank"} - response without errors;
- for a repeated request to the implemented method [CreateTransaction](merchant-api.md#createtransaction){:target="_blank"} - response without errors;
- to a request to the implemented method [CheckTransaction](merchant-api.md#checktransaction){:target="_blank"} - response without errors;
- to a request to the implemented method [CreateTransaction](merchant-api.md#createtransaction){:target="_blank"} with a new transaction and the account status “Waiting for payment” - a response with error -31008: “The operation cannot be completed.”

**Cancel an unconfirmed transaction**

!!! info
Transaction cancellation is ensured by the implemented [CancelTransaction](merchant-api.md#canceltransaction){:target="_blank"} method.

Cancellation of a transaction is ensured by the implemented one. In the “Payment requests” section, click on the “CancelTransaction” link. method [CancelTransaction](merchant-api.md#canceltransaction){:target="_blank"}.

<img src="https://i.ibb.co/92qWbJw/image.png" width="25%" border="0">

Make sure that the test launch parameters include the transaction id and transaction status “1” (transaction created) and run the test.

<img src="https://i.ibb.co/2KdF3Bh/image.png" width="100%" border="0">

!!! info
For requests to the implemented methods [CancelTransaction](merchant-api.md#canceltransaction){:target="_blank"} and [CheckTransaction](merchant-api.md#checktransaction){:target="_blank"}, implemented by the Merchant API returns responses without errors.

#### Creating, confirming and canceling a confirmed financial transaction

Log in to the store as a customer. Add the item to your cart and pay for your order using Payme. After payment there will be an automatic transition to the “Sandbox” to the page for creating a financial transaction.

**Check the possibility of creating a financial transaction**

!!! info
Checking the possibility of creating a financial transaction is ensured by the implemented method [CheckPerformTransaction](merchant-api.md#checkperformtransaction){:target="_blank"}.

In the “Payment Requests” section, click on the “CheckPerformTransaction” link.

<img src="https://i.ibb.co/hZS7KNQ/image.png" width="25%" border="0">

Make sure that the test parameters include the value of the Account parameter and the payment amount in tiyins and run the test.

<img src="https://i.ibb.co/7SJHKvf/image.png" width="100%" border="0">

When a request is made to the implemented CheckPerformTransaction method, the implemented Merchant API returns a response without errors.

**Create a transaction**

!!! info
The creation of a transaction is ensured by the implemented method [CreateTransaction](merchant-api.md#createtransaction){:target="_blank"}.

In the Payment Requests section, click on the “CreateTransaction” link.

<img src="https://i.ibb.co/S5d5qsK/image.png" width="25%" border="0">

Make sure that in the test launch parameters the account type is “One-time” and the account status is “Awaiting payment” and run the test.

<img src="https://i.ibb.co/S3YrpD5/image.png" width="100%" border="0">

The implemented Merchant API returns:

- to a request to the implemented method [CheckPerformTransaction](merchant-api.md#checkperformtransaction){:target="_blank"} - response with the result “allow”: true;
- to a request to the implemented method [CreateTransaction](merchant-api.md#createtransaction){:target="_blank"} - response without errors;
- for a repeated request to the implemented method [CreateTransaction](merchant-api.md#createtransaction){:target="_blank"} - response without errors;
- to a request to the implemented method [CheckTransaction](merchant-api.md#checktransaction){:target="_blank"} - response without errors;
- to a request to the implemented method [CreateTransaction](merchant-api.md#createtransaction){:target="_blank"} with a new transaction and the account status “Waiting for payment” - a response with error -31008: “The operation cannot be completed.”

**Confirm the transaction**

!!! info
Transaction confirmation is provided by the implemented [PerformTransaction](merchant-api.md#performtransaction){:target="_blank"} method.

In the “Payment Requests” section, click on the “PerformTransaction” link.

<img src="https://i.ibb.co/QPbn0n0/image.png" width="25%" border="0">

Make sure that the test launch parameters include the transaction id and transaction status “1” (created) and run the test.

<img src="https://i.ibb.co/FY85s7t/image.png" width="100%" border="0">

The implemented Merchant API returns a response without errors:

- to a request to the implemented method [PerformTransaction](merchant-api.md#performtransaction){:target="_blank"};
- for a repeated request to the implemented method [PerformTransaction](merchant-api.md#performtransaction){:target="_blank"};
- to a request to the implemented method [CheckTransaction](merchant-api.md#checktransaction){:target="_blank"}.

**Cancel a confirmed transaction**

!!! info
Transaction cancellation is ensured by the implemented [CancelTransaction](merchant-api.md#canceltransaction){:target="_blank"} method.

In the Payment Requests section, click on the “CancelTransaction” link.

<img src="https://i.ibb.co/gJTgQfh/image.png" width="25%" border="0">

Make sure that the test launch parameters include the transaction id and transaction status “1” (transaction created) and run the test.

<img src="https://i.ibb.co/D1x3qTV/image.png" width="100%" border="0">

!!! info
For requests to the implemented methods [CancelTransaction](merchant-api.md#canceltransaction){:target="_blank"} and [CheckTransaction](merchant-api.md#checktransaction){:target="_blank"}, implemented by the Merchant API returns responses without errors.
Loading

0 comments on commit 3665aba

Please sign in to comment.