コード例 #1
0
ファイル: Payment.php プロジェクト: chesterx/pay-plugin
 public function onUpdatePaymentType()
 {
     if (!($invoice = $this->getInvoice())) {
         throw new ApplicationException('Invoice not found!');
     }
     if (!($methodId = post('payment_method'))) {
         throw new ApplicationException('Payment type not specified!');
     }
     if (!($method = TypeModel::find($methodId))) {
         throw new ApplicationException('Payment type not found!');
     }
     $invoice->payment_method = $method;
     $invoice->save();
     $this->page['invoice'] = $invoice;
     $this->page['paymentMethod'] = $method;
 }
コード例 #2
0
 public function formCreateModelObject()
 {
     $model = new TypeModel();
     $model->applyGatewayClass($this->getGatewayClass());
     return $model;
 }
コード例 #3
0
ファイル: Invoice.php プロジェクト: janusnic/pay-plugin
 public function afterFetch()
 {
     if (!$this->payment_method_id) {
         $this->payment_method = TypeModel::getDefault($this->country_id);
     }
 }
コード例 #4
0
 /**
  * Loops over each payment type and ensures the editing theme has a payment form partial,
  * if the partial does not exist, it will create one.
  * @return void
  */
 public static function createPartials()
 {
     $partials = Partial::lists('baseFileName', 'baseFileName');
     $paymentMethods = TypeModel::all();
     foreach ($paymentMethods as $paymentMethod) {
         $class = $paymentMethod->class_name;
         if (!$class || get_parent_class($class) != 'Responsiv\\Pay\\Classes\\GatewayBase') {
             continue;
         }
         $partialName = 'pay/' . strtolower(class_basename($class));
         $partialExists = array_key_exists($partialName, $partials);
         if (!$partialExists) {
             $filePath = dirname(File::fromClass($class)) . '/' . strtolower(class_basename($class)) . '/payment_form.htm';
             self::createPartialFromFile($partialName, $filePath, Theme::getEditTheme());
         }
     }
 }