scrathon-payments


Namescrathon-payments JSON
Version 0.1.5 PyPI version JSON
download
home_pagehttps://github.com/Ryan-shamu-YT/ScrathonPayments
SummaryAPI Wrapper for ScrathonPayments
upload_time2024-04-19 14:19:14
maintainerNone
docs_urlNone
authorRyan_shamu
requires_python>=3.6
licenseNone
keywords scratch api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Scrathon

Scrathon is a Python package designed to interact with the Scrathon platform to allow for purchases in your projects.

## Installation

You can install Scrathon via pip: ```pip install scrathon-payments```

## Usage with [Scratchattach](https://github.com/TimMcCool/scratchattach)

To use Scrathon, you need to instantiate the `Scrathon` class with a valid username. This username will be used to authenticate and perform transactions on the Scrathon platform.


```python
import scratchattach as scratch3
from ScrathonPayments import Scrathon #pip install scrathon-payments

session = scratch3.login("USERNAME_OF_ANY_ACCOUNT_(ACCOUNT_CAN_BE_NEW_SCRATCHER)", "PASSWORD")

conn = session.connect_cloud("YOUR_PROJECT_ID")

ScrathonPayments = Scrathon("USERNAME_OF_ACCOUNT_TO_RECEIVE_FUNDS")

client = scratch3.CloudRequests(conn)

@client.request
def purchase(username, Price):
    Purchase = ScrathonPayments.purchase(Price, username)
    result = "None"
    if Purchase == "You have been banned from selling items in your projects!":
        result = "Fail!"
        
        #In scratch, tell the user the transaction failed
        
    elif Purchase == "User does not have enough money to buy the item!":
        result = "Not enough coins!"
        #In scratch, tell the user they do not have enough coins to make the purchase
    elif Purchase == "Transaction has been added to pending transactions, transaction will go through once the user has confirmed!":
        #In scratch, tell your users to look at the comments of the Scrathon project and find their verification comment in the project's comments, reply to it with 'yes' and the transaction will go through!
        result = "Success!"
    
    return result

@client.request
def purchasecheck(username, Price): #Check if the player bought the item so you can give them the promised item (If you don't give the item to the player you will get banned from selling items)
    PurchaseCheck = ScrathonPayments.purchasecheck(Price, username)

    return PurchaseCheck

client.run()
```


## Methods
```purchase() ```   *Initiates a purchase transaction.*

| Parameter | Type     | Description                |
| :-------- | :------- | :------------------------- |
| `Price` | `int` | **Required**. Price the buyer is paying |
| `User` | `str` | **Required**. User paying for your item |

Returns:
```
Status of the transaction, e.g: 
"Transaction has been added to pending transactions, transaction will go through once the user has confirmed!"

"User does not have enough money to buy the item!""

and "You have been banned from selling items in your projects!"
```

```purchasecheck()```  *Checks the status of a purchase transaction.*

| Parameter | Type     | Description                |
| :-------- | :------- | :------------------------- |
| `Price` | `int` | **Required**. Price the buyer had paid |
| `User` | `str` | **Required**. User who paid for your item |

Returns:
```
True: The transaction went through (give their item)

False: The transaction did not go through!
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Ryan-shamu-YT/ScrathonPayments",
    "name": "scrathon-payments",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "scratch, api",
    "author": "Ryan_shamu",
    "author_email": "Ryanshamu418@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/4d/8f/d122699c0c09cc331f517bf3de816e92e288162c883ae5130b22f5a8805f/scrathon_payments-0.1.5.tar.gz",
    "platform": null,
    "description": "# Scrathon\n\nScrathon is a Python package designed to interact with the Scrathon platform to allow for purchases in your projects.\n\n## Installation\n\nYou can install Scrathon via pip: ```pip install scrathon-payments```\n\n## Usage with [Scratchattach](https://github.com/TimMcCool/scratchattach)\n\nTo use Scrathon, you need to instantiate the `Scrathon` class with a valid username. This username will be used to authenticate and perform transactions on the Scrathon platform.\n\n\n```python\nimport scratchattach as scratch3\nfrom ScrathonPayments import Scrathon #pip install scrathon-payments\n\nsession = scratch3.login(\"USERNAME_OF_ANY_ACCOUNT_(ACCOUNT_CAN_BE_NEW_SCRATCHER)\", \"PASSWORD\")\n\nconn = session.connect_cloud(\"YOUR_PROJECT_ID\")\n\nScrathonPayments = Scrathon(\"USERNAME_OF_ACCOUNT_TO_RECEIVE_FUNDS\")\n\nclient = scratch3.CloudRequests(conn)\n\n@client.request\ndef purchase(username, Price):\n    Purchase = ScrathonPayments.purchase(Price, username)\n    result = \"None\"\n    if Purchase == \"You have been banned from selling items in your projects!\":\n        result = \"Fail!\"\n        \n        #In scratch, tell the user the transaction failed\n        \n    elif Purchase == \"User does not have enough money to buy the item!\":\n        result = \"Not enough coins!\"\n        #In scratch, tell the user they do not have enough coins to make the purchase\n    elif Purchase == \"Transaction has been added to pending transactions, transaction will go through once the user has confirmed!\":\n        #In scratch, tell your users to look at the comments of the Scrathon project and find their verification comment in the project's comments, reply to it with 'yes' and the transaction will go through!\n        result = \"Success!\"\n    \n    return result\n\n@client.request\ndef purchasecheck(username, Price): #Check if the player bought the item so you can give them the promised item (If you don't give the item to the player you will get banned from selling items)\n    PurchaseCheck = ScrathonPayments.purchasecheck(Price, username)\n\n    return PurchaseCheck\n\nclient.run()\n```\n\n\n## Methods\n```purchase() ```   *Initiates a purchase transaction.*\n\n| Parameter | Type     | Description                |\n| :-------- | :------- | :------------------------- |\n| `Price` | `int` | **Required**. Price the buyer is paying |\n| `User` | `str` | **Required**. User paying for your item |\n\nReturns:\n```\nStatus of the transaction, e.g: \n\"Transaction has been added to pending transactions, transaction will go through once the user has confirmed!\"\n\n\"User does not have enough money to buy the item!\"\"\n\nand \"You have been banned from selling items in your projects!\"\n```\n\n```purchasecheck()```  *Checks the status of a purchase transaction.*\n\n| Parameter | Type     | Description                |\n| :-------- | :------- | :------------------------- |\n| `Price` | `int` | **Required**. Price the buyer had paid |\n| `User` | `str` | **Required**. User who paid for your item |\n\nReturns:\n```\nTrue: The transaction went through (give their item)\n\nFalse: The transaction did not go through!\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "API Wrapper for ScrathonPayments",
    "version": "0.1.5",
    "project_urls": {
        "Homepage": "https://github.com/Ryan-shamu-YT/ScrathonPayments"
    },
    "split_keywords": [
        "scratch",
        " api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "464e51473305308e861ba37735746bb97b51f8269c7ac89c68b0282774072196",
                "md5": "2e1fd6bab817b943038d17764bdf0f9c",
                "sha256": "52f20674408d88ca585c0edd2f0a54c6e193bda368662fdc571951af258d7f2b"
            },
            "downloads": -1,
            "filename": "scrathon_payments-0.1.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2e1fd6bab817b943038d17764bdf0f9c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 3862,
            "upload_time": "2024-04-19T14:19:12",
            "upload_time_iso_8601": "2024-04-19T14:19:12.970298Z",
            "url": "https://files.pythonhosted.org/packages/46/4e/51473305308e861ba37735746bb97b51f8269c7ac89c68b0282774072196/scrathon_payments-0.1.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4d8fd122699c0c09cc331f517bf3de816e92e288162c883ae5130b22f5a8805f",
                "md5": "bd0b32107f703f8ed20c733d5637b7c3",
                "sha256": "d1b8300b79becec7ea3c15e389c8b75a400c962a853867c66f2876b967289599"
            },
            "downloads": -1,
            "filename": "scrathon_payments-0.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "bd0b32107f703f8ed20c733d5637b7c3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 3549,
            "upload_time": "2024-04-19T14:19:14",
            "upload_time_iso_8601": "2024-04-19T14:19:14.455660Z",
            "url": "https://files.pythonhosted.org/packages/4d/8f/d122699c0c09cc331f517bf3de816e92e288162c883ae5130b22f5a8805f/scrathon_payments-0.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-19 14:19:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Ryan-shamu-YT",
    "github_project": "ScrathonPayments",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "scrathon-payments"
}
        
Elapsed time: 0.24674s