Beispiel #1
0
 /**
  * create contracts for billable items, one for each recurring product in the order.
  *
  * Parse $this subscriptions and create contracts using valid recurring payment methods,
  * in this case only ezcollect, but for each of the subscriptions created on the order object, create
  * a contract index between the subscript and the recurring payment provider described in payment details.
  */
 private function createContracts()
 {
     $paymentProviderReferenceId = null;
     foreach ($this->subscriptions as $subscription) {
         if ($subscription->getProduct()->plugins->pricing->type == 'unitspercycle' || $subscription->getProduct()->plugins->pricing->type == 'percycle') {
             $contractData = new Registry(['order_id' => $this->order->id, 'product_id' => $subscription->product_id, 'event_id' => $subscription->event_id, 'first_bill_date' => $subscription->plugins->pricing->next_paydate, 'method' => $this->state->get('contract_payment_method'), 'terms' => json_encode(['period' => 'monthly', 'pricing' => $subscription->plugins->pricing->type]), 'paydate' => $subscription->plugins->pricing->paydate]);
             $this->contracts[] = Sp4kAppsContractApp::getInstance($contractData)->getItem()->update();
         }
     }
 }
Beispiel #2
0
 /**
  * create contracts for billable items, one for each recurring product in the order.
  */
 private function createContract()
 {
     $contractData = new Registry(['order_id' => $this->order->id, 'product_id' => $this->order->product_id, 'payment_method' => $this->order->config->payment->method]);
     $this->contracts[] = Sp4kAppsContractApp::getInstance($contractData)->getItems()->update();
 }