-
Notifications
You must be signed in to change notification settings - Fork 355
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8205935
commit e03dfb7
Showing
3 changed files
with
228 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
<?php | ||
|
||
namespace Lunar\Tests\Core\Stubs; | ||
|
||
use Illuminate\Support\Collection; | ||
use Lunar\Base\Purchasable; | ||
use Lunar\DataTypes\Price; | ||
use Lunar\Models\TaxClass; | ||
|
||
class TestPurchasable implements Purchasable | ||
{ | ||
public function __construct( | ||
public $name, | ||
public $description, | ||
public $identifier, | ||
public Price $price, | ||
public TaxClass $taxClass, | ||
public $taxReference = null, | ||
public $option = null, | ||
public bool $collect = false, | ||
public $meta = null | ||
) { | ||
// .. | ||
} | ||
|
||
/** | ||
* Get the price for the purchasable item. | ||
* | ||
* @return \Lunar\DataTypes\Price | ||
*/ | ||
public function getPrice() | ||
{ | ||
return $this->price; | ||
} | ||
|
||
/** | ||
* Get prices for the purchasable item. | ||
*/ | ||
public function getPrices(): Collection | ||
{ | ||
return collect([ | ||
$this->price, | ||
]); | ||
} | ||
|
||
/** | ||
* Return the purchasable unit quantity. | ||
*/ | ||
public function getUnitQuantity(): int | ||
{ | ||
return 1; | ||
} | ||
|
||
/** | ||
* Return the purchasable tax class. | ||
*/ | ||
public function getTaxClass(): TaxClass | ||
{ | ||
return $this->taxClass; | ||
} | ||
|
||
/** | ||
* Return the purchasable tax reference. | ||
* | ||
* @return string|null | ||
*/ | ||
public function getTaxReference() | ||
{ | ||
return $this->taxReference; | ||
} | ||
|
||
/** | ||
* Return what type of purchasable this is, i.e. physical,digital,shipping. | ||
* | ||
* @return string | ||
*/ | ||
public function getType() | ||
{ | ||
return 'test-purchsable'; | ||
} | ||
|
||
/** | ||
* Return the name for the purchasable. | ||
* | ||
* @return string | ||
*/ | ||
public function getName() | ||
{ | ||
return $this->name; | ||
} | ||
|
||
/** | ||
* Return the description for the purchasable. | ||
* | ||
* @return string | ||
*/ | ||
public function getDescription() | ||
{ | ||
return $this->description; | ||
} | ||
|
||
/** | ||
* Return the option for this purchasable. | ||
* | ||
* @return string|null | ||
*/ | ||
public function getOption() | ||
{ | ||
return $this->option; | ||
} | ||
|
||
/** | ||
* Return a unique string which identifies the purchasable item. | ||
* | ||
* @return string | ||
*/ | ||
public function getIdentifier() | ||
{ | ||
return $this->identifier; | ||
} | ||
|
||
/** | ||
* Returns whether the purchasable item is shippable. | ||
* | ||
* @return bool | ||
*/ | ||
public function isShippable() | ||
{ | ||
return false; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function getThumbnail() | ||
{ | ||
return null; | ||
} | ||
|
||
/** | ||
* Return whether the purchasable can be fulfilled at a given quantity | ||
*/ | ||
public function canBeFulfilledAtQuantity(int $quantity): bool | ||
{ | ||
return true; | ||
} | ||
|
||
/** | ||
* Returns the total inventory the purchasable has available | ||
*/ | ||
public function getTotalInventory(): int | ||
{ | ||
return 999; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters