Skip to content

Commit

Permalink
updates to get tests working
Browse files Browse the repository at this point in the history
  • Loading branch information
iampersistent committed Jan 25, 2013
1 parent aa536f8 commit 1038e49
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/Vespolina/Billing/Gateway/BillingGateway.php
Expand Up @@ -18,8 +18,8 @@ class BillingGateway implements BillingGatewayInterface
*/
public function __construct(MolinoInterface $molino, $billingAgreementClass)
{
if (!class_exists($billingAgreementClass) || !in_array('Vespolina\Entity\BillingAgreement\BillingAgreementInterface', class_implements($billingAgreementClass))) {
throw new InvalidInterfaceException('Please have your billingAgreement class implement Vespolina\Entity\BillingAgreement\BillingAgreementInterface');
if (!class_exists($billingAgreementClass) || !in_array('Vespolina\Entity\Billing\BillingAgreementInterface', class_implements($billingAgreementClass))) {
throw new InvalidInterfaceException('Please have your billingAgreement class implement Vespolina\Entity\Billing\BillingAgreementInterface');
}
$this->molino = $molino;
$this->billingAgreementClass = $billingAgreementClass;
Expand Down
11 changes: 6 additions & 5 deletions lib/Vespolina/Billing/Manager/BillingManager.php
Expand Up @@ -76,19 +76,20 @@ public function createBillingAgreements(OrderInterface $order)
foreach ($order->getItems() as $item) {

$pricingSet = $item->getPricing();
$startDate = new \DateTime('today');
$recurringCharge = $pricingSet->get('recurringCharge');
$startOn = '+' . $pricingSet->get('startsIn') . ' ' . $pricingSet->get('interval');
$startDate = new \DateTime($startOn);

$billingAgreement = new BillingAgreement();
$billingAgreement
->setPaymentGateway($order->getAttribute('payment_gateway'))
->setPartner($order->getOwner())
->setInitialBillingDate(new \DateTime('now'))
->setBillingAmount($recurringValue)
->setInitialBillingDate($startDate)
->setNextBillingDate($startDate)
->setBillingAmount($recurringCharge)
->setOrderItem($item)
;
}

return array();
}

/**
Expand Down

0 comments on commit 1038e49

Please sign in to comment.