Пример #1
0
 private function getDestination($input)
 {
     $destination = null;
     switch ($input->source_type) {
         case 'credit_card':
             $destination = $this->statement_service->get($input->source_id, $input->date);
             break;
         case 'account':
             $destination = $this->account_service->get($input->source_id);
             break;
     }
     return $destination;
 }
Пример #2
0
 private function getSource($input)
 {
     $source = null;
     $amount = 0;
     if ($input->type == 'simple') {
         $amount = $input->amount;
     } else {
         foreach ($input->items as $item) {
             $amount += $item['amount'];
         }
     }
     switch ($input->source_type) {
         case 'credit_card':
             $source = $this->credit_card_purchase_service->get($input->source_id, $input->date, $amount, $input->number_installments);
             break;
         case 'account':
             $source = $this->account_service->get($input->source_id);
             break;
     }
     return $source;
 }