/**
	 * Returns an array for the 'radios' array of $redirectNow type:
	 * return array( account_id, submethod, paymentMethod:'single'|'subscribe', array(cardtypes), 'label for radio', 'description for radio' )
	 * 
	 * @param  cbpaidPaymentBasket  $paymentBasket  paymentBasket object
	 * @param  string               $subMethod
	 * @param  string               $paymentType
	 * @param  string               $defaultLabel
	 * @return array
	 */
	protected function getPayRadioRecepie( $paymentBasket, $subMethod, $paymentType, $defaultLabel )
	{
		// Settings for Free Trial and Order Now buttons are stored in global CBSubs settings:
		$params					=	cbpaidApp::settingsParams();

		$cardtypes					=	array();

		if ( $this->_button == 'freetrial' ) {
			$brandLabelHtml				=	CBPTXT::Th( $params->get( 'freetrial_radio_name', "Free Trial" ) );		// CBPTXT::T("Free Trial")
			$altText					=	CBPTXT::T( $params->get( 'freetrial_radio_alt', "Subscribe to free trial period only") );	// CBPTXT::T("Subscribe to free trial period only")
			$brandDescriptionHtml		=	CBPTXT::Th( $params->get( 'freetrial_radio_description' ) );
		} else {
			$brandLabelHtml				=	CBPTXT::Th("Confirm Order");
			$altText					=	CBPTXT::T("Confirm Order");
			$brandDescriptionHtml		=	null;
		}
		return cbpaidGatewaySelectorRadio::getPaymentRadio( $this->_button, $subMethod, $paymentType, $cardtypes, $brandLabelHtml, $brandDescriptionHtml, $altText );
		
	}
示例#2
0
	/**
	 * Draws a line with a radio selection for a payment method
	 * 
	 * @param  cbpaidGatewaySelectorRadio  $radioPaymentSelector
	 * @param  boolean $selected
	 * @return string
	 */
	public function drawPaymentRadio( $radioPaymentSelector, $selected ) {
		$this->gatewayId				=	$radioPaymentSelector->gatewayId;
		$this->radioValue				=	$radioPaymentSelector->radioValue();
		$this->cardtypes				=	$radioPaymentSelector->cardTypes;
		$this->brandLabelHtml			=	$radioPaymentSelector->brandLabelHtml;
		$this->brandDescriptionHtml		=	$radioPaymentSelector->brandDescriptionHtml;
		$this->altText					=	$radioPaymentSelector->altText;
		$this->payNameForCssClass		=	$radioPaymentSelector->payNameForCssClass;
		$this->selected					=	$selected;
		
		return $this->display( 'payradio' );
	}
 /**
  * Returns an array for the 'radios' array of $redirectNow type:
  * return array( account_id, subMethod, paymentMethod:'single'|'subscribe', array(cardtypes), 'label for radio', 'description for radio' )
  *
  * @param  cbpaidPaymentBasket  $paymentBasket  paymentBasket object
  * @param  string               $subMethod
  * @param  string               $paymentType
  * @param  string               $defaultLabel
  * @return array
  */
 protected function getPayRadioRecepie($paymentBasket, $subMethod, $paymentType, $defaultLabel)
 {
     $cardtypesString = $this->getAccountParam($paymentType . '_radio_cardtypes');
     $cardtypes = $cardtypesString ? explode('|*|', $cardtypesString) : array();
     $brandLabelHtml = $this->getAccountParam($paymentType . '_radio_name', $defaultLabel);
     $brandDescriptionHtml = CBPTXT::Th($this->getAccountParam($paymentType . '_radio_description'));
     if ($brandLabelHtml === null) {
         $brandLabelHtml = CBPTXT::T($this->getAccountParam('psp_human_name'));
     } else {
         $brandLabelHtml = CBPTXT::T($brandLabelHtml);
         // CBPTXT::T("Credit Card")
     }
     $payNameForCssClass = $this->getPayName();
     if ($this->canPayBasketWithThisCurrency($paymentBasket)) {
         $paySafelyWith = CBPTXT::T($this->getAccountParam('button_title_text'));
         $altText = sprintf($paySafelyWith, $brandLabelHtml);
     } else {
         $altText = CBPTXT::T($this->getAccountParam('currency_acceptance_text'));
         $payNameForCssClass .= ' ' . 'cbregconfirmtitleonclick';
     }
     return cbpaidGatewaySelectorRadio::getPaymentRadio($this->getAccountParam('id'), $subMethod, $paymentType, $cardtypes, $brandLabelHtml, $brandDescriptionHtml, $altText, $payNameForCssClass);
 }
 /**
  * Returns an array for the 'radios' array of $redirectNow type:
  * return array( account_id, submethod, paymentMethod:'single'|'subscribe', array(cardtypes), 'label for radio', 'description for radio' )
  * 
  * @param  cbpaidPaymentBasket  $paymentBasket  paymentBasket object
  * @param  string               $subMethod
  * @param  string               $paymentType
  * @param  string               $defaultLabel
  * @return array
  */
 private function getPayRadioRecepie($paymentBasket, $subMethod, $paymentType, $defaultLabel)
 {
     if ($paymentType == 'psp') {
         $cardtypesString = $this->getAccountParam($paymentType . '_radio_cardtypes');
         $cardtypes = $cardtypesString ? explode('|*|', $cardtypesString) : array();
     } else {
         $cardtypes = array($paymentType);
     }
     $brandLabelHtml = $this->getAccountParam($paymentType . '_radio_name', $defaultLabel);
     // CBPTXT::T("Credit Card")
     $brandDescriptionHtml = CBPTXT::Th($this->getAccountParam($paymentType . '_radio_description'));
     if ($brandLabelHtml === null) {
         $brandLabelHtml = CBPTXT::Th($this->getAccountParam('psp_human_name'));
     } else {
         $brandLabelHtml = CBPTXT::Th($brandLabelHtml);
     }
     if ($this->getAccountParam('payment_methods_selection') == 'onsite') {
         $currencies = $this->getAccountParam($paymentType . '_currencies');
     } else {
         $currencies = $this->getAccountParam('currencies_accepted');
     }
     $payNameForCssClass = $this->getPayName();
     if ($currencies == '' || in_array($paymentBasket->mc_currency, explode('|*|', $currencies))) {
         $paySafelyWith = CBPTXT::T($this->getAccountParam('button_title_text'));
         $altText = strip_tags(sprintf($paySafelyWith, $brandLabelHtml));
     } else {
         if ($this->getAccountParam('payment_methods_selection') == 'onsite') {
             $altText = CBPTXT::T($this->getAccountParam($paymentType . '_currencies_description'));
         } else {
             $altText = CBPTXT::T($this->getAccountParam('currency_acceptance_text'));
         }
         $payNameForCssClass .= ' ' . 'cbregconfirmtitleonclick';
     }
     return cbpaidGatewaySelectorRadio::getPaymentRadio($this->getAccountParam('id'), $subMethod, $paymentType, $cardtypes, $brandLabelHtml, $brandDescriptionHtml, $altText, $payNameForCssClass);
 }
	/**
	 * Returns an array for the 'radios' array of $redirectNow type:
	 * return array( account_id, submethod, paymentMethod:'single'|'subscribe', array(cardtypes), 'label for radio', 'description for radio' )
	 *
	 * @param  cbpaidPaymentBasket  $paymentBasket  paymentBasket object
	 * @param  string               $subMethod
	 * @param  string               $paymentType
	 * @param  string               $defaultLabel
	 * @return cbpaidGatewaySelectorRadio
	 */
	protected function getPayRadioRecepie( $paymentBasket, $subMethod, $paymentType, /** @noinspection PhpUnusedParameterInspection */ $defaultLabel ) {
		if ( $paymentType ) {
			$cardtypes				=	array( $paymentType );
			$brand					=	( ( $paymentType == 'amexco' ) ? 'American Express' : ucwords( $paymentType ) );
			$brandLabelHtml			=	CBPTXT::Th( $brand );
			$altText				=	sprintf( CBPTXT::T("Pay safely with %s"), CBPTXT::T( $brand ) );
		} else {
			$cardtypes				=	$this->getAccountParam( 'cardtypes', array() );
			$brandLabelHtml			=	CBPTXT::Th("Pay with your credit card");
			$altText				=	strip_tags( $brandLabelHtml );
		}
		$brandDescriptionHtml		=	CBPTXT::Th( $this->getAccountParam( 'psp_radio_description' ) );

		$payNameForCssClass			=	$this->getPayName();
		if ( ! $this->canPayBasketWithThisCurrency( $paymentBasket ) ) {
			$altText				=	CBPTXT::T( $this->getAccountParam( 'currency_acceptance_text' ) );
			$payNameForCssClass		.=	' ' . 'cbregconfirmtitleonclick';
		}

		return cbpaidGatewaySelectorRadio::getPaymentRadio( $this->getAccountParam( 'id' ), $subMethod, $paymentType, $cardtypes, $brandLabelHtml, $brandDescriptionHtml, $altText, $payNameForCssClass );
	}