Skip to content

Commit eaa8028

Browse files
author
Igor Alekseenko
committed
Magento 2 NFT Loyalty Extension
Magento 2 NFT Loyalty Extension
1 parent 90cf108 commit eaa8028

File tree

85 files changed

+187396
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+187396
-0
lines changed

Api/Data/NftInterface.php

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<?php
2+
/*
3+
* Copyright © Ihor Oleksiienko (https://github.com/torys877)
4+
* See LICENSE for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Crypto\NftLoyalty\Api\Data;
9+
10+
interface NftInterface
11+
{
12+
/**
13+
* String constants for property names
14+
*/
15+
const ENTITY_ID = "entity_id";
16+
const NFT_ADDRESS = "nft_address";
17+
const NFT_NAME = "nft_name";
18+
const NFT_SYMBOL = "nft_symbol";
19+
const NFT_CONTRACT_ABI = "nft_contract_abi";
20+
21+
/**
22+
* Identifier getter
23+
*
24+
* @return mixed
25+
*/
26+
public function getId();
27+
28+
/**
29+
* Identifier setter
30+
*
31+
* @param mixed $value
32+
* @return $this
33+
*/
34+
public function setId($value);
35+
36+
/**
37+
* Getter for NftAddress.
38+
* @return string|null
39+
*/
40+
public function getNftAddress(): ?string;
41+
42+
/**
43+
* Setter for NftAddress.
44+
*
45+
* @param string $nftAddress
46+
* @return self
47+
*/
48+
public function setNftAddress(string $nftAddress): self;
49+
50+
/**
51+
* Getter for NftName.
52+
* @return string|null
53+
*/
54+
public function getNftName(): ?string;
55+
56+
/**
57+
* Setter for NftName.
58+
*
59+
* @param string $nftName
60+
* @return self
61+
*/
62+
public function setNftName(string $nftName): self;
63+
64+
/**
65+
* Getter for NftName.
66+
* @return string|null
67+
*/
68+
public function getNftSymbol(): ?string;
69+
70+
/**
71+
* Setter for NftName.
72+
*
73+
* @param string $nftSymbol
74+
* @return self
75+
*/
76+
public function setNftSymbol(string $nftSymbol): self;
77+
78+
/**
79+
* Getter for NftContractAbi.
80+
* @return string|null
81+
*/
82+
public function getNftContractAbi(): ?string;
83+
84+
/**
85+
* Setter for NftContractAbi.
86+
*
87+
* @param string $nftAbi
88+
* @return self
89+
*/
90+
public function setNftContractAbi(string $nftAbi): self;
91+
}

Api/Data/NftQuoteInterface.php

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<?php
2+
/*
3+
* Copyright © Ihor Oleksiienko (https://github.com/torys877)
4+
* See LICENSE for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Crypto\NftLoyalty\Api\Data;
9+
10+
interface NftQuoteInterface
11+
{
12+
/**
13+
* String constants for property names
14+
*/
15+
const ENTITY_ID = "entity_id";
16+
const NFT_ID = "nft_id";
17+
const QUOTE_ID = "quote_id";
18+
const BALANCE_OF = "balance_of";
19+
20+
/**
21+
* Identifier getter
22+
*
23+
* @return mixed
24+
*/
25+
public function getId();
26+
27+
/**
28+
* Identifier setter
29+
*
30+
* @param mixed $value
31+
* @return $this
32+
*/
33+
public function setId($value);
34+
35+
/**
36+
* Getter for NftId.
37+
*
38+
* @return int|null
39+
*/
40+
public function getNftId(): ?int;
41+
42+
/**
43+
* Setter for NftId.
44+
*
45+
* @param int $nftId
46+
*
47+
* @return self
48+
*/
49+
public function setNftId(int $nftId): self;
50+
51+
/**
52+
* Getter for QuoteId.
53+
*
54+
* @return int|null
55+
*/
56+
public function getQuoteId(): ?int;
57+
58+
/**
59+
* Setter for QuoteId.
60+
*
61+
* @param int $quoteId
62+
*
63+
* @return self
64+
*/
65+
public function setQuoteId(int $quoteId): self;
66+
67+
/**
68+
* Getter for Balance Of Nft.
69+
*
70+
* @return int|null
71+
*/
72+
public function getBalanceOf(): ?int;
73+
74+
/**
75+
* Setter for Balance Of Nft.
76+
*
77+
* @param int $balanceOf
78+
*
79+
* @return self
80+
*/
81+
public function setBalanceOf(int $balanceOf): self;
82+
}

Api/NftManagementInterface.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
/*
3+
* Copyright © Ihor Oleksiienko (https://github.com/torys877)
4+
* See LICENSE for license details.
5+
*/
6+
7+
namespace Crypto\NftLoyalty\Api;
8+
9+
/**
10+
* Nft Loyalty management interface.
11+
* @api
12+
* @since 100.0.2
13+
*/
14+
interface NftManagementInterface
15+
{
16+
/**
17+
* Return information for a nft in a specified cart.
18+
*
19+
* @param string $cartId The cart ID.
20+
* @return string The nft data.
21+
* @throws \Magento\Framework\Exception\NoSuchEntityException The specified cart does not exist.
22+
*/
23+
public function get($cartId);
24+
25+
/**
26+
* Add a nft by code to a specified cart.
27+
*
28+
* @param string $cartId The cart ID.
29+
* @param string $customerAddress The customer address for applying NFT.
30+
* @return bool
31+
* @throws \Magento\Framework\Exception\NoSuchEntityException The specified cart does not exist.
32+
* @throws \Magento\Framework\Exception\CouldNotSaveException The specified could not be added.
33+
*/
34+
public function apply($cartId, $customerAddress);
35+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
/*
3+
* Copyright © Ihor Oleksiienko (https://github.com/torys877)
4+
* See LICENSE for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Crypto\NftLoyalty\Api;
9+
10+
use Magento\Framework\Exception\CouldNotSaveException;
11+
use Magento\Framework\Exception\NoSuchEntityException;
12+
use Crypto\NftLoyalty\Api\Data\NftQuoteInterface;
13+
use Crypto\NftLoyalty\Model\ResourceModel\NftQuote\Collection;
14+
15+
interface NftQuoteRepositoryInterface
16+
{
17+
/**
18+
* @param int $entityId
19+
* @return NftQuoteInterface
20+
* @throws NoSuchEntityException
21+
*/
22+
public function getById(int $entityId): NftQuoteInterface;
23+
24+
/**
25+
* @param int $quoteId
26+
* @return Collection
27+
* @throws NoSuchEntityException
28+
*/
29+
public function getListByQuoteId(int $quoteId): Collection;
30+
31+
/**
32+
* @param string $quoteId
33+
* @param int $nftId
34+
* @return NftQuoteInterface
35+
* @throws NoSuchEntityException
36+
*/
37+
public function getByQuoteAndNftId(int $quoteId, int $nftId): NftQuoteInterface;
38+
39+
/**
40+
*
41+
* @param NftQuoteInterface $nft
42+
* @return NftQuoteInterface
43+
* @throws CouldNotSaveException
44+
*/
45+
public function save(NftQuoteInterface $nft): NftQuoteInterface;
46+
}

Api/NftRepositoryInterface.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
/*
3+
* Copyright © Ihor Oleksiienko (https://github.com/torys877)
4+
* See LICENSE for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Crypto\NftLoyalty\Api;
9+
10+
use Magento\Framework\Exception\CouldNotSaveException;
11+
use Magento\Framework\Exception\NoSuchEntityException;
12+
use Crypto\NftLoyalty\Api\Data\NftInterface;
13+
use Crypto\NftLoyalty\Model\ResourceModel\Nft\Collection;
14+
15+
interface NftRepositoryInterface
16+
{
17+
/**
18+
* @param int $nftId
19+
* @return NftInterface
20+
* @throws NoSuchEntityException
21+
*/
22+
public function getById(int $nftId): NftInterface;
23+
24+
/**
25+
* @param string $nftAddress
26+
* @return NftInterface
27+
* @throws NoSuchEntityException
28+
*/
29+
public function getByNftAddress(string $nftAddress): NftInterface;
30+
31+
/**
32+
*
33+
* @param NftInterface $nft
34+
* @return NftInterface
35+
* @throws CouldNotSaveException
36+
*/
37+
public function save(NftInterface $nft): NftInterface;
38+
39+
40+
/**
41+
* @return Collection
42+
*/
43+
public function getAll(): Collection;
44+
}

0 commit comments

Comments
 (0)