/**
	 * Returns a cbpaidGatewaySelectorButton object parameters for rendering an HTML form with a visible button and hidden fields for the gateway
	 * Or a string with HTML content instead (not recommended)
	 * 
	 * @param  cbpaidPaymentBasket  $paymentBasket  paymentBasket object
	 * @param  string               $subMethod      'single', 'subscribe' or gateway-specific string (e.g. credit-card brand)
	 * @param  string               $paymentType    'single' or 'subscribe' or for subscriptions 'cancel'
	 * @return cbpaidGatewaySelectorButton                  or string with HTML
	 */
	protected function getPayButtonRecepie( $paymentBasket, $subMethod, $paymentType )
	{
		// Settings for Free Trial and Order Now buttons are stored in global CBSubs settings:
		$params					=	cbpaidApp::settingsParams();

		// Generate URLs for payment:
		$pspUrl					=	$this->pspUrl( $paymentBasket, ( $paymentType == 'subscribe' ) );
		$requestParams			=	$this->getSinglePaymentRequstParams( $paymentBasket );
		$customImage			=	$params->get( $this->_button . '_custom_image' );
		$titleText				=	( $this->_button == 'freetrial' ? CBPTXT::T("Subscribe to free trial period only") : CBPTXT::T("Confirm Order") );
		$altText				=	( $this->_button == 'freetrial' ? CBPTXT::T("Free Trial") :  CBPTXT::T("Confirm Order") );
		$butId					=	'cbpaidButt' . strtolower( $this->_button );

		if ( $customImage == '' ) {
			$customImage		=	$params->get( $this->_button . '_image', 'components/com_comprofiler/plugin/user/plug_cbpaidsubscriptions/icons/cards/'
								.	( $this->_button == 'freetrial' ? 'cc_big_orange_free_trial.gif' : 'cc_big_orange_confirm_order.gif' ) );
		}
		$payNameForCssClass		=	$this->_button;
		
		return cbpaidGatewaySelectorButton::getPaymentButton( $this->getAccountParam( 'id' ), $subMethod, $paymentType, $pspUrl, $requestParams, $customImage, $altText, $titleText, $payNameForCssClass, $butId );
	}
 /**
  * Returns an HTML form with a visible button and hidden fields for the gateway
  *
  * @param  cbpaidPaymentBasket  $paymentBasket   paymentBasket object
  * @param  string               $subMethod
  * @param  array                $paymentMethods
  * @param  string|null          $brandText
  * @param  string|null          $brandName
  * @return string                                HTML OR array with all params for the rendering function of CBSubs' template
  */
 private function getPayButtonRecepie($paymentBasket, $subMethod, $paymentMethods, $brandText = null, $brandName = null)
 {
     $requestParams = $this->_completePaymentRequestParams($paymentBasket, $paymentMethods);
     $translatedBrandText = $this->translatedBrandText($brandText);
     $paymentType = $brandText === null ? '' : $brandName;
     $altText = htmlspecialchars(sprintf(CBPTXT::T("Pay with %s"), $translatedBrandText));
     // This is for automatic tool to catch the string: CBPTXT::T("Pay safely with %s");
     $titleText = htmlspecialchars(sprintf(CBPTXT::T($this->getAccountParam('button_title_text', "Pay safely with %s")), $translatedBrandText));
     $customImage = $this->customImage($brandName);
     $payNameForCssClass = $this->getPayName();
     $butId = 'cbpaidButt' . strtolower($this->getPayName());
     // instead of previously: 'cbpaidButton_' . htmlspecialchars( $this->getPayName() )
     $pspUrl = $this->pspUrl($paymentBasket, false);
     return cbpaidGatewaySelectorButton::getPaymentButton($this->getAccountParam('id'), $subMethod, $paymentType, $pspUrl, $requestParams, $customImage, $altText, $titleText, $payNameForCssClass, $butId);
 }
	/**
	 * Returns a cbpaidGatewaySelectorButton object parameters for rendering an HTML form with a visible button and hidden fields for the gateway
	 * Or a string with HTML content instead (not recommended)
	 * 
	 * @param  cbpaidPaymentBasket  $paymentBasket  paymentBasket object
	 * @param  string               $subMethod      'single', 'subscribe' or gateway-specific string (e.g. credit-card brand)
	 * @param  string               $paymentType    'single' or 'subscribe' or for subscriptions 'cancel'
	 * @return cbpaidGatewaySelectorButton                  or string with HTML
	 */
	protected function getPayButtonRecepie( $paymentBasket, $subMethod, $paymentType )
	{
		list( $customImage, $altText, $payNameForCssClass, $butId )	=	$this->getPayButtonParams( $paymentType );

		switch ( $paymentType ) {
			case 'single':
				$requestParams	=	$this->getSinglePaymentRequstParams( $paymentBasket );
				$titleText		=	htmlspecialchars( sprintf( CBPTXT::T("Pay safely with %s"), CBPTXT::T("PayPal") ) );
				break;
			case 'subscribe':
				$requestParams	=	$this->getSubscriptionRequstParams( $paymentBasket );
				$titleText		=	htmlspecialchars( sprintf( CBPTXT::T("Subscribe to automatic payments safely with %s"), CBPTXT::T("PayPal") ) );
				break;
			case 'cancel':
				$requestParams	=	$this->_getPaymentBasketSubscriptionCancel( $paymentBasket );
				$titleText		=	$altText;
				break;
			default:
				$requestParams	=	array();
				$titleText		=	null;
		}

		$pspUrl					=	$this->pspUrl( $paymentBasket, ( $paymentType != 'single' ) );
		return cbpaidGatewaySelectorButton::getPaymentButton( $this->getAccountParam( 'id' ), $subMethod, $paymentType, $pspUrl, $requestParams, $customImage, $altText, $titleText, $payNameForCssClass, $butId );
	}
 /**
  * Returns a cbpaidGatewaySelectorButton object parameters for rendering an HTML form with a visible button and hidden fields for the gateway
  * Or a string with HTML content instead (not recommended)
  *
  * @param  cbpaidPaymentBasket  $paymentBasket  paymentBasket object
  * @param  string               $subMethod      'single', 'subscribe' or gateway-specific string (e.g. credit-card brand)
  * @param  string               $paymentType    'single' or 'subscribe' or for subscriptions 'cancel'
  * @return cbpaidGatewaySelectorButton                  or string with HTML
  */
 protected function getPayButtonRecepie($paymentBasket, $subMethod, $paymentType)
 {
     $brandText = CBPTXT::T($this->getAccountParam('psp_human_name'));
     if ($paymentType == 'single') {
         $requestParams = $this->fillinBasicRequstParams($paymentBasket);
         $prmImg = 'image';
         $prmCustImg = 'custom_image';
         $altText = sprintf(CBPTXT::T('Pay with %s'), $brandText);
         $titleText = sprintf(CBPTXT::T($this->getAccountParam('button_title_text', 'Pay safely with %s')), $brandText);
         $butId = 'cbpaidButt' . strtolower($this->getPayName());
     } elseif ($paymentType == 'subscribe') {
         $requestParams = $this->fillinSubscriptionRequstParams($paymentBasket);
         $prmImg = 'subscribe_image';
         $prmCustImg = 'subscribe_custom_image';
         $altText = sprintf(CBPTXT::T('Subscribe with %s'), $brandText);
         $titleText = sprintf(CBPTXT::T($this->getAccountParam('subscribe_button_title_text', 'Subscribe safely with %s')), $brandText);
         $butId = 'cbpaidButt' . strtolower($this->getPayName()) . 'subscr';
     } else {
         return CBPTXT::T("Unknown payment type");
     }
     $customImage = trim($this->getAccountParam($prmCustImg));
     if ($customImage == '') {
         $customImage = trim($this->getAccountParam($prmImg));
     }
     $payNameForCssClass = $this->getPayName();
     return cbpaidGatewaySelectorButton::getPaymentButton($this->getAccountParam('id'), $subMethod, $paymentType, $this->pspUrl($paymentBasket, $paymentType == 'subscribe'), $requestParams, $customImage, $altText, $titleText, $payNameForCssClass, $butId);
 }
 /**
  * Returns a cbpaidGatewaySelectorButton object parameters for rendering an HTML form with a visible button and hidden fields for the gateway
  * Or a string with HTML content instead (not recommended)
  * 
  * @param  cbpaidPaymentBasket  $paymentBasket  paymentBasket object
  * @param  string               $subMethod      'single', 'subscribe' or gateway-specific string (e.g. credit-card brand)
  * @param  string               $paymentType    'single' or 'subscribe' or for subscriptions 'cancel'
  * @return cbpaidGatewaySelectorButton                  or string with HTML
  */
 protected function getPayButtonRecepie($paymentBasket, $subMethod, $paymentType)
 {
     // Generate URLs for payment instructions:
     $instructions_url = $this->pspUrl($paymentBasket, $paymentType == 'subscribe');
     // $return_cancel_url	=	$this->getCancelUrl( $paymentBasket );
     $requestParams = $this->getSinglePaymentRequstParams($paymentBasket);
     $prmImg = 'offline_image';
     $prmCustImg = 'custom_offline_image';
     $titleText = CBPTXT::T($this->getAccountParam('button_title_text'));
     $altText = $titleText;
     $butId = 'cbpaidButt' . strtolower($this->getPayName()) . '_' . $this->getAccountParam('id');
     $customImage = trim($this->getAccountParam($prmCustImg));
     if ($customImage == '') {
         $customImage = trim($this->getAccountParam($prmImg));
     }
     $payNameForCssClass = $this->getPayName();
     return cbpaidGatewaySelectorButton::getPaymentButton($this->getAccountParam('id'), $subMethod, $paymentType, $instructions_url, $requestParams, $customImage, $altText, $titleText, $payNameForCssClass, $butId);
 }
	/**
	 * Returns a cbpaidGatewaySelectorButton object parameters for rendering an HTML form with a visible button and hidden fields for the gateway
	 * Or a string with HTML content instead (not recommended)
	 *
	 * @param  cbpaidPaymentBasket  $paymentBasket  paymentBasket object
	 * @param  string               $subMethod      'single', 'subscribe' or gateway-specific string (e.g. credit-card brand)
	 * @param  string               $paymentType    'single' or 'subscribe' or for subscriptions 'cancel'
	 * @return cbpaidGatewaySelectorButton                  or string with HTML
	 */
	protected function getPayButtonRecepie( $paymentBasket, $subMethod, $paymentType ) {
		$requestParams			=	$this->fillinCCFormRequstParams( $paymentBasket, $paymentType );
		$prmCustImg				=	'cards_custom_image';
		if ( $paymentType ) {
			$altText			=	sprintf( CBPTXT::T("Pay with %s"), CBPTXT::T( ( $paymentType == 'amexco' ) ? 'American Express' : ucwords( $paymentType ) ) );
		} else {
			$altText			=	CBPTXT::T("Pay with your credit card");
		}
		$titleText				=	$altText;
		$butId					=	'cbpaidButt' . strtolower( $paymentType ? $paymentType : $this->getPayName() );

		$customImage			=	trim( $this->getAccountParam( $prmCustImg ) );
		if ( $customImage == '' ) {
			$customImage		=	$this->_renderCCimg( $paymentType, 'big', true );
		}
		$payNameForCssClass		=	$paymentType ? $paymentType : $this->getPayName();

		$pspUrl					=	$this->_getPayFormUrl( $paymentBasket );
		return cbpaidGatewaySelectorButton::getPaymentButton( $this->getAccountParam( 'id' ), $subMethod, $paymentType, $pspUrl, $requestParams, $customImage, $altText, $titleText, $payNameForCssClass, $butId );
	}