Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor #58

Closed
wants to merge 220 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
220 commits
Select commit Hold shift + click to select a range
cbbb6ec
Update .travis.yml
cordoval Dec 2, 2012
886da32
Merge pull request #19 from cordoval/patch-1
Dec 2, 2012
48b4130
Added partner models & interfaces
inspiran Dec 30, 2012
cbb5d62
Update composer.json
cordoval Jan 8, 2013
7040d48
Merge pull request #27 from cordoval/patch-3
Jan 8, 2013
1d539d5
move cart and order related entities into Order namespace
Jul 14, 2012
232b980
update the tests to match the Order namespace reorganization
Jul 15, 2012
23d5483
add a test to make sure the product ValidationOptions is called
Jul 15, 2012
f43d270
add product ValidateOptions
Jul 15, 2012
bcf7514
remove option functionality except set and clear. It doesn't make sen…
Jul 15, 2012
30eadd6
add some simple event dispatching
Jul 16, 2012
5c1342d
create an Event class, update interface
Jul 16, 2012
e781558
add setting and getting a name for the cart
Jul 16, 2012
7794691
move the excpetions out of the Entity namespace
Jul 17, 2012
c414c06
allow the Product to be set when an Item is constructed
Jul 17, 2012
a88d663
add PricingSet to entities
Jul 17, 2012
0bae23b
add pricingSet to Item
Jul 17, 2012
7705c57
fix namespace in pricingset
Jul 18, 2012
4802596
updates to items concerning the pricing set
Jul 26, 2012
94681fc
add pricing context to entities
Jul 26, 2012
48a68e4
add a test to make sure the product ValidationOptions is called
Jul 15, 2012
0066d5e
add product ValidateOptions
Jul 15, 2012
611a534
remove option functionality except set and clear. It doesn't make sen…
Jul 15, 2012
2df6178
move the excpetions out of the Entity namespace
Jul 17, 2012
c159dc5
allow the Product to be set when an Item is constructed
Jul 17, 2012
c979e81
add pricingSet to Item
Jul 17, 2012
4d2d4cc
updates to items concerning the pricing set
Jul 26, 2012
ceabac3
use the php Exception, since this section of code is going to be refa…
Jul 29, 2012
eea928f
add methods to auto set the created at and updated at timestamps
Jul 29, 2012
d46ae34
fucking typo
Jul 29, 2012
9d4d51f
add $id to entity
Jul 29, 2012
425bb7b
create a new event from dispatcher
Aug 3, 2012
0a87311
remove name from the createEvent params, add api docs
Aug 3, 2012
31fcf00
update CartEvents consts
Aug 3, 2012
fb75240
remove Event from Core, it must be implement based on the system
Aug 3, 2012
296483f
change method names from (s)(g)etPricingSet to (s)(g)etPricing
Aug 30, 2012
daba9d6
update the tests to match the Order namespace reorganization
Jul 15, 2012
e1b89c9
add a test to make sure the product ValidationOptions is called
Jul 15, 2012
6382516
add product ValidateOptions
Jul 15, 2012
d256a14
remove option functionality except set and clear. It doesn't make sen…
Jul 15, 2012
3d8d20d
create an Event class, update interface
Jul 16, 2012
852465e
move the excpetions out of the Entity namespace
Jul 17, 2012
457dbbd
allow the Product to be set when an Item is constructed
Jul 17, 2012
96c72c0
add a test to make sure the product ValidationOptions is called
Jul 15, 2012
0359964
add product ValidateOptions
Jul 15, 2012
65f9339
remove option functionality except set and clear. It doesn't make sen…
Jul 15, 2012
0eef320
move the excpetions out of the Entity namespace
Jul 17, 2012
d29d05b
allow the Product to be set when an Item is constructed
Jul 17, 2012
d14434d
remove Event from Core, it must be implement based on the system
Aug 3, 2012
ada88d0
move product classes into product folder
Sep 2, 2012
331ec04
extract a base product class to be shared between product and merchan…
Sep 2, 2012
b9f97a4
remove base product functions from product
Sep 2, 2012
824c9ec
add Merchandise
Sep 2, 2012
5b28c3f
fix typo
Sep 2, 2012
7428427
CS
Sep 2, 2012
c3b0432
load product into merchandise
Sep 5, 2012
1335e08
add asset from ProductBundle
Sep 8, 2012
523ec7e
change filename to src to better reflect what its job is
Sep 8, 2012
189cce2
CS
Sep 8, 2012
6dbf1e1
add media to base product class, get tests passing
Sep 8, 2012
d205768
add assets to merchandise
Sep 8, 2012
c42203a
typo in folder name
Sep 8, 2012
2446862
updates for loading Product into Merchandise
Sep 8, 2012
4ca9da8
add setter and getter for slug
Sep 9, 2012
e886fc9
add taxonomy to products
Sep 14, 2012
6d6cc1f
add SalesChannel to core
Sep 19, 2012
9fb6b44
changes SalesChannel to Channel
Oct 10, 2012
66640e0
rename the Feature class Attribute
Oct 17, 2012
ad8f185
get rid of stray FeatureInterface
Oct 17, 2012
cf6dc97
Add $id to BaseProduct
Oct 24, 2012
d9cbdf7
Namespace fix
Nov 13, 2012
6de51d7
move taxonomy from taxonomy library
Nov 18, 2012
bf46ef6
namespace fix
Nov 18, 2012
dfd0dbf
namespace fixes
Nov 18, 2012
41375f9
fix namespace in test
Nov 18, 2012
f41f00e
typo
Nov 18, 2012
3f21fea
namespace fix
Nov 18, 2012
36c6cfa
updates to properties
Nov 19, 2012
380c8f3
remove redundant properties
Nov 26, 2012
ab82974
initial commit of PricingElement
Nov 26, 2012
98b8c3f
add interfaces for proccesing and getting the processed value
Nov 26, 2012
2cebc26
add interface to PricingContext for the quantity of items
Nov 30, 2012
8682fa5
tests for updates in interface
Nov 30, 2012
cafbbb9
fix failing test due to unimplemented quantity accessors and default …
cordoval Dec 2, 2012
36aea09
== --> === on the very off chance to be 0
cordoval Dec 7, 2012
917c415
fix test the right way affecting Merchant constructor rather than test
cordoval Dec 7, 2012
825830f
move invoice classes into Invoice namespace
Jan 12, 2013
1ae5616
add Orders to the Invoice
Jan 12, 2013
7a43444
add methods to invoice class
Jan 12, 2013
7bb7db1
move properties and methods from Cart to BaseOrder
Jan 12, 2013
c8e40ec
add billing period to Invoice
Jan 12, 2013
50d782c
updates to classes and add tests for mapping
Jan 14, 2013
9cdf634
add InvalidInterfaceException
Jan 15, 2013
262ef1f
add fluency to BaseProduct
Jan 16, 2013
87f99cb
add attributes to items that can carry additional information about t…
Jan 16, 2013
315f0f0
make the incomplete test
Jan 16, 2013
3cc58ff
sample of refactor for fluent interface
cordoval Jan 15, 2013
49117c2
add and fix more fluency
cordoval Jan 15, 2013
d2a377e
some more
cordoval Jan 15, 2013
9544c48
make partner more fluent and fix test
cordoval Jan 16, 2013
b44ab71
more fluency
cordoval Jan 16, 2013
c6ff121
move interfaces from billing bundle to core
cordoval Jan 16, 2013
e37ab4a
move manager interface to VespolinaBilling
Jan 18, 2013
97a3092
fix filename
Jan 18, 2013
aa08c17
add addition methods to BillingAgreementInterface, implement
Jan 18, 2013
164b481
inital commit
Jan 22, 2013
5bb9f26
update the tests to the current needs
Jan 22, 2013
8c0f2ff
update test, start implementing
Jan 22, 2013
fa5c333
Update composer.json
cordoval Jan 22, 2013
1fbe120
prepare and fix autoload
cordoval Jan 22, 2013
6975fd0
move things inside an il folder
cordoval Jan 22, 2013
ec70203
fix namespace and add method add element
cordoval Jan 22, 2013
8161227
add setNetValue method and various fixes
cordoval Jan 22, 2013
94193db
implement addElement
cordoval Jan 22, 2013
cc055c4
wip add id and mapping to pricing element
cordoval Jan 22, 2013
70a52a3
fixed entities
theodorDiaconu Jan 22, 2013
4828127
added pricing provider
theodorDiaconu Jan 22, 2013
f2a743f
pricing set updates
theodorDiaconu Jan 22, 2013
3f943cc
add initial charge to recurring element
Jan 23, 2013
334bfcb
use netValue as the the initial charge, set recurring charge as its o…
Jan 23, 2013
4a35b06
get the tests for pricing sets working
Jan 23, 2013
5ed4186
update the provder to use PricingSet object
Jan 23, 2013
70b7799
temp commenting
cordoval Jan 24, 2013
bdd73fa
update the mapping for PricingElement
Jan 24, 2013
7e557b4
fix for the case where getPricingElements returns array() and process…
cordoval Jan 24, 2013
e4ad35e
updated order
theodorDiaconu Jan 24, 2013
9f284c3
updated orderpricing
theodorDiaconu Jan 24, 2013
85b3b86
add fluency
cordoval Jan 26, 2013
b366385
update mapping for pricing set and elements
Jan 26, 2013
1ed3120
fix process for adding items price in order
Jan 26, 2013
f00c2d4
updated pricing set and order price provider
theodorDiaconu Jan 27, 2013
1218d53
removed interface from pricinv provider [temporarily only]
theodorDiaconu Jan 27, 2013
e1b85fd
updated pricing set and recurring element
theodorDiaconu Jan 28, 2013
e264fc0
fixed pricing provider when no pricing context supplied
theodorDiaconu Jan 28, 2013
bb8a430
handle missing processed key
Jan 29, 2013
7e0256d
handle startsOn date in RecurringElement::process()
Jan 29, 2013
af2ad82
changes
theodorDiaconu Jan 18, 2013
24abc76
Fixed doctrine mapping error
jcroll Jan 18, 2013
a8bf5ab
put body of cart into order entity
cordoval Jan 19, 2013
079fe7a
added base partner
theodorDiaconu Jan 19, 2013
9c3224b
modified back to parent
theodorDiaconu Jan 19, 2013
85b598f
removed duplicate
theodorDiaconu Jan 19, 2013
fd6540e
product
theodorDiaconu Jan 19, 2013
5e1dcba
added ids
theodorDiaconu Jan 19, 2013
f80fced
add pricing recurring element
Jan 19, 2013
4d443f2
remove some line breaks
cordoval Jan 20, 2013
2cf00dd
update partner interface to use the new interface
cordoval Jan 20, 2013
cc63b34
remove some line breaks
cordoval Jan 21, 2013
9464e66
fix relations and add form types
cordoval Jan 21, 2013
194a89a
wip
cordoval Jan 21, 2013
6a69e4e
updates to pricing
Jan 22, 2013
ee337bc
fix interface for pricing element
cordoval Jan 22, 2013
1453f12
add arg to process on pricing element interface
cordoval Jan 22, 2013
f977485
switch setPrice to setPriceSet
cordoval Jan 22, 2013
84e1aa6
alter getPriceSet to getPricingSet
cordoval Jan 22, 2013
8a103fb
pricing sets updates
theodorDiaconu Jan 22, 2013
1a43f2c
base order updates
theodorDiaconu Jan 22, 2013
ff3a3a6
patch
cordoval Jan 23, 2013
2c86306
Added the attributes for the addresses collection in form type
jmgtan Jan 23, 2013
1861da7
updated pricing
theodorDiaconu Jan 23, 2013
dde0c91
Added constructor for one-to-many association
jcroll Jan 23, 2013
b0ccb03
addition information for the BillingAgreement
Jan 23, 2013
d27094f
make details from partner fluent
cordoval Jan 24, 2013
fa1e541
add shortname property
cordoval Jan 24, 2013
e3dabc0
Tell whether partner is paying by credit card
jcroll Jan 24, 2013
9e9eaab
Added radio for isPayByCreditCard
jcroll Jan 24, 2013
c27203f
added payment profile and linked partner to it
theodorDiaconu Jan 24, 2013
517a5bb
added pay profile on construct
theodorDiaconu Jan 24, 2013
1dfd42c
fix docblock on OrderInterface
cordoval Jan 24, 2013
ef46ab1
fluid interface
jcroll Jan 24, 2013
ffe8fcf
modified attributes for product
theodorDiaconu Jan 24, 2013
89f5f33
attribute interface back, and fixed item and orders
theodorDiaconu Jan 24, 2013
2c99c0f
additions to BillingAgreement
Jan 24, 2013
966d7c8
add initial state of some properties for BillingAgreement
Jan 25, 2013
d894f57
add BillingRequest class
Jan 25, 2013
f3856f5
add missing use statement and add slug fluency
cordoval Jan 26, 2013
9f9f29c
events update
theodorDiaconu Jan 27, 2013
6cf26db
Update lib/Vespolina/Entity/Order/OrderEvents.php
cordoval Jan 28, 2013
c0ac76a
fixed getParent @return
theodorDiaconu Jan 28, 2013
491edb6
Trying to create inheritance
jcroll Jan 25, 2013
8e33643
Moved address to parent class
jcroll Jan 29, 2013
9269115
fixed entities to work with the new mapping
theodorDiaconu Jan 29, 2013
ecb42c2
wip
cordoval Jan 29, 2013
d4a54b9
fix couple of docblocks
cordoval Jan 29, 2013
8da4a7b
More address properties
jcroll Jan 29, 2013
df2f9ad
update to use Pimple extended PricingContext
Jan 31, 2013
60565c1
plus method for adding one pricing set to another
Feb 1, 2013
d78fd2a
allow plus() to work with null set
Feb 1, 2013
d768afe
skip non scalars in plus()
Feb 1, 2013
028b3d0
Changed from using vespolina_address to payment profile for the billi…
jmgtan Feb 6, 2013
ef2cca8
small check on partner existence
theodorDiaconu Feb 6, 2013
27ec95d
Added missing interfaces
inspiran Feb 6, 2013
81aad9e
change in the behavior on the recurring intervals
Feb 6, 2013
6344187
remove unneeded forms
Feb 7, 2013
0ae4adf
Fixed namespace issue with TotalValueElement
inspiran Feb 8, 2013
e11377a
Adjusted pricing context to use Pimple
inspiran Feb 10, 2013
48d189e
Adjusted composer
inspiran Feb 10, 2013
d5037fe
revert BaseOrder addItem
Feb 18, 2013
37ca2e7
Add UPDATE_ITEM_QUANTITY event
Feb 18, 2013
2ac213b
Add PRE_PROCESS_ORDER and POST_PROCESS_ORDER
Feb 18, 2013
ce45165
Missed commas
Feb 18, 2013
05838f8
Fixed several tests
inspiran Feb 21, 2013
0290d2f
Added order date field, the date when the order was made (might be di…
inspiran Feb 22, 2013
dc85d2b
Adjusted pricing set to implement ArrayAccess interface for convenience
inspiran Mar 5, 2013
585f640
Moving tax related entities away from TaxationBundle
inspiran Mar 5, 2013
54d8227
remove partner so owner is used consistently & CS
Mar 6, 2013
6ece735
Added OwnerNotes for Cart & Order, InternalNotes for Order
inspiran Mar 7, 2013
e9fdf7d
pass global Elements and related fixes
Mar 9, 2013
5b326b0
start refactoring of pricing set processed values and properties
Mar 11, 2013
9b6049f
add attribute methods to product
Mar 11, 2013
5b309d8
updates to pricing set code
Mar 12, 2013
0bf4caa
rename PricingElementValueInterface
Mar 12, 2013
d1c4835
updating elements
Mar 12, 2013
1ea6070
Added basic fields to the billing request entity
inspiran Mar 13, 2013
3f21e81
* Added tracking of consumption data (eg. bandwith consumed)
Mar 14, 2013
2008221
* Adjusted billing agreement fields
inspiran Mar 14, 2013
9356642
remove BasePartner, update Partner to match interface
Mar 15, 2013
8a26ed8
updates to payment profiles, add bitcoin profile
Mar 16, 2013
90aac07
CS for Partner add tests and methods for payment profiles
Mar 16, 2013
73d20ed
add a PayPal payment profile
Mar 16, 2013
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
@@ -1,3 +1,3 @@
vendor
composer.phar
composer.lock
composer.lock
3 changes: 1 addition & 2 deletions .travis.yml
Expand Up @@ -5,5 +5,4 @@ php:
- 5.4

before_script:
- wget http://getcomposer.org/composer.phar
- php composer.phar install
- composer install
3 changes: 3 additions & 0 deletions README.md
@@ -0,0 +1,3 @@
Pricing
=======

16 changes: 13 additions & 3 deletions composer.json
@@ -1,14 +1,24 @@
{
"name": "vespolina/core",
"type": "entities",
"description": "Core code for the various Vespolina bundles, but not specific to Vespolina",
"keywords": ["ecommerce"],
"description": "Core entities for the Vespolina Project",
"keywords": ["ecommerce", "shop"],
"homepage": "https://github.com/vespolina/VespolinaCore",
"license": "MIT",
"require": {
"php": ">=5.3.2"
},
"require": {
"php": ">=5.3.2",
"pimple/pimple": "*",
"doctrine/common": "*"
},
"autoload": {
"psr-0": { "Vespolina": "lib/" }
},
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
}
}
}
81 changes: 81 additions & 0 deletions lib/ImmersiveLabs/Pricing/Entity/Element/RecurringElement.php
@@ -0,0 +1,81 @@
<?php

namespace ImmersiveLabs\Pricing\Entity\Element;

use ImmersiveLabs\Pricing\Entity\PricingElement;

class RecurringElement extends PricingElement
{
public function __construct()
{
$this->attributes['cycles'] = '';
$this->attributes['recurringCharge'] = '';
$this->attributes['interval'] = '';
$this->attributes['startsIn'] = null;

parent::__construct();
}

public function setCycles($cycles)
{
$this->attributes['cycles'] = $cycles;

return $this;
}

public function getCycles()
{
return $this->attributes['cycles'];
}

public function setInterval($interval)
{
$this->attributes['interval'] = $interval;

return $this;
}

public function getInterval()
{
return $this->attributes['interval'];
}

public function setRecurringCharge($recurringCharge)
{
$this->attributes['recurringCharge'] = $recurringCharge;

return $this;
}

public function getRecurringCharge()
{
return $this->attributes['recurringCharge'];
}

public function setStartsIn($startsIn)
{
$this->attributes['startsIn'] = $startsIn;

return $this;
}

public function getStartsIn()
{
return $this->attributes['startsIn'];
}

protected function doProcess($context, $processed)
{
$processed['netValue'] = $this->attributes['netValue'];
$processed['recurringCharge'] = $this->attributes['recurringCharge'];
$processed['interval'] = $this->attributes['interval'];
$processed['cycles'] = $this->attributes['cycles'];
if (!$this->attributes['startsIn']) {
$processed['startsOn'] = new \DateTime('today +' . $processed['interval']);
} else {
$processed['startsOn'] = new \DateTime('today +' . $this->attributes['startsIn']);
}

return $processed;
}
}
35 changes: 35 additions & 0 deletions lib/ImmersiveLabs/Pricing/Entity/Element/TotalValueElement.php
@@ -0,0 +1,35 @@
<?php

namespace ImmersiveLabs\Pricing\Entity\Element;

<<<<<<< HEAD:lib/ImmersiveLabs/Pricing/Entity/Element/TotalValueElement.php
use ImmersiveLabs\Pricing\Entity\PricingElement;
=======
use Vespolina\Entity\Pricing\PricingElement;
use Vespolina\Entity\Pricing\PricingElementValueInterface;
>>>>>>> updates to pricing set code:lib/Vespolina/Entity/Pricing/Element/TotalValueElement.php

class TotalValueElement extends PricingElement implements PricingElementValueInterface
{
protected $position = 100000;

public function add($augend, $addend)
{
throw new FunctionNotSupportedException('add() has not been implemented in ' . get_class($this));
}

public function subtract($minuend, $subtrahend)
{
throw new FunctionNotSupportedException('subtract() has not been implemented in ' . get_class($this));
}

protected function doProcess($context, $processed)
{
$totalValue = $processed['netValue'];
// todo: calculate other preset groups 'discounts', 'surcharge', 'taxes'

$processed['totalValue'] = $totalValue;

return $processed;
}
}
82 changes: 82 additions & 0 deletions lib/ImmersiveLabs/Pricing/Entity/PricingElement.php
@@ -0,0 +1,82 @@
<?php

namespace ImmersiveLabs\Pricing\Entity;

use Vespolina\Entity\Pricing\PricingElementInterface;
use Vespolina\Entity\Pricing\PricingSetInterface;
use Vespolina\Exception\FunctionNotSupportedException;

class PricingElement implements PricingElementInterface
{
protected $id;
protected $attributes;
protected $position;
protected $pricingSet;
protected $type;

public function __construct()
{
$this->attributes['netValue'] = '';
}

public function setNetValue($netValue)
{
$this->attributes['netValue'] = $netValue;

return $this;
}

/**
* @inheritdoc
*/
public function process($context, $processed)
{
return $this->doProcess($context, $processed);
}

protected function doProcess($context, $processed)
{
throw new FunctionNotSupportedException('process() has not been implemented in ' . get_class($this));
}

/**
* Set the order of this element being processed. If the order is not set, it is saved until the end of the
* processing to be executed. The higher the number, the later it is executed.
*
* @param integer $position
* @return \ImmersiveLabs\Pricing\Entity\PricingElement
*/
function setPosition($position)
{
$this->position = $position;

return $this;
}

/**
* Return the order of this element's execution
*
* @return integer
*/
function getPosition()
{
return $this->position;
}

public function getId()
{
return $this->id;
}

public function setPricingSet(PricingSetInterface $pricingSet)
{
$this->pricingSet = $pricingSet;

return $this;
}

public function getPricingSet()
{
return $this->pricingSet;
}
}