Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- debug of order states - events on order payment - beginning of mail system
- Loading branch information
1 parent
a2754a5
commit 893dcdd
Showing
12 changed files
with
270 additions
and
8 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
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,34 @@ | ||
<?php | ||
namespace Kitpages\ShopBundle\Event; | ||
|
||
use Symfony\Component\EventDispatcher\Event; | ||
|
||
abstract class AbstractEvent extends Event | ||
{ | ||
protected $data = array(); | ||
protected $isDefaultPrevented = false; | ||
|
||
public function preventDefault() | ||
{ | ||
$this->isDefaultPrevented = true; | ||
} | ||
|
||
public function isDefaultPrevented() | ||
{ | ||
return $this->isDefaultPrevented; | ||
} | ||
|
||
public function set($key, $val) | ||
{ | ||
$this->data[$key] = $val; | ||
} | ||
|
||
public function get($key) | ||
{ | ||
if (!array_key_exists($key, $this->data)) { | ||
return null; | ||
} | ||
return $this->data[$key]; | ||
} | ||
|
||
} |
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,10 @@ | ||
<?php | ||
|
||
namespace Kitpages\ShopBundle\Event; | ||
|
||
use Symfony\Component\EventDispatcher\Event; | ||
|
||
|
||
class ShopEvent extends AbstractEvent | ||
{ | ||
} |
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,9 @@ | ||
<?php | ||
|
||
namespace Kitpages\ShopBundle; | ||
|
||
final class KitpagesShopEvents | ||
{ | ||
const AFTER_ORDER_PAYED = 'kitpages_shop.event.after_order_payed'; | ||
const AFTER_TRANSACTION_REFUSED = 'kitpages_shop.event.after_transaction_refused'; | ||
} |
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
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,59 @@ | ||
<table> | ||
<thead> | ||
<tr> | ||
<td colspan="4"> | ||
<h1>{{ "Invoice" | trans }} {{invoice.reference}}</h1> | ||
<span>{{ "Date" | trans}} : {{ order.stateDate | date("m/d/Y") }}</span><br/> | ||
Company | ||
</td> | ||
</tr> | ||
<tr> | ||
<td colspan="4"> | ||
<h2>Client</h2> | ||
{{order.invoiceUser.firstName}} {{order.invoiceUser.lastName}}<br/> | ||
{{order.invoiceUser.email}}<br/> | ||
{{order.invoiceUser.countryCode|kit_shop_country(app.session.locale)}} | ||
</td> | ||
</tr> | ||
<tr> | ||
<td colspan="4"> | ||
<h2>Invoice content</h2> | ||
</td> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>Ref</td> | ||
<td>Name</td> | ||
<td>Quantity</td> | ||
<td>Price</td> | ||
</tr> | ||
</tbody> | ||
<tbody> | ||
{% for line in order.orderLineList %} | ||
<tr> | ||
<td>{{line.shopReference}}</td> | ||
<td> | ||
<h4>{{line.shopName}}</h4> | ||
<div>{{line.shopDescription}}</div> | ||
</td> | ||
<td>{{line.quantity}}</td> | ||
<td>{{ line.priceIncludingVat }}</td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
<tfoot> | ||
<tr> | ||
<td colspan="3">Total</td> | ||
<td> | ||
{% if (order.priceIncludingVat == order.priceWithoutVat) %} | ||
{{order.priceIncludingVat}} | ||
{% else %} | ||
Without VAT : {{order.priceWithoutVat}}<br/> | ||
VAT : {{order.priceIncludingVat - order.priceWithoutVat}}<br/> | ||
Including VAT : {{order.priceIncludingVat}} | ||
{% endif %} | ||
</td> | ||
</tr> | ||
</tfoot> | ||
</table> |
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,24 @@ | ||
<html> | ||
<head> | ||
<title>Email</title> | ||
</head> | ||
<body> | ||
<table width="600" style="width: 600px"> | ||
<thead> | ||
<tr> | ||
<td>Mail header</td> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>{% block body %}{% endblock %}</td> | ||
</tr> | ||
</tbody> | ||
<tfoot> | ||
<tr> | ||
<td>Mail footer</td> | ||
</tr> | ||
</tfoot> | ||
</table> | ||
</body> | ||
</html> |
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,40 @@ | ||
<?php | ||
namespace Kitpages\ShopBundle\Twig\Extension; | ||
|
||
use Symfony\Component\Locale\Locale; | ||
|
||
class ShopExtension extends \Twig_Extension | ||
{ | ||
|
||
public static function countryName($value, $locale) | ||
{ | ||
$countryList = \Symfony\Component\Locale\Locale::getDisplayCountries($locale); | ||
if (!in_array($value, $countryList)) { | ||
return $countryList[$value]; | ||
} else { | ||
return $value; | ||
} | ||
} | ||
|
||
/** | ||
* Returns a list of filters to add to the existing list. | ||
* | ||
* @return array An array of filters | ||
*/ | ||
public function getFilters() | ||
{ | ||
return array( | ||
'kit_shop_country' => new \Twig_Filter_Function('Kitpages\ShopBundle\Twig\Extension\ShopExtension::countryName') | ||
); | ||
} | ||
|
||
/** | ||
* Returns the name of the extension. | ||
* | ||
* @return string The extension name | ||
*/ | ||
public function getName() | ||
{ | ||
return 'kitpages_shop_shop'; | ||
} | ||
} |