Skip to content

Commit

Permalink
fixes in manager concerning the partner
Browse files Browse the repository at this point in the history
  • Loading branch information
iampersistent committed Feb 1, 2013
1 parent b0d6092 commit c8b55cc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/Vespolina/Billing/Manager/BillingManager.php
Expand Up @@ -154,7 +154,8 @@ function createBillingRequest(BillingAgreementInterface $billingAgreement)

$paymentType = $billingAgreement->getPaymentProfile()->getType();
$context = $this->context['billingRequest'][$paymentType];
// todo: find everything in the context then process ....
$partner = $billingAgreement->getPartner();
$context['partner'] = $partner;
$relatedAgreements = $this->findBillingAgreements($context);

$billingRequest = new $this->billingRequestClass();
Expand All @@ -165,6 +166,7 @@ function createBillingRequest(BillingAgreementInterface $billingAgreement)
}
$billingRequest->setPricing($requestPricingSet);
$billingRequest->setDueDate($agreement->getNextBillingDate());
$billingRequest->setPartner($partner);

$this->gateway->persistBillingRequest($billingRequest);

Expand Down Expand Up @@ -199,6 +201,9 @@ public function findBillingAgreements(PricingContextInterface $context, $limit =
$startDate = new \DateTime($context['startDate']);
$query->filterGreater('nextBillingDate', $startDate);
}
if ($context['partner']) {
$query->filterEqual('partner', $context['partner']);
}
$query->filterEqual('active', 1);
if ($limit) {
$query->limit($limit);
Expand Down

0 comments on commit c8b55cc

Please sign in to comment.