public function get_transaction_costs($id, $money)
 {
     $this->PaymentMethod->id = $id;
     $payment_method = $this->PaymentMethod->read();
     $PaymentProvider = BasicPaymentProvider::get($payment_method['PaymentProvider']['class']);
     return $PaymentProvider->calculateTransactionCosts($payment_method['PaymentMethod']['alias'], $money);
 }
 public function panel_start($id)
 {
     $this->Payment->id = $id;
     $this->Payment->recursive = 2;
     $payment = $this->Payment->read();
     $this->set(compact('payment'));
     if (!$this->request->is('post')) {
         return;
     }
     debug($payment);
     $provider = BasicPaymentProvider::get($payment['PaymentMethod']['PaymentProvider']['class']);
     $paymentUrl = $provider->startPayment($payment['Payment']['id'], $payment['Payment']['amount'], $payment['Payment']['description']);
     debug($paymentUrl);
     if (!$paymentUrl) {
         throw new CakeException(':(');
     }
     $this->Payment->saveField('status', 'start');
     $this->redirect($paymentUrl);
 }