示例#1
0
 /**
  * @covers sAdmin::sGetPaymentMeans
  */
 public function testsGetPaymentMeans()
 {
     $result = $this->module->sGetPaymentMeans();
     foreach ($result as $paymentMean) {
         $this->assertArrayHasKey('id', $paymentMean);
         $this->assertArrayHasKey('name', $paymentMean);
         $this->assertArrayHasKey('description', $paymentMean);
         $this->assertArrayHasKey('debit_percent', $paymentMean);
         $this->assertArrayHasKey('surcharge', $paymentMean);
         $this->assertArrayHasKey('surchargestring', $paymentMean);
         $this->assertArrayHasKey('active', $paymentMean);
         $this->assertArrayHasKey('esdactive', $paymentMean);
         $this->assertContains($paymentMean['id'], array(2, 3, 5));
     }
 }
示例#2
0
 /**
  * Returns the payment information and validates it
  *
  * @return void
  */
 public function paymentAction()
 {
     if (!isset($this->View()->register->payment)) {
         $this->View()->register->payment = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS);
     }
     if (!isset($this->View()->register->payment->form_data)) {
         if (!empty($this->session['sPayment'])) {
             $this->View()->register->payment->form_data = array('payment' => $this->session['sPayment']);
         } else {
             $this->View()->register->payment->form_data = array('payment' => Shopware()->Config()->get('DefaultPayment'));
         }
     }
     $this->View()->register->payment->payment_means = $this->admin->sGetPaymentMeans();
     if (!empty($this->session['sRegister']['shipping'])) {
         foreach ($this->session['sRegister']['shipping'] as $key => $value) {
             $this->View()->form_data->register['shipping'][$key] = $value;
         }
     }
 }
示例#3
0
 /**
  * Payment action method
  *
  * Read and change payment mean and payment data
  */
 public function paymentAction()
 {
     $this->View()->sPaymentMeans = $this->admin->sGetPaymentMeans();
     $this->View()->sFormData = array('payment' => $this->View()->sUserData['additional']['user']['paymentID']);
     $this->View()->sTarget = $this->Request()->getParam('sTarget', $this->Request()->getControllerName());
     $getPaymentDetails = $this->admin->sGetPaymentMeanById($this->View()->sFormData['payment']);
     $paymentClass = $this->admin->sInitiatePaymentClass($getPaymentDetails);
     if ($paymentClass instanceof \ShopwarePlugin\PaymentMethods\Components\BasePaymentMethod) {
         $data = $paymentClass->getCurrentPaymentDataAsArray(Shopware()->Session()->sUserId);
         if (!empty($data)) {
             $this->View()->sFormData += $data;
         }
     }
     if ($this->Request()->isPost()) {
         $values = $this->Request()->getPost();
         $values['payment'] = $this->Request()->getPost('register');
         $values['payment'] = $values['payment']['payment'];
         $values['isPost'] = true;
         $this->View()->sFormData = $values;
     }
 }
示例#4
0
	/**
	 * Payment action method
	 *
	 * Read and change payment mean and payment data
	 */
	public function paymentAction()
	{
		$this->View()->sPaymentMeans = $this->admin->sGetPaymentMeans();
		$this->View()->sFormData = array('payment'=>$this->View()->sUserData['additional']['user']['paymentID']);
		$this->View()->sTarget = $this->Request()->getParam('sTarget', $this->Request()->getControllerName());

		$getPaymentDetails = $this->admin->sGetPaymentMeanById($this->View()->sFormData['payment']);
		if ($getPaymentDetails['table'])
		{
			$paymentClass = $this->admin->sInitiatePaymentClass($getPaymentDetails);
			if (!empty($paymentClass))
			{
				$this->View()->sFormData += $paymentClass->getData();
			}
		}

		if($this->Request()->isPost())
		{
			$values = $this->Request()->getPost();
			$values['payment'] = $this->Request()->getPost('register');
			$values['payment'] = $values['payment']['payment'];
			$this->View()->sFormData = $values;
		}
	}
示例#5
0
 /**
  * Returns all available payment methods from sAdmin object
  *
  * @return array list of payment methods
  */
 public function getPayments()
 {
     return $this->admin->sGetPaymentMeans();
 }