/** * Returns an HTML form with a visible button and hidden fields for the gateway * * @param cbpaidPaymentBasket $paymentBasket paymentBasket object * @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 getChangeOfCurrencyButton($paymentBasket, $brandText = null, $brandName = null) { $newCurrency = $this->mainCurrencyOfBrand($brandName); $translatedBrandText = $this->translatedBrandText($brandText); $altText = htmlspecialchars(sprintf(CBPTXT::T("Pay with %s"), $translatedBrandText)); $prmTitleText = $brandName ? $brandName . '_currencies_description' : 'currency_acceptance_text'; $titleText = CBPTXT::T($this->getAccountParam($prmTitleText)); $customImage = $this->customImage($brandName); $payNameForCssClass = $this->getPayName(); $butId = 'cbpaidButt' . strtolower($this->getPayName()); // instead of previously: 'cbpaidButton_' . htmlspecialchars( $this->getPayName() ) return cbpaidGatewaySelectorButton::getChangeOfCurrencyButton($paymentBasket, $newCurrency, $customImage, $altText, $titleText, $payNameForCssClass . ' ' . 'cbregconfirmtitleonclick', $butId); }
/** * Returns a cbpaidGatewaySelectorButton object parameters for rendering an HTML form with a visible button and hidden fields for the gateway * For just switching currency of gateway. * * @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 getChangeOfCurrencyButton( $paymentBasket, $subMethod, $paymentType ) { list( $customImage, $altText, $payNameForCssClass, $butId ) = $this->getPayButtonParams( $paymentType ); $titleText = CBPTXT::T( $this->getAccountParam( 'currency_acceptance_text' ) ); $newCurrency = $this->mainCurrencyOfGateway(); return cbpaidGatewaySelectorButton::getChangeOfCurrencyButton( $paymentBasket, $newCurrency, $customImage, $altText, $titleText, $payNameForCssClass . ' ' . 'cbregconfirmtitleonclick', $butId ); }
/** * Returns a cbpaidGatewaySelectorButton object parameters for rendering an HTML form with a visible button and hidden fields for the gateway * For just switching currency of gateway. * * @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 getChangeOfCurrencyButton($paymentBasket, $subMethod, $paymentType) { $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(); $newCurrency = $this->mainCurrencyOfGateway(); return cbpaidGatewaySelectorButton::getChangeOfCurrencyButton($paymentBasket, $newCurrency, $customImage, $altText, $titleText, $payNameForCssClass . ' ' . 'cbregconfirmtitleonclick', $butId); }
/** * Returns a cbpaidGatewaySelectorButton object parameters for rendering an HTML form with a visible button and hidden fields for the gateway * For just switching currency of gateway. * * @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 getChangeOfCurrencyButton($paymentBasket, $subMethod, $paymentType) { $brandText = CBPTXT::T($this->getAccountParam('psp_human_name')); if ($paymentType == 'single') { $prmImg = 'image'; $prmCustImg = 'custom_image'; $altText = sprintf(CBPTXT::T('Pay with %s'), $brandText); $butId = 'cbpaidButt' . strtolower($this->getPayName()); } elseif ($paymentType == 'subscribe') { $prmImg = 'subscribe_image'; $prmCustImg = 'subscribe_custom_image'; $altText = sprintf(CBPTXT::T('Subscribe 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)); } $titleText = CBPTXT::T($this->getAccountParam('currency_acceptance_text')); $payNameForCssClass = $this->getPayName(); $newCurrency = $this->mainCurrencyOfGateway(); return cbpaidGatewaySelectorButton::getChangeOfCurrencyButton($paymentBasket, $newCurrency, $customImage, $altText, $titleText, $payNameForCssClass . ' ' . 'cbregconfirmtitleonclick', $butId); }
/** * Returns a cbpaidGatewaySelectorButton object parameters for rendering an HTML form with a visible button and hidden fields for the gateway * For just switching currency of gateway. * * @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 getChangeOfCurrencyButton( $paymentBasket, /** @noinspection PhpUnusedParameterInspection */ $subMethod, $paymentType ) { $newCurrency = $this->mainCurrencyOfGateway(); $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"); } $butId = 'cbpaidButt' . strtolower( $paymentType ? $paymentType : $this->getPayName() ); $customImage = trim( $this->getAccountParam( $prmCustImg ) ); if ( $customImage == '' ) { $customImage = $this->_renderCCimg( $paymentType, 'big', true ); } $titleText = CBPTXT::T( $this->getAccountParam( 'currency_acceptance_text' ) ); $payNameForCssClass = $paymentType ? $paymentType : $this->getPayName(); return cbpaidGatewaySelectorButton::getChangeOfCurrencyButton( $paymentBasket, $newCurrency, $customImage, $altText, $titleText, $payNameForCssClass . ' ' . 'cbregconfirmtitleonclick', $butId ); }