The point of this is to allow the payment form to be disambiguated from the contribution & event forms - allowing it to be called from elsewhere
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1" ?>
+
+<menu>
+ <item>
+ <path>civicrm/payment/form</path>
+ <access_callback>1</access_callback>
+ <page_callback>CRM_Financial_Form_Payment</page_callback>
+ <is_public>true</is_public>
+ <weight>0</weight>
+ </item>
+</menu>
* @return array
* associated array with payment processor related fields
*/
- public static function getPayment($paymentProcessorID, $mode) {
+ public static function getPayment($paymentProcessorID, $mode = 'based_on_id') {
if (!$paymentProcessorID) {
CRM_Core_Error::fatal(ts('Invalid value passed to getPayment function'));
}
--- /dev/null
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.6 |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM. |
+ | |
+ | CiviCRM is free software; you can copy, modify, and distribute it |
+ | under the terms of the GNU Affero General Public License |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
+ | |
+ | CiviCRM is distributed in the hope that it will be useful, but |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
+ | See the GNU Affero General Public License for more details. |
+ | |
+ | You should have received a copy of the GNU Affero General Public |
+ | License and the CiviCRM Licensing Exception along |
+ | with this program; if not, contact CiviCRM LLC |
+ | at info[AT]civicrm[DOT]org. If you have questions about the |
+ | GNU Affero General Public License or the licensing of CiviCRM, |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+ */
+
+/**
+ *
+ * @package CRM
+ * @copyright CiviCRM LLC (c) 2004-2015
+ * $Id$
+ *
+ */
+class CRM_Financial_Form_Payment extends CRM_Core_Form {
+ /**
+ * Set variables up before form is built.
+ *
+ * @return void
+ */
+ public function preProcess() {
+ parent::preProcess();
+ $this->_paymentProcessorID = CRM_Utils_Request::retrieve('processor_id', 'Integer', CRM_Core_DAO::$_nullObject,
+ TRUE);
+
+ $this->assignBillingType();
+
+ // @todo - round about way to load it - just load as an object using civi\payment\system::getByProcessor
+ $this->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($this->_paymentProcessorID, 'unused');
+ CRM_Core_Payment_ProcessorForm::preProcess($this);
+
+ //@todo - figure out how to deal with payment express.
+ //get payPal express id and make it available to template
+ //$payPalExpressId = ($values['payment_processor_type'] == 'PayPal_Express') ? $values['id'] : 0;
+ // $this->assign('payPalExpressId', $payPalExpressId);
+
+ // Add JS to show icons for the accepted credit cards
+
+ $creditCardTypes = CRM_Core_Payment_Form::getCreditCardCSSNames();
+ CRM_Core_Resources::singleton()
+ ->addScriptFile('civicrm', 'templates/CRM/Core/BillingBlock.js', 10)
+ // workaround for CRM-13634
+ // ->addSetting(array('config' => array('creditCardTypes' => $creditCardTypes)));
+ ->addScript('CRM.config.creditCardTypes = ' . json_encode($creditCardTypes) . ';');
+
+ $this->assign('paymentProcessorID', $this->_paymentProcessorID);
+ }
+
+ public function buildQuickForm() {
+ CRM_Core_Payment_ProcessorForm::buildQuickForm($this);
+ }
+
+}
<legend>
{$paymentTypeLabel}
</legend>
- {if $form.$expressButtonName}
- {include file= "CRM/Core/paypalexpress.tpl"}
- {/if}
+ {crmRegion name="billing-block-pre"}
+ {* todo move this region assignment to paypal processor *}
+ {include file= "CRM/Financial/PaypalPro.tpl"}
+ {/crmRegion}
<div class="crm-section billing_mode-section {$paymentTypeName}_info-section">
{foreach from=$paymentFields item=paymentField}
<div class="crm-section {$form.$paymentField.name}-section">
{/literal}
</script>
{/if}
-
{/crmRegion}
+
+{if $is_monetary}
+ {crmRegion name="billing-block-post"}
+ {* Payment processors sometimes need to append something to the end of the billing block. We create a region for
+ clarity - the plan is to move to assigning this through the payment processor to this region *}
+ {include file= "CRM/Financial/PaypalExpress.tpl"}
+ {/crmRegion}
+{/if}
+--------------------------------------------------------------------+
*}
-<div class="crm-section no-label paypal_button_info-section">
- <div class="content description">
- {ts}If you have a PayPal account, you can click the PayPal button to continue. Otherwise, fill in the credit card and billing information on this form and click <strong>Continue</strong> at the bottom of the page.{/ts}
- </div>
-</div>
-<div class="crm-section no-label {$form.$expressButtonName.name}-section">
- <div class="content description">
- {$form.$expressButtonName.html}
- <div class="description">Save time. Checkout securely. Pay without sharing your financial information.</div>
- </div>
+{* wrapper for the billing block including the div to make the block swappable & the js to make that happen
+This allows the billing block to change when the card type changes *}
+<div id="billing-payment-block">
+ {include file="CRM/Core/BillingBlock.tpl"}
</div>
--- /dev/null
+{*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.6 |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM. |
+ | |
+ | CiviCRM is free software; you can copy, modify, and distribute it |
+ | under the terms of the GNU Affero General Public License |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
+ | |
+ | CiviCRM is distributed in the hope that it will be useful, but |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
+ | See the GNU Affero General Public License for more details. |
+ | |
+ | You should have received a copy of the GNU Affero General Public |
+ | License and the CiviCRM Licensing Exception along |
+ | with this program; if not, contact CiviCRM LLC |
+ | at info[AT]civicrm[DOT]org. If you have questions about the |
+ | GNU Affero General Public License or the licensing of CiviCRM, |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+*}
+
+{include file="CRM/Core/BillingBlockWrapper.tpl"}
--- /dev/null
+{*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.6 |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM. |
+ | |
+ | CiviCRM is free software; you can copy, modify, and distribute it |
+ | under the terms of the GNU Affero General Public License |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
+ | |
+ | CiviCRM is distributed in the hope that it will be useful, but |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
+ | See the GNU Affero General Public License for more details. |
+ | |
+ | You should have received a copy of the GNU Affero General Public |
+ | License and the CiviCRM Licensing Exception along |
+ | with this program; if not, contact CiviCRM LLC |
+ | at info[AT]civicrm[DOT]org. If you have questions about the |
+ | GNU Affero General Public License or the licensing of CiviCRM, |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+*}
+{if $paymentProcessor.payment_processor_type EQ 'PayPal_Express'}
+ <div id="paypalExpress">
+ {assign var=expressButtonName value='_qf_Main_upload_express'}
+ <fieldset class="crm-group paypal_checkout-group">
+ <legend>{ts}Checkout with PayPal{/ts}</legend>
+ <div class="section">
+ <div class="crm-section paypalButtonInfo-section">
+ <div class="content">
+ <span class="description">{ts}Click the PayPal button to continue.{/ts}</span>
+ </div>
+ <div class="clear"></div>
+ </div>
+ <div class="crm-section {$expressButtonName}-section">
+ <div class="content">
+ {$form.$expressButtonName.html} <span class="description">Checkout securely. Pay without sharing your financial information. </span>
+ </div>
+ <div class="clear"></div>
+ </div>
+ </div>
+ </fieldset>
+ </div>
+{/if}
--- /dev/null
+{*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.6 |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM. |
+ | |
+ | CiviCRM is free software; you can copy, modify, and distribute it |
+ | under the terms of the GNU Affero General Public License |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
+ | |
+ | CiviCRM is distributed in the hope that it will be useful, but |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
+ | See the GNU Affero General Public License for more details. |
+ | |
+ | You should have received a copy of the GNU Affero General Public |
+ | License and the CiviCRM Licensing Exception along |
+ | with this program; if not, contact CiviCRM LLC |
+ | at info[AT]civicrm[DOT]org. If you have questions about the |
+ | GNU Affero General Public License or the licensing of CiviCRM, |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+*}
+{if $form.$expressButtonName}
+ <div class="crm-section no-label paypal_button_info-section">
+ <div class="content description">
+ {ts}If you have a PayPal account, you can click the PayPal button to continue. Otherwise, fill in the credit card and billing information on this form and click <strong>Continue</strong> at the bottom of the page.{/ts}
+ </div>
+ </div>
+ <div class="crm-section no-label {$form.$expressButtonName.name}-section">
+ <div class="content description">
+ {$form.$expressButtonName.html}
+ <div class="description">Save time. Checkout securely. Pay without sharing your financial information.</div>
+ </div>
+ </div>
+{/if}