Download the PHP package cryptom2/magento-discount-token without Composer

On this page you can find all versions of the php package cryptom2/magento-discount-token. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package magento-discount-token

Crypto MagentoToken Magento 2 Extension

Magento 2 module allows to use ERC20 tokens as discount

Description

Extension allows to collect and use tokens, similar to customer balance functional. Tokens are charged after order placement and customer can use this balance as discount for new orders.

Additionally, customer can claim his tokens from magento store to own metamask wallet and use these tokens in another magento store.

Extension allows to implement complex discount or partnership program between magento stores.

This functional uses signed messages to sign claiming requests from store side and use signed message on customer side for claiming tokens. It means store owner does not need pay any GAS for sending tokens to customer. Customer pays all network taxes (gas) when use signed message to claim tokens in customer area.

Features

1) Collect 'local discount token' inside magento store for order 2) Use 'discount token' for new order to get discount 3) Customer can send withdraw request for claiming tokens from customer account 4) Store owner can sign customer's request using own metamask account 5) Customer can claim token in own account using signed message

Installation

To install module you need to add repositories to your composer.json:

Composer installation

composer require cryptom2/magento-discount-token:v1.0.0

Magento run

Settings

Checkout Payment Page

How to use

Deploy ERC20 Token and Control Smart Contract

Hardhat

To deploy ERC20 token and smart contract you can use Hardhat. Install hardhat and copy folders from hardhat folder in current module to hardhat root directory.

Then run from hardhat root directory:

npx hardhat node - to run node

npx hardhat run --network localhost .\scripts\deploy.js

Remix Ide

To deploy contracts using Remix IDE you need download IDE or use web remix IDE. You need copy all files from directory hardhat/contracts and:

1) deploy MagentoDiscountToken.sol 2) deploy ControlContract.sol using address of MagentoDiscountToken that you should get after step1.

Important:

you must use the same own address to deploy both contracts. This address should be 'store owner address' and you must have full control for this address.

Approve Control Contract Actions

After deploying both contracts and ERC20 token you will have 1 million tokens on your address.

And you need allow control contract to manage your tokens to allow customers claim it. To allow control contract to manage your tokens you need run approve function on MagentoDiscountToken.

There is necessary to input Control Smart Contract Address in field spender and amount of tokens in field amount that smart contract can use.

Checkout Payment Page

Remember - you have 1 mln tokens, but totalsupply will show you 1 000 000 * 10**18. It was made to imitate the same relation as Ether and Wei, so it allows to implement decimals with 18 zero after dot.

So to allow your smart contract use only 2000 of tokens from your account you should input 2000 * 10**18, final amount will be 2000000000000000000000.

Screenshots

Menu

Admin panel has 4 menu:

Admin Menu

Withdraw Requests

There is possible to sign request using your metamask. Signing is not use any gas and it is only local operation. After signing message request will change status and customer can claim tokens using signed message hash.

Withdraw Request

Customer Token Balance Page

Customer page with balances. Customer can:

Withdraw Request

TODO

Author

Ihor Oleksiienko

License

Magento ERC20 Discount Token extension for Magento 2 is licensed under the MIT License - see the LICENSE file for details


All versions of magento-discount-token with dependencies

PHP Build Version
Package Version
Requires cryptom2/base Version ~1.0.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package cryptom2/magento-discount-token contains the following files

Loading the files please wait ....