Download the PHP package clippings/purchases without Composer
On this page you can find all versions of the php package clippings/purchases. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download clippings/purchases
More information about clippings/purchases
Files in clippings/purchases
Package purchases
Short Description Multi-Store Marketplace Core Components
License BSD-3-Clause
Informations about the package purchases
Purchases
This is a Kohana module that gives you out of the box functionality for multi-store purchases (each purchase may have Items from different sellers, each handling their portion of products independently)
It utilizes omnipay package
Usage
The provided models work out of the box. You'll also have "Product" and "Store" models that you should use and extend.
A diagram of the models
Purchase is comprised of "PurchaseItems", a model which holds all the items that the user purchases.ProductItem exteds PurchaseItem so that they share the same table, using IheritedTrait.
Each PurchaseItem however, also belongs to a "StorePurchase" model, that represents the purchase for a specific store. This relation is managed automatically when you add products via the "addProduct" method or addPurchaseItem
Adding items to a purchase
As the product already belongs to a specific store, this will create a specific StorePurchase for that store, if none exists. otherwise it will add the item to the existing StorePurchase. If this product already is present in the form of ProductItem, then it will increment the quantity.
If you need to add some other type of purchase item, that does not have an intrinsic relationship with a store, you can use the addPurchaseItem method. It will add any type of PurchaseItem.
Freezing assets
Since purchases use harp-orm/transfers package, it has the ability to "freeze" the values of purchase items when a purchase is actually completed.
Freezing works by setting an "isFrozen" flag explicitly, so that later calls on freeze()
will not recalculate values. You can take advantage of this by explicitly setting this flag to false for specific items and calling freeze()
againg, to "refreeze" those values.
If you freeze a Purchase all the related PurchaseItems and StorePurchases will be frozen alongside it.
Currency Calculatens
Purchases have a "currency" value that all the purchase items use. Any products with different currency will be converted using harp-orm/money. That's why purchase items will not function properly, until they are attached to a purchase, which holds the currency for them.
Refunding
You can refund individual store purchases in full or with a partial amount.
The refund object has a validation for its value, so that you do not refund more than the remaining amount for the store purchase, taking into account previous refunds.
License
Copyright (c) 2014, Clippings Ltd. Developed by Ivan Kerin
Under BSD-3-Clause license, read LICENSE file.
All versions of purchases with dependencies
harp-orm/locations Version ~0.3.0
harp-orm/timestamps Version ~0.3.0
harp-orm/random-key Version ~0.3.0
clippings/transfer Version ~0.2.0