zru-python


Namezru-python JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/zrupay/zru-python
SummaryZRU Python Bindings
upload_time2024-07-09 15:33:28
maintainerNone
docs_urlNone
authorZRU
requires_pythonNone
licenseBSD
keywords zru payments
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            # ZRU Python


# Overview

ZRU Python provides integration access to the ZRU API.

[![Coverage Status](https://coveralls.io/repos/github/zru/zru-python/badge.svg?branch=master)](https://coveralls.io/github/zru/zru-python?branch=master)

# Installation

You can install using `pip`:

    pip install --upgrade zru-python
    
or `easy_install`

    easy_install --upgrade zru-python

or to install from source, run:

    python setup.py install

# Migration Guide for Versions Prior to 1.x.x

If you are migrating from a version prior to 1.x.x, you will need to update your import statements to reflect the change from mc2p to zru. Here is a guide to help you make these changes.

### Updating Import Statements

For any imports that used the mc2p module, replace mc2p with zru.

#### Example

Before:

    from mc2p.errors import InvalidRequestError

After:

    from zru.errors import InvalidRequestError

### Updating Client class

Replace MC2PClient with ZRUClient.

#### Example

Before:

    client = MC2PClient(...)

After:

    client = ZRUClient(...)

### Steps to Update Your Code

1.  Search and Replace: Use your IDE or a text editor to search for mc2p and replace it with zru.
2.  Verify Imports: Ensure all import statements now reference zru.
3.  Run Tests: Run your test suite to verify that your code is functioning correctly with the updated imports.

## Summary

By following these steps, you can successfully migrate your project from versions prior to 1.x.x, ensuring compatibility with the new zru module naming convention.

# Quick Start Example

    from zru import ZRU
    
    zru = ZRUClient('KEY', 'SECRET_KEY')
    
    # Create transaction
    transaction = zru.Transaction({
        "currency": "EUR",
        "products": [{
            "amount": 1,
            "product_id": "PRODUCT-ID"
        }]
    })
    # or with product details
    transaction = zru.Transaction({
        "currency": "EUR",
        "products": [{
            "amount": 1,
            "product": {
                "name": "Product",
                "price": 5
            }
        }]
    })
    transaction.save()
    transaction.pay_url # Send user to this url to pay
    transaction.iframe_url # Use this url to show an iframe in your site

    # Get plans
    plans_paginator = zru.plan.list()
    plans_paginator.count
    plans_paginator.results # Application's plans
    plans_paginator.get_next_list()
    
    # Get product, change and save
    product = zru.Product.get("PRODUCT-ID")
    product.price = 10
    product.save()
    
    # Create and delete tax
    tax = zru.Tax({
        "name": "Tax",
        "percent": 5
    })
    tax.save()
    tax.delete()
    
    # Check if transaction was paid
    transaction = zru.Transaction.get("TRANSACTION-ID")
    transaction.status == 'D' # Paid
    
    # Create subscription
    subscription = zru.Subscription({
        "currency": "EUR",
        "plan_id": "PLAN-ID",
        "note": "Note example"
    })
    # or with plan details
    subscription = zru.Subscription({
        "currency": "EUR",
        "plan": {
            "name": "Plan",
            "price": 5,
            "duration": 1,
            "unit": "M",
            "recurring": True
        },
        "note": "Note example"
    })
    subscription.save()
    subscription.pay_url # Send user to this url to pay
    subscription.iframe_url # Use this url to show an iframe in your site

    # Receive a notification
    notification_data = zru.NotificationData(JSON_DICT_RECEIVED_FROM_ZRU)
    notification_data.is_status_done # Paid
    notification_data.transaction # Transaction Paid
    notification_data.sale # Sale generated

# Exceptions
    
    from zru.errors import InvalidRequestError
    
    # Incorrect data
    shipping = zru.Shipping({
        "name": "Normal shipping",
        "price": "text" # Price must be number
    })
    try:
        shipping.save()
    except InvalidRequestError as e:
        e._message # Status code of error
        e.json_body # Info from server
        e.resource # Resource used to make the server request
        e.resource_id # Resource id requested

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/zrupay/zru-python",
    "name": "zru-python",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "zru, payments",
    "author": "ZRU",
    "author_email": "support@zrupay.com",
    "download_url": "https://files.pythonhosted.org/packages/19/b0/19a6f0149be57374428ad8407c30f07ba2c22b9884bd6ea7d82e4818f50b/zru_python-1.0.0.tar.gz",
    "platform": null,
    "description": "# ZRU Python\n\n\n# Overview\n\nZRU Python provides integration access to the ZRU API.\n\n[![Coverage Status](https://coveralls.io/repos/github/zru/zru-python/badge.svg?branch=master)](https://coveralls.io/github/zru/zru-python?branch=master)\n\n# Installation\n\nYou can install using `pip`:\n\n    pip install --upgrade zru-python\n    \nor `easy_install`\n\n    easy_install --upgrade zru-python\n\nor to install from source, run:\n\n    python setup.py install\n\n# Migration Guide for Versions Prior to 1.x.x\n\nIf you are migrating from a version prior to 1.x.x, you will need to update your import statements to reflect the change from mc2p to zru. Here is a guide to help you make these changes.\n\n### Updating Import Statements\n\nFor any imports that used the mc2p module, replace mc2p with zru.\n\n#### Example\n\nBefore:\n\n    from mc2p.errors import InvalidRequestError\n\nAfter:\n\n    from zru.errors import InvalidRequestError\n\n### Updating Client class\n\nReplace MC2PClient with ZRUClient.\n\n#### Example\n\nBefore:\n\n    client = MC2PClient(...)\n\nAfter:\n\n    client = ZRUClient(...)\n\n### Steps to Update Your Code\n\n1.  Search and Replace: Use your IDE or a text editor to search for mc2p and replace it with zru.\n2.  Verify Imports: Ensure all import statements now reference zru.\n3.  Run Tests: Run your test suite to verify that your code is functioning correctly with the updated imports.\n\n## Summary\n\nBy following these steps, you can successfully migrate your project from versions prior to 1.x.x, ensuring compatibility with the new zru module naming convention.\n\n# Quick Start Example\n\n    from zru import ZRU\n    \n    zru = ZRUClient('KEY', 'SECRET_KEY')\n    \n    # Create transaction\n    transaction = zru.Transaction({\n        \"currency\": \"EUR\",\n        \"products\": [{\n            \"amount\": 1,\n            \"product_id\": \"PRODUCT-ID\"\n        }]\n    })\n    # or with product details\n    transaction = zru.Transaction({\n        \"currency\": \"EUR\",\n        \"products\": [{\n            \"amount\": 1,\n            \"product\": {\n                \"name\": \"Product\",\n                \"price\": 5\n            }\n        }]\n    })\n    transaction.save()\n    transaction.pay_url # Send user to this url to pay\n    transaction.iframe_url # Use this url to show an iframe in your site\n\n    # Get plans\n    plans_paginator = zru.plan.list()\n    plans_paginator.count\n    plans_paginator.results # Application's plans\n    plans_paginator.get_next_list()\n    \n    # Get product, change and save\n    product = zru.Product.get(\"PRODUCT-ID\")\n    product.price = 10\n    product.save()\n    \n    # Create and delete tax\n    tax = zru.Tax({\n        \"name\": \"Tax\",\n        \"percent\": 5\n    })\n    tax.save()\n    tax.delete()\n    \n    # Check if transaction was paid\n    transaction = zru.Transaction.get(\"TRANSACTION-ID\")\n    transaction.status == 'D' # Paid\n    \n    # Create subscription\n    subscription = zru.Subscription({\n        \"currency\": \"EUR\",\n        \"plan_id\": \"PLAN-ID\",\n        \"note\": \"Note example\"\n    })\n    # or with plan details\n    subscription = zru.Subscription({\n        \"currency\": \"EUR\",\n        \"plan\": {\n            \"name\": \"Plan\",\n            \"price\": 5,\n            \"duration\": 1,\n            \"unit\": \"M\",\n            \"recurring\": True\n        },\n        \"note\": \"Note example\"\n    })\n    subscription.save()\n    subscription.pay_url # Send user to this url to pay\n    subscription.iframe_url # Use this url to show an iframe in your site\n\n    # Receive a notification\n    notification_data = zru.NotificationData(JSON_DICT_RECEIVED_FROM_ZRU)\n    notification_data.is_status_done # Paid\n    notification_data.transaction # Transaction Paid\n    notification_data.sale # Sale generated\n\n# Exceptions\n    \n    from zru.errors import InvalidRequestError\n    \n    # Incorrect data\n    shipping = zru.Shipping({\n        \"name\": \"Normal shipping\",\n        \"price\": \"text\" # Price must be number\n    })\n    try:\n        shipping.save()\n    except InvalidRequestError as e:\n        e._message # Status code of error\n        e.json_body # Info from server\n        e.resource # Resource used to make the server request\n        e.resource_id # Resource id requested\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "ZRU Python Bindings",
    "version": "1.0.0",
    "project_urls": {
        "Download": "https://github.com/zrupay/zru-python/archive/v1.0.0.tar.gz",
        "Homepage": "https://github.com/zrupay/zru-python"
    },
    "split_keywords": [
        "zru",
        " payments"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "19b019a6f0149be57374428ad8407c30f07ba2c22b9884bd6ea7d82e4818f50b",
                "md5": "8cb0482204bde8ddbc3336a0e30a455a",
                "sha256": "d220fdb05e3a7771d23f6d3d431efca25d4a1dd08bd3f6e909fe19a583a96ec4"
            },
            "downloads": -1,
            "filename": "zru_python-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "8cb0482204bde8ddbc3336a0e30a455a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 16813,
            "upload_time": "2024-07-09T15:33:28",
            "upload_time_iso_8601": "2024-07-09T15:33:28.481130Z",
            "url": "https://files.pythonhosted.org/packages/19/b0/19a6f0149be57374428ad8407c30f07ba2c22b9884bd6ea7d82e4818f50b/zru_python-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-09 15:33:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zrupay",
    "github_project": "zru-python",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "lcname": "zru-python"
}
        
ZRU
Elapsed time: 0.30080s