elepay-python-sdk


Nameelepay-python-sdk JSON
Version 1.2.0 PyPI version JSON
download
home_pagehttps://github.com/elestyle/elepay-python-sdk
Summaryelepay API リファレンス
upload_time2023-01-24 02:50:29
maintainer
docs_urlNone
authorELESTYLE, INC
requires_python>=3.7
license
keywords restful elepay api リファレンス
VCS
bugtrack_url
requirements certifi frozendict python-dateutil setuptools typing_extensions urllib3
Travis-CI
coveralls test coverage No coveralls.
            # Elepay Python SDK
elepay APIはRESTをベースに構成された決済APIです。支払い処理、返金処理など、決済に関わる運用における様々なことができます。

This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: 1.2.0
- SDK version: 1.2.0

For more information, please visit [Elepay Homepage](https://elepay.io) and [API Reference][apiref]

## Installation
### pip install (Recommended)

```sh
pip install elepay-python-sdk==1.2.0
```

If it is failed by root permission, try `sudo pip install elepay-python-sdk==1.2.0`.

### pip install from GitHub

Install from this repository directly using:

```sh
pip install git+https://github.com/elestyle/elepay-python-sdk.git@v1.2.0
```
(you may need to run `pip` with root permission)

### Setuptools (Not recommended)

Install via [Setuptools](http://pypi.python.org/pypi/setuptools).

Clone this repository and installed by `setup.py`:

```sh
git clone https://github.com/elestyle/elepay-python-sdk.git
cd elepay-python-sdk
python setup.py install --user
```
(or `sudo python setup.py install` to install the package for all users)

## Requirements.

Python >=3.7

## Rules of SDK Generation

1. The SDK Generator uses spec case for all (object) property names and parameter names.
    - If the spec has a property name like `paymentMethod`, it will keep to use `paymentMethod` instead of `payment_method`
    - It will be easy to serialize / deserialize between Elepay API <-> Your Server <-> Your Client
2. Endpoint request parameters should be assigned to different arguments
    - Query parameters should be assigned to `query_params`, like `charge_api.list_charges(query_params={"paymentMethod": someMethods})`
    - Path parameters should be assigned to `path_params`
    - Body should be assigned to `body`
    - etc. See also each schema of endpoint parameters and [Elepay API Reference][apiref].
3. Endpoint responses include the original `urllib3.HTTPResponse` and deserialized response body
    - Use `response.body` to access deserialized data
    - Use `response.response` to access original `urllib3.HTTPResponse`
4. All deserialized data is instantiated in an instance that subclasses all validated `Schema` classes and `Decimal` / `str` / `list` / `tuple` / `frozendict` / `NoneClass` / `BoolClass` / `bytes` / `io.FileIO`
    - This means that you can use `isinstance` to check if a payload validated against a schema class
    - This means that no data will be of type `None` / `True` / `False`
        - Ingested `None` will subclass `NoneClass`
        - Ingested `True` will subclass `BoolClass`
        - Ingested `False` will subclass `BoolClass`
        - Use `instance.is_true_oapg()` / `.is_false_oapg()` / `.is_none_oapg()` to check if `instance` is `None` / `True` / `False`
5. All validated class instances are immutable
    - Please do not change values or property values after a class has been instantiated
6. String + Number types with formats
    - String type data is stored as a string and if you need to access types based on its format like date,
    date-time, uuid, number etc then you will need to use accessor functions on the instance
    - type string + format: See `.as_date_oapg`, `.as_datetime_oapg`, `.as_decimal_oapg`, `.as_uuid_oapg`
    - type number + format: See `.as_float_oapg`, `.as_int_oapg`
    - this was done because openapi / json-schema defines constraints. string data may be type string with no format
    keyword in one schema, and include a format constraint in another schema
    - Use `as_date_oapg` / `as_datetime_oapg` / `as_decimal_oapg` / `as_uuid_oapg` to access a string format based type
    - Use `as_int_oapg` / `as_float_oapg` to access a number format based type
7. Property access on `AnyType(unset)` or `object(dict)` schemas
    - Only required keys with valid python names are properties like `.someProp` and have type hints
    - All optional keys may not exist, so properties are not defined for them
    - One can access optional values with `dict_instance['optionalProp']` and `KeyError` will be raised if it does not exist
    - Use `get_item_oapg` if you need a way to always get a value whether or not the key exists
        - If the key does not exist, `schemas.unset` is returned from calling `dict_instance.get_item_oapg('optionalProp')`
        - If the key exist but the value is `None`, `NoneClass` will be returned
        - All required and optional keys have type hints for this method, and `@typing.overload` is used
        - A type hint is also generated for additional properties accessed using this method
    - Use `some_instance['optionalProp']` to access optional property and additional property values like `extra`
8. The location of the api classes
    - Package `elepay.apis.tag_to_api` will contain all APIs classes which is split by tag (Recommended)
    - Package `elepay.apis.tags` will contain each tag class
        - Example: `elepay.apis.tags.charge_api` will contain `ChargeApi`, which have been tagged as `charge`
    - Package `elepay.apis.path_to_api` will contain all APIs classes which is split by path (Not recommended)
    - See also [Note](#note) for more help if import fails
9. What is the `Oapg` and `_oapg`?
    - It is just a method / class postfix which is providered by SDK Generator
    - The OAPG stands for OpenApi Python Generator

## Getting Started

Please follow the [installation procedure](#installation) and then run the following:

```python
from pprint import pprint
from uuid import uuid4
from elepay import ApiException
from elepay.models import ChargeReq, PaymentMethodType, ResourceType, RefundReq
from elepay.apis.tag_to_api import ChargeApi # Or elepay.apis.tags.charge_api
from elepay.api_client import JSONEncoder, ApiClient, Configuration

# Defining the host is optional and defaults to https://api.elepay.io

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Simple to configure Elepay HTTP authorization:
configuration = Configuration('sk_live_******')

# Generate your order number, please use a unique id in your system
order_number=str(uuid4())

# Enter a context with an instance of the API client
# Should close it before exit
api_client = ApiClient(configuration)

# Create an instance of the API class
charge_api = ChargeApi(api_client)
# Request to create a simple charge, see API document or __new__ for a list of all supported parameters
charge_req = ChargeReq(
    amount=1500, # 1500, currency default is JPY, or set currency to other allowed values
    orderNo=order_number,
    paymentMethod=PaymentMethodType.CREDITCARD,
    resource=ResourceType.WEB, # Please make sure the client is running on the correct resource type
)

try:
    response = charge_api.create_charge(body=charge_req)
    # elepay.models.ChargeDto is the type of response.body 
    # bytes is the type of response.response.data which is also original body

    # Use response original body bytes like:
    original_body = response.response.data.decode("utf-8")
    # Or re-serialize response body like:
    json_body = JSONEncoder().encode(response.body)

    # Then return the original_body or json_body to client.
    # Example for Django with original body bytes:
    #   django.http.HttpResponse(content=response.response.data, content_type='application/json')
    # Or re-serialize:
    #   django.http.JsonResponse(data=response.body, encoder=JSONEncoder)
except ApiException as e:
    pprint("Exception when calling ChargeApi->create_charge: %s\n" % e)
```

The Elepay client SDK can handle the `ChargeDto` to invoke the payment popup.

## API Endpoints

See [Elepay API Reference][apiref].

## Author

[ELESTYLE, Inc.](https://elestyle.jp)

## Note
If the OpenAPI document is large, imports in `elepay.apis` and `elepay.models` may fail with a
`RecursionError` indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:

Solution 1:
Use specific imports for apis and models like:
- `from elepay.apis.charge_api import ChargeApi`
- `from elepay.model.charge_req import ChargeReq`

Solution 2:
Before importing the package, adjust the maximum recursion limit as shown below:
```python
import sys

# Or some value else, default value should be 1000, but it may be different in some environments.
sys.setrecursionlimit(2000)

import elepay
from elepay.apis import *
from elepay.models import *
```

[apiref]: https://developer.elepay.io/reference

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/elestyle/elepay-python-sdk",
    "name": "elepay-python-sdk",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "restful,elepay API \u30ea\u30d5\u30a1\u30ec\u30f3\u30b9",
    "author": "ELESTYLE, INC",
    "author_email": "support@elestyle.jp",
    "download_url": "https://files.pythonhosted.org/packages/50/2e/5ed939d19938759ae4aadabaecfb989c90709fead4c064e8e58ae375d85b/elepay-python-sdk-1.2.0.tar.gz",
    "platform": null,
    "description": "# Elepay Python SDK\nelepay API\u306fREST\u3092\u30d9\u30fc\u30b9\u306b\u69cb\u6210\u3055\u308c\u305f\u6c7a\u6e08API\u3067\u3059\u3002\u652f\u6255\u3044\u51e6\u7406\u3001\u8fd4\u91d1\u51e6\u7406\u306a\u3069\u3001\u6c7a\u6e08\u306b\u95a2\u308f\u308b\u904b\u7528\u306b\u304a\u3051\u308b\u69d8\u3005\u306a\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\n\nThis Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:\n\n- API version: 1.2.0\n- SDK version: 1.2.0\n\nFor more information, please visit [Elepay Homepage](https://elepay.io) and [API Reference][apiref]\n\n## Installation\n### pip install (Recommended)\n\n```sh\npip install elepay-python-sdk==1.2.0\n```\n\nIf it is failed by root permission, try `sudo pip install elepay-python-sdk==1.2.0`.\n\n### pip install from GitHub\n\nInstall from this repository directly using:\n\n```sh\npip install git+https://github.com/elestyle/elepay-python-sdk.git@v1.2.0\n```\n(you may need to run `pip` with root permission)\n\n### Setuptools (Not recommended)\n\nInstall via [Setuptools](http://pypi.python.org/pypi/setuptools).\n\nClone this repository and installed by `setup.py`:\n\n```sh\ngit clone https://github.com/elestyle/elepay-python-sdk.git\ncd elepay-python-sdk\npython setup.py install --user\n```\n(or `sudo python setup.py install` to install the package for all users)\n\n## Requirements.\n\nPython >=3.7\n\n## Rules of SDK Generation\n\n1. The SDK Generator uses spec case for all (object) property names and parameter names.\n    - If the spec has a property name like `paymentMethod`, it will keep to use `paymentMethod` instead of `payment_method`\n    - It will be easy to serialize / deserialize between Elepay API <-> Your Server <-> Your Client\n2. Endpoint request parameters should be assigned to different arguments\n    - Query parameters should be assigned to `query_params`, like `charge_api.list_charges(query_params={\"paymentMethod\": someMethods})`\n    - Path parameters should be assigned to `path_params`\n    - Body should be assigned to `body`\n    - etc. See also each schema of endpoint parameters and [Elepay API Reference][apiref].\n3. Endpoint responses include the original `urllib3.HTTPResponse` and deserialized response body\n    - Use `response.body` to access deserialized data\n    - Use `response.response` to access original `urllib3.HTTPResponse`\n4. All deserialized data is instantiated in an instance that subclasses all validated `Schema` classes and `Decimal` / `str` / `list` / `tuple` / `frozendict` / `NoneClass` / `BoolClass` / `bytes` / `io.FileIO`\n    - This means that you can use `isinstance` to check if a payload validated against a schema class\n    - This means that no data will be of type `None` / `True` / `False`\n        - Ingested `None` will subclass `NoneClass`\n        - Ingested `True` will subclass `BoolClass`\n        - Ingested `False` will subclass `BoolClass`\n        - Use `instance.is_true_oapg()` / `.is_false_oapg()` / `.is_none_oapg()` to check if `instance` is `None` / `True` / `False`\n5. All validated class instances are immutable\n    - Please do not change values or property values after a class has been instantiated\n6. String + Number types with formats\n    - String type data is stored as a string and if you need to access types based on its format like date,\n    date-time, uuid, number etc then you will need to use accessor functions on the instance\n    - type string + format: See `.as_date_oapg`, `.as_datetime_oapg`, `.as_decimal_oapg`, `.as_uuid_oapg`\n    - type number + format: See `.as_float_oapg`, `.as_int_oapg`\n    - this was done because openapi / json-schema defines constraints. string data may be type string with no format\n    keyword in one schema, and include a format constraint in another schema\n    - Use `as_date_oapg` / `as_datetime_oapg` / `as_decimal_oapg` / `as_uuid_oapg` to access a string format based type\n    - Use `as_int_oapg` / `as_float_oapg` to access a number format based type\n7. Property access on `AnyType(unset)` or `object(dict)` schemas\n    - Only required keys with valid python names are properties like `.someProp` and have type hints\n    - All optional keys may not exist, so properties are not defined for them\n    - One can access optional values with `dict_instance['optionalProp']` and `KeyError` will be raised if it does not exist\n    - Use `get_item_oapg` if you need a way to always get a value whether or not the key exists\n        - If the key does not exist, `schemas.unset` is returned from calling `dict_instance.get_item_oapg('optionalProp')`\n        - If the key exist but the value is `None`, `NoneClass` will be returned\n        - All required and optional keys have type hints for this method, and `@typing.overload` is used\n        - A type hint is also generated for additional properties accessed using this method\n    - Use `some_instance['optionalProp']` to access optional property and additional property values like `extra`\n8. The location of the api classes\n    - Package `elepay.apis.tag_to_api` will contain all APIs classes which is split by tag (Recommended)\n    - Package `elepay.apis.tags` will contain each tag class\n        - Example: `elepay.apis.tags.charge_api` will contain `ChargeApi`, which have been tagged as `charge`\n    - Package `elepay.apis.path_to_api` will contain all APIs classes which is split by path (Not recommended)\n    - See also [Note](#note) for more help if import fails\n9. What is the `Oapg` and `_oapg`?\n    - It is just a method / class postfix which is providered by SDK Generator\n    - The OAPG stands for OpenApi Python Generator\n\n## Getting Started\n\nPlease follow the [installation procedure](#installation) and then run the following:\n\n```python\nfrom pprint import pprint\nfrom uuid import uuid4\nfrom elepay import ApiException\nfrom elepay.models import ChargeReq, PaymentMethodType, ResourceType, RefundReq\nfrom elepay.apis.tag_to_api import ChargeApi # Or elepay.apis.tags.charge_api\nfrom elepay.api_client import JSONEncoder, ApiClient, Configuration\n\n# Defining the host is optional and defaults to https://api.elepay.io\n\n# The client must configure the authentication and authorization parameters\n# in accordance with the API server security policy.\n# Examples for each auth method are provided below, use the example that\n# satisfies your auth use case.\n\n# Simple to configure Elepay HTTP authorization:\nconfiguration = Configuration('sk_live_******')\n\n# Generate your order number, please use a unique id in your system\norder_number=str(uuid4())\n\n# Enter a context with an instance of the API client\n# Should close it before exit\napi_client = ApiClient(configuration)\n\n# Create an instance of the API class\ncharge_api = ChargeApi(api_client)\n# Request to create a simple charge, see API document or __new__ for a list of all supported parameters\ncharge_req = ChargeReq(\n    amount=1500, # 1500, currency default is JPY, or set currency to other allowed values\n    orderNo=order_number,\n    paymentMethod=PaymentMethodType.CREDITCARD,\n    resource=ResourceType.WEB, # Please make sure the client is running on the correct resource type\n)\n\ntry:\n    response = charge_api.create_charge(body=charge_req)\n    # elepay.models.ChargeDto is the type of response.body \n    # bytes is the type of response.response.data which is also original body\n\n    # Use response original body bytes like:\n    original_body = response.response.data.decode(\"utf-8\")\n    # Or re-serialize response body like:\n    json_body = JSONEncoder().encode(response.body)\n\n    # Then return the original_body or json_body to client.\n    # Example for Django with original body bytes:\n    #   django.http.HttpResponse(content=response.response.data, content_type='application/json')\n    # Or re-serialize:\n    #   django.http.JsonResponse(data=response.body, encoder=JSONEncoder)\nexcept ApiException as e:\n    pprint(\"Exception when calling ChargeApi->create_charge: %s\\n\" % e)\n```\n\nThe Elepay client SDK can handle the `ChargeDto` to invoke the payment popup.\n\n## API Endpoints\n\nSee [Elepay API Reference][apiref].\n\n## Author\n\n[ELESTYLE, Inc.](https://elestyle.jp)\n\n## Note\nIf the OpenAPI document is large, imports in `elepay.apis` and `elepay.models` may fail with a\n`RecursionError` indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:\n\nSolution 1:\nUse specific imports for apis and models like:\n- `from elepay.apis.charge_api import ChargeApi`\n- `from elepay.model.charge_req import ChargeReq`\n\nSolution 2:\nBefore importing the package, adjust the maximum recursion limit as shown below:\n```python\nimport sys\n\n# Or some value else, default value should be 1000, but it may be different in some environments.\nsys.setrecursionlimit(2000)\n\nimport elepay\nfrom elepay.apis import *\nfrom elepay.models import *\n```\n\n[apiref]: https://developer.elepay.io/reference\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "elepay API \u30ea\u30d5\u30a1\u30ec\u30f3\u30b9",
    "version": "1.2.0",
    "split_keywords": [
        "restful",
        "elepay api \u30ea\u30d5\u30a1\u30ec\u30f3\u30b9"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bf7fc5c5a3c8afb924c8ba447686945b7f4fef48fd450fca7418f5d8a3c9120d",
                "md5": "732e1a7a43d87f173f511b03c28c608e",
                "sha256": "c4fa2898c2a145e8b9231a51bdccc3e165dc587cc7a704836baa8afb94c54da1"
            },
            "downloads": -1,
            "filename": "elepay_python_sdk-1.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "732e1a7a43d87f173f511b03c28c608e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 250616,
            "upload_time": "2023-01-24T02:50:27",
            "upload_time_iso_8601": "2023-01-24T02:50:27.041906Z",
            "url": "https://files.pythonhosted.org/packages/bf/7f/c5c5a3c8afb924c8ba447686945b7f4fef48fd450fca7418f5d8a3c9120d/elepay_python_sdk-1.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "502e5ed939d19938759ae4aadabaecfb989c90709fead4c064e8e58ae375d85b",
                "md5": "70c8f87accd1efb68b9af9312a50658a",
                "sha256": "e7d70f527434e55391280eddc90d03f812eea22b591dbf8dcf7276d944282648"
            },
            "downloads": -1,
            "filename": "elepay-python-sdk-1.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "70c8f87accd1efb68b9af9312a50658a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 103802,
            "upload_time": "2023-01-24T02:50:29",
            "upload_time_iso_8601": "2023-01-24T02:50:29.305100Z",
            "url": "https://files.pythonhosted.org/packages/50/2e/5ed939d19938759ae4aadabaecfb989c90709fead4c064e8e58ae375d85b/elepay-python-sdk-1.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-24 02:50:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "elestyle",
    "github_project": "elepay-python-sdk",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "certifi",
            "specs": [
                [
                    ">=",
                    "14.5.14"
                ]
            ]
        },
        {
            "name": "frozendict",
            "specs": [
                [
                    "~=",
                    "2.3.4"
                ]
            ]
        },
        {
            "name": "python-dateutil",
            "specs": [
                [
                    "~=",
                    "2.7.0"
                ]
            ]
        },
        {
            "name": "setuptools",
            "specs": [
                [
                    ">=",
                    "21.0.0"
                ]
            ]
        },
        {
            "name": "typing_extensions",
            "specs": [
                [
                    "~=",
                    "4.3.0"
                ]
            ]
        },
        {
            "name": "urllib3",
            "specs": [
                [
                    "~=",
                    "1.26.7"
                ]
            ]
        }
    ],
    "tox": true,
    "lcname": "elepay-python-sdk"
}
        
Elapsed time: 0.03415s