# Merchant001 SDK
# Install
## Client-only
### For PIP
```bash
pip3 install merchant001_sdk
```
### For PDM
```bash
pdm add merchant001_sdk
```
## With CLI
### For PIP
```bash
pip3 install merchant001_sdk[cli]
```
### For PDM
```bash
pdm add merchant001_sdk[cli]
```
# Use
## Client
### Sync
```python3
from merchant001_sdk import Client
with Client(token=...) as client:
# comming soon...
```
### Async
```python3
from merchant001_sdk import Client
async def main(token: str) -> None:
async with Client(token=token) as client:
# comming soon...
```
## Methods
In this section I use async-only, but you can use sync/async (as in previous 2-level section).
### Merchant Healthcheck
```python3
from merchant001_sdk import Client
async def main(token: str) -> None:
async with Client(token=token, endpoint="https://api.merchant001.io/") as client:
result = await client.get_merchant_healthcheck()
print(result)
```
On Success:
```python3
MerchantHealthcheck(success=True)
```
On Error (invalid token for example):
```python3
ErrorResult(status_code=401, message='Unavailable api token', error='Unauthorized')
```
### Payment Methods List
Params:
- raw_dict (boolean) - eq. to makeArray, default is false.
- method_names_only (boolean) - eq. to onlyMethod, default is false.
- amount (int; > 0) - eq. to amount, default is null (optional).
```python3
from merchant001_sdk import Client
async def main(token: str) -> None:
async with Client(token=token, endpoint="https://api.merchant001.io/") as client:
result = await client.get_payment_methods(raw_dict=True, method_names_only=False)
print(result)
```
On Success:
```python3
[PaymentMethodType(type='GATE [RUB/USDT] CARD', methods=[{'type': 'GATE [RUB/USDT] CARD', 'method': 'tinkoff', 'imageUrl': None, 'name': 'Тинькофф'}, {'type': 'GATE [RUB/USDT] CARD', 'method': 'sberbank', 'imageUrl': None, 'name': 'Сбербанк'}])] # raw_dict=False
```
```python3
[PaymentMethodType(type='GATE [RUB/USDT] CARD', methods=['tinkoff', 'sberbank'])] # raw_dict=False, method_names_only=True
```
```python3
{'GATE [RUB/USDT] CARD': {'tinkoff': {'type': 'GATE [RUB/USDT] CARD', 'method': 'tinkoff', 'imageUrl': None, 'name': 'Тинькофф'}, 'sberbank': {'type': 'GATE [RUB/USDT] CARD', 'method': 'sberbank', 'imageUrl': None, 'name': 'Сбербанк'}}} # raw_dict=True
```
On Error (invalid token for example):
```python3
ErrorResult(status_code=401, message='Unavailable api token', error='Unauthorized')
```
### Create Transaction
Params:
pricing (mapping[str, mapping[str, str | float]]) - eq. to pricing.
provider_type (str) - eq. to selectedProvider.type.
provider_method (str) - eq. to selectedProvider.method.
is_partner_fee (boolean) - eq. to amount, default is null (optional).
```python3
from merchant001_sdk import Client
async def main(token: str) -> None:
async with Client(token=token, endpoint="https://api.merchant001.io/") as client:
result = await client.create_transaction(
pricing={"local": {"amount": 1, "currency": "RUB"}},
provider_type="GATE [RUB/USDT] CARD",
provider_method="SBERBANK",
is_partner_fee=False,
)
print(result)
```
### Get Transaction
Params:
- transaction_id (str)
```python3
from merchant001_sdk import Client
async def main(token: str, transaction_id: str) -> None:
async with Client(token=token, endpoint="https://api.merchant001.io/") as client:
result = await client.get_transaction(transaction_id=transaction_id)
print(result)
```
### Get Transaction Requisite
Params:
- transaction_id (str)
```python3
from merchant001_sdk import Client
async def main(token: str, transaction_id: str) -> None:
async with Client(token=token, endpoint="https://api.merchant001.io/") as client:
result = await client.get_transaction_requisite(transaction_id=transaction_id)
print(result)
```
### Claim Transaction as PAID
Params:
- transaction_id (str)
```python3
from merchant001_sdk import Client
async def main(token: str, transaction_id: str) -> None:
async with Client(token=token, endpoint="https://api.merchant001.io/") as client:
result = await client.claim_transaction_paid(transaction_id=transaction_id)
print(result)
```
### Claim Transaction as CANCELED
Params:
- transaction_id (str)
```python3
from merchant001_sdk import Client
async def main(token: str, transaction_id: str) -> None:
async with Client(token=token, endpoint="https://api.merchant001.io/") as client:
result = await client.claim_transaction_canceled(transaction_id=transaction_id)
print(result)
```
### Set Transaction payment method
Params:
- transaction_id (str)
- provider_type (str)
- provider_method (str)
```python3
from merchant001_sdk import Client
async def main(
token: str, transaction_id: str, provider_type: str, provider_method: str
) -> None:
async with Client(token=token, endpoint="https://api.merchant001.io/") as client:
result = await client.set_transaction_payment_method(
transaction_id=transaction_id,
provider_type=provider_type,
provider_method=provider_method,
)
print(result)
```
### Get Payment Method Rate
Params:
- payment_method (str)
```python3
from merchant001_sdk import Client
async def main(token: str, payment_method: str) -> None:
async with Client(token=token, endpoint="https://api.merchant001.io/") as client:
result = await client.get_payment_method_rate(payment_method=payment_method)
print(result)
```
On Success:
```python3
PaymentMethodRate(method='sberbank', rate=103.38)
```
### Upload payment receipt
Params:
- transaction_id (str)
- receipt_file (str) - filepath or opened file with mode "rb".
- amount (float; optional) - if you need to specify the amount.
```python3
from merchant001_sdk import Client
async def main(token: str, transaction_id: str, filepath: str, amount: int) -> None:
async with Client(token=token, endpoint="https://api.merchant001.io/") as client:
result = await client.upload_payment_receipt(
transaction_id=transaction_id, receipt_file=filepath, amount=amount
)
print(result)
```
On Success:
```python3
StatusStub(status=True)
```
Raw data
{
"_id": null,
"home_page": "",
"name": "merchant001_sdk",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10,<=3.12",
"maintainer_email": "",
"keywords": "CLI,client,convertation,crypto,usdt",
"author": "",
"author_email": "Alexander Lavrov <alexander.lavrov@elastoo.com>",
"download_url": "https://files.pythonhosted.org/packages/e9/a1/f5d2709f54f2623dc04d612a0772eb6e2d09da55417dedd2e45424e5b4ff/merchant001-sdk-0.0.21.tar.gz",
"platform": null,
"description": "# Merchant001 SDK\n\n# Install\n\n## Client-only\n\n### For PIP\n\n```bash\npip3 install merchant001_sdk\n```\n\n### For PDM\n\n```bash\npdm add merchant001_sdk\n```\n\n## With CLI\n\n### For PIP\n\n```bash\npip3 install merchant001_sdk[cli]\n```\n\n### For PDM\n\n```bash\npdm add merchant001_sdk[cli]\n```\n\n# Use\n\n## Client\n\n### Sync\n\n```python3\nfrom merchant001_sdk import Client\n\n\nwith Client(token=...) as client:\n # comming soon...\n\n```\n\n### Async\n\n```python3\nfrom merchant001_sdk import Client\n\n\nasync def main(token: str) -> None:\n async with Client(token=token) as client:\n # comming soon...\n\n```\n\n## Methods\n\nIn this section I use async-only, but you can use sync/async (as in previous 2-level section).\n\n### Merchant Healthcheck\n\n```python3\nfrom merchant001_sdk import Client\n\n\nasync def main(token: str) -> None:\n async with Client(token=token, endpoint=\"https://api.merchant001.io/\") as client:\n result = await client.get_merchant_healthcheck()\n\n print(result)\n```\n\nOn Success:\n\n```python3\nMerchantHealthcheck(success=True)\n```\n\nOn Error (invalid token for example):\n\n```python3\nErrorResult(status_code=401, message='Unavailable api token', error='Unauthorized')\n```\n\n### Payment Methods List\n\nParams:\n\n- raw_dict (boolean) - eq. to makeArray, default is false.\n- method_names_only (boolean) - eq. to onlyMethod, default is false.\n- amount (int; > 0) - eq. to amount, default is null (optional).\n\n```python3\nfrom merchant001_sdk import Client\n\n\nasync def main(token: str) -> None:\n async with Client(token=token, endpoint=\"https://api.merchant001.io/\") as client:\n result = await client.get_payment_methods(raw_dict=True, method_names_only=False)\n\n print(result)\n```\n\nOn Success:\n\n```python3\n[PaymentMethodType(type='GATE [RUB/USDT] CARD', methods=[{'type': 'GATE [RUB/USDT] CARD', 'method': 'tinkoff', 'imageUrl': None, 'name': '\u0422\u0438\u043d\u044c\u043a\u043e\u0444\u0444'}, {'type': 'GATE [RUB/USDT] CARD', 'method': 'sberbank', 'imageUrl': None, 'name': '\u0421\u0431\u0435\u0440\u0431\u0430\u043d\u043a'}])] # raw_dict=False\n```\n\n```python3\n[PaymentMethodType(type='GATE [RUB/USDT] CARD', methods=['tinkoff', 'sberbank'])] # raw_dict=False, method_names_only=True\n```\n\n```python3\n{'GATE [RUB/USDT] CARD': {'tinkoff': {'type': 'GATE [RUB/USDT] CARD', 'method': 'tinkoff', 'imageUrl': None, 'name': '\u0422\u0438\u043d\u044c\u043a\u043e\u0444\u0444'}, 'sberbank': {'type': 'GATE [RUB/USDT] CARD', 'method': 'sberbank', 'imageUrl': None, 'name': '\u0421\u0431\u0435\u0440\u0431\u0430\u043d\u043a'}}} # raw_dict=True\n```\n\nOn Error (invalid token for example):\n\n```python3\nErrorResult(status_code=401, message='Unavailable api token', error='Unauthorized')\n```\n\n### Create Transaction\n\nParams:\npricing (mapping[str, mapping[str, str | float]]) - eq. to pricing.\nprovider_type (str) - eq. to selectedProvider.type.\nprovider_method (str) - eq. to selectedProvider.method.\nis_partner_fee (boolean) - eq. to amount, default is null (optional).\n\n```python3\nfrom merchant001_sdk import Client\n\n\nasync def main(token: str) -> None:\n async with Client(token=token, endpoint=\"https://api.merchant001.io/\") as client:\n result = await client.create_transaction(\n pricing={\"local\": {\"amount\": 1, \"currency\": \"RUB\"}},\n provider_type=\"GATE [RUB/USDT] CARD\",\n provider_method=\"SBERBANK\",\n is_partner_fee=False,\n )\n\n print(result)\n```\n\n### Get Transaction\n\nParams:\n\n- transaction_id (str)\n\n```python3\nfrom merchant001_sdk import Client\n\n\nasync def main(token: str, transaction_id: str) -> None:\n async with Client(token=token, endpoint=\"https://api.merchant001.io/\") as client:\n result = await client.get_transaction(transaction_id=transaction_id)\n\n print(result)\n```\n\n### Get Transaction Requisite\n\nParams:\n\n- transaction_id (str)\n\n```python3\nfrom merchant001_sdk import Client\n\n\nasync def main(token: str, transaction_id: str) -> None:\n async with Client(token=token, endpoint=\"https://api.merchant001.io/\") as client:\n result = await client.get_transaction_requisite(transaction_id=transaction_id)\n\n print(result)\n```\n\n### Claim Transaction as PAID\n\nParams:\n\n- transaction_id (str)\n\n```python3\nfrom merchant001_sdk import Client\n\n\nasync def main(token: str, transaction_id: str) -> None:\n async with Client(token=token, endpoint=\"https://api.merchant001.io/\") as client:\n result = await client.claim_transaction_paid(transaction_id=transaction_id)\n\n print(result)\n```\n\n### Claim Transaction as CANCELED\n\nParams:\n\n- transaction_id (str)\n\n```python3\nfrom merchant001_sdk import Client\n\n\nasync def main(token: str, transaction_id: str) -> None:\n async with Client(token=token, endpoint=\"https://api.merchant001.io/\") as client:\n result = await client.claim_transaction_canceled(transaction_id=transaction_id)\n\n print(result)\n```\n\n### Set Transaction payment method\n\nParams:\n\n- transaction_id (str)\n- provider_type (str)\n- provider_method (str)\n\n```python3\nfrom merchant001_sdk import Client\n\n\nasync def main(\n token: str, transaction_id: str, provider_type: str, provider_method: str\n) -> None:\n async with Client(token=token, endpoint=\"https://api.merchant001.io/\") as client:\n result = await client.set_transaction_payment_method(\n transaction_id=transaction_id,\n provider_type=provider_type,\n provider_method=provider_method,\n )\n\n print(result)\n```\n\n### Get Payment Method Rate\n\nParams:\n\n- payment_method (str)\n\n```python3\nfrom merchant001_sdk import Client\n\n\nasync def main(token: str, payment_method: str) -> None:\n async with Client(token=token, endpoint=\"https://api.merchant001.io/\") as client:\n result = await client.get_payment_method_rate(payment_method=payment_method)\n\n print(result)\n```\n\nOn Success:\n\n```python3\nPaymentMethodRate(method='sberbank', rate=103.38)\n```\n\n### Upload payment receipt\n\nParams:\n\n- transaction_id (str)\n- receipt_file (str) - filepath or opened file with mode \"rb\".\n- amount (float; optional) - if you need to specify the amount.\n\n```python3\nfrom merchant001_sdk import Client\n\n\nasync def main(token: str, transaction_id: str, filepath: str, amount: int) -> None:\n async with Client(token=token, endpoint=\"https://api.merchant001.io/\") as client:\n result = await client.upload_payment_receipt(\n transaction_id=transaction_id, receipt_file=filepath, amount=amount\n )\n\n print(result)\n```\n\nOn Success:\n\n```python3\nStatusStub(status=True)\n```\n\n",
"bugtrack_url": null,
"license": "",
"summary": "",
"version": "0.0.21",
"project_urls": {
"documentation": "https://merchant001_sdk.readthedocs.io",
"repository": "https://github.com/Elastoo-Team/merchant001_sdk"
},
"split_keywords": [
"cli",
"client",
"convertation",
"crypto",
"usdt"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b4c419db01c906080a7df87456bc30cb0ef870348bd3af453cf71843e3dfb70f",
"md5": "e279c057beba64aafcfdc45c70097bbd",
"sha256": "56b9fc1c370c9093b8c71620b6d69dde1e96c8d5205ab25562e1eebd4ed1b7a9"
},
"downloads": -1,
"filename": "merchant001_sdk-0.0.21-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e279c057beba64aafcfdc45c70097bbd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10,<=3.12",
"size": 17099,
"upload_time": "2023-10-04T15:47:21",
"upload_time_iso_8601": "2023-10-04T15:47:21.053846Z",
"url": "https://files.pythonhosted.org/packages/b4/c4/19db01c906080a7df87456bc30cb0ef870348bd3af453cf71843e3dfb70f/merchant001_sdk-0.0.21-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e9a1f5d2709f54f2623dc04d612a0772eb6e2d09da55417dedd2e45424e5b4ff",
"md5": "d8983f89e7d6c8c89d9dda33d4608695",
"sha256": "f1693d7a8f999f9bec78d2a0437e7d9e40347da3ba2e9ea3bd6d60d765b2092c"
},
"downloads": -1,
"filename": "merchant001-sdk-0.0.21.tar.gz",
"has_sig": false,
"md5_digest": "d8983f89e7d6c8c89d9dda33d4608695",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10,<=3.12",
"size": 11388,
"upload_time": "2023-10-04T15:47:22",
"upload_time_iso_8601": "2023-10-04T15:47:22.784414Z",
"url": "https://files.pythonhosted.org/packages/e9/a1/f5d2709f54f2623dc04d612a0772eb6e2d09da55417dedd2e45424e5b4ff/merchant001-sdk-0.0.21.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-04 15:47:22",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Elastoo-Team",
"github_project": "merchant001_sdk",
"github_not_found": true,
"lcname": "merchant001_sdk"
}