From 229159bfab524908245b013b2619031079e3793f Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Mon, 18 Jan 2016 20:39:43 -0500 Subject: [PATCH] CRM-17429 - Remove Google Checkout payment processor --- CRM/Contribute/Form/Contribution/Confirm.php | 73 +- .../Form/ContributionPage/Amount.php | 4 - CRM/Core/Payment/Google.php | 428 ----------- CRM/Core/Payment/GoogleIPN.php | 710 ------------------ CRM/Event/Form/Registration/Confirm.php | 52 +- bin/ContributionProcessor.php | 204 ----- extern/googleNotify.php | 46 -- templates/CRM/Admin/Page/PaymentProcessor.hlp | 107 --- .../Contribute/Form/Contribution/Confirm.tpl | 19 +- .../CRM/Event/Form/Registration/Confirm.tpl | 15 - templates/CRM/Member/Form/MembershipBlock.hlp | 1 - .../phpunit/CiviTest/CiviSeleniumTestCase.php | 7 - .../Contribute/VerifySSLContributionTest.php | 1 - .../OnlineAutoRenewMembershipGCTest.php | 94 --- xml/templates/civicrm_data.tpl | 1 - 15 files changed, 41 insertions(+), 1721 deletions(-) delete mode 100644 CRM/Core/Payment/Google.php delete mode 100644 CRM/Core/Payment/GoogleIPN.php delete mode 100644 extern/googleNotify.php diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index 3a6da5ebf2..ddc7ab67a8 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -478,56 +478,35 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $this->_params['is_quick_config'] = 1; } $this->assign('priceSetID', $this->_priceSetId); - $paymentProcessorType = CRM_Core_PseudoConstant::paymentProcessorType(FALSE, NULL, 'name'); - if ($this->_paymentProcessor && - $this->_paymentProcessor['payment_processor_type_id'] == CRM_Utils_Array::key('Google_Checkout', $paymentProcessorType) - && !$this->_params['is_pay_later'] && !($this->_amount == 0) - ) { - $this->_checkoutButtonName = $this->getButtonName('next', 'checkout'); - $this->add('image', - $this->_checkoutButtonName, - $this->_paymentProcessor['url_button'], - array('class' => 'crm-form-submit') - ); - $this->addButtons(array( - array( - 'type' => 'back', - 'name' => ts('Go Back'), - ), - ) - ); + // The concept of contributeMode is deprecated. + // the is_monetary concept probably should be too as it can be calculated from + // the existence of 'amount' & seems fragile. + if ($this->_contributeMode == 'notify' || !$this->_values['is_monetary'] || + $this->_amount <= 0.0 || $this->_params['is_pay_later'] || + ($this->_separateMembershipPayment && $this->_amount <= 0.0) + ) { + $contribButton = ts('Continue'); + $this->assign('button', ts('Continue')); } else { - // The concept of contributeMode is deprecated. - // the is_monetary concept probably should be too as it can be calculated from - // the existence of 'amount' & seems fragile. - if ($this->_contributeMode == 'notify' || !$this->_values['is_monetary'] || - $this->_amount <= 0.0 || $this->_params['is_pay_later'] || - ($this->_separateMembershipPayment && $this->_amount <= 0.0) - ) { - $contribButton = ts('Continue'); - $this->assign('button', ts('Continue')); - } - else { - $contribButton = ts('Make Contribution'); - $this->assign('button', ts('Make Contribution')); - } - $this->addButtons(array( - array( - 'type' => 'next', - 'name' => $contribButton, - 'spacing' => '         ', - 'isDefault' => TRUE, - 'js' => array('onclick' => "return submitOnce(this,'" . $this->_name . "','" . ts('Processing') . "');"), - ), - array( - 'type' => 'back', - 'name' => ts('Go Back'), - ), - ) - ); - } + $contribButton = ts('Make Contribution'); + $this->assign('button', ts('Make Contribution')); + } + $this->addButtons(array( + array( + 'type' => 'next', + 'name' => $contribButton, + 'spacing' => '         ', + 'isDefault' => TRUE, + 'js' => array('onclick' => "return submitOnce(this,'" . $this->_name . "','" . ts('Processing') . "');"), + ), + array( + 'type' => 'back', + 'name' => ts('Go Back'), + ), + ) + ); $defaults = array(); $fields = array_fill_keys(array_keys($this->_fields), 1); diff --git a/CRM/Contribute/Form/ContributionPage/Amount.php b/CRM/Contribute/Form/ContributionPage/Amount.php index 2b12b55fd8..c4637a93dd 100644 --- a/CRM/Contribute/Form/ContributionPage/Amount.php +++ b/CRM/Contribute/Form/ContributionPage/Amount.php @@ -401,10 +401,6 @@ SELECT id 'payment_processor_type_id' ); $paymentProcessorType = CRM_Core_PseudoConstant::paymentProcessorType(FALSE, $paymentProcessorTypeId, 'name'); - if ($paymentProcessorType == 'Google_Checkout') { - $errors['is_recur_interval'] = ts('Google Checkout does not support recurring intervals'); - break; - } } } diff --git a/CRM/Core/Payment/Google.php b/CRM/Core/Payment/Google.php deleted file mode 100644 index 3d82a5df43..0000000000 --- a/CRM/Core/Payment/Google.php +++ /dev/null @@ -1,428 +0,0 @@ -_mode = $mode; - $this->_paymentProcessor = $paymentProcessor; - $this->_processorName = ts('Google Checkout'); - } - - /** - * This function checks to see if we have the right config values. - * - * @return string - * the error message if any - */ - public function checkConfig() { - $config = CRM_Core_Config::singleton(); - - $error = array(); - - if (empty($this->_paymentProcessor['user_name'])) { - $error[] = ts('User Name is not set in the Administer CiviCRM » System Settings » Payment Processors.'); - } - - if (empty($this->_paymentProcessor['password'])) { - $error[] = ts('Password is not set in the Administer CiviCRM » System Settings » Payment Processors.'); - } - - if (!empty($error)) { - return implode('

', $error); - } - else { - return NULL; - } - } - - /** - * Sets appropriate parameters for checking out to google. - * - * @param array $params - * Name value pair of contribution data. - * - * @param string $component - */ - public function doTransferCheckout(&$params, $component) { - $component = strtolower($component); - - if (!empty($params['is_recur']) && - $params['contributionRecurID'] - ) { - return $this->doRecurCheckout($params, $component); - } - - //Create a new shopping cart object - // Merchant ID - $merchant_id = $this->_paymentProcessor['user_name']; - // Merchant Key - $merchant_key = $this->_paymentProcessor['password']; - $server_type = ($this->_mode == 'test') ? 'sandbox' : ''; - - $cart = new GoogleCart($merchant_id, $merchant_key, $server_type, $params['currencyID']); - $item1 = new GoogleItem($params['item_name'], '', 1, $params['amount']); - $cart->AddItem($item1); - - $this->submitPostParams($params, $component, $cart); - } - - /** - * @param array $params - * @param $component - */ - public function doRecurCheckout(&$params, $component) { - $intervalUnit = CRM_Utils_Array::value('frequency_unit', $params); - if ($intervalUnit == 'week') { - $intervalUnit = 'WEEKLY'; - } - elseif ($intervalUnit == 'year') { - $intervalUnit = 'YEARLY'; - } - elseif ($intervalUnit == 'day') { - $intervalUnit = 'DAILY'; - } - elseif ($intervalUnit == 'month') { - $intervalUnit = 'MONTHLY'; - } - - // Merchant ID - $merchant_id = $this->_paymentProcessor['user_name']; - // Merchant Key - $merchant_key = $this->_paymentProcessor['password']; - $server_type = ($this->_mode == 'test') ? 'sandbox' : ''; - - $itemName = CRM_Utils_Array::value('item_name', $params); - $description = CRM_Utils_Array::value('description', $params); - $amount = CRM_Utils_Array::value('amount', $params); - $installments = CRM_Utils_Array::value('installments', $params); - - $cart = new GoogleCart($merchant_id, $merchant_key, $server_type, $params['currencyID']); - $item = new GoogleItem($itemName, $description, 1, $amount); - $subscription_item = new GoogleSubscription("merchant", $intervalUnit, $amount, $installments); - - $item->SetSubscription($subscription_item); - $cart->AddItem($item); - - $this->submitPostParams($params, $component, $cart); - } - - /** - * Builds appropriate parameters for checking out to google and submits the post params. - * - * @param array $params - * Name value pair of contribution data. - * @param string $component - * Event/contribution. - * @param object $cart - * Object of google cart. - */ - public function submitPostParams($params, $component, $cart) { - $url = rtrim($this->_paymentProcessor['url_site'], '/') . '/cws/v2/Merchant/' . $this->_paymentProcessor['user_name'] . '/checkout'; - - if ($component == "event") { - $privateData = "contactID={$params['contactID']},contributionID={$params['contributionID']},contributionTypeID={$params['contributionTypeID']},eventID={$params['eventID']},participantID={$params['participantID']},invoiceID={$params['invoiceID']}"; - } - elseif ($component == "contribute") { - $privateData = "contactID={$params['contactID']},contributionID={$params['contributionID']},contributionTypeID={$params['contributionTypeID']},invoiceID={$params['invoiceID']}"; - - $contributionRecurID = CRM_Utils_Array::value('contributionRecurID', $params); - if ($contributionRecurID) { - $privateData .= ",contributionRecurID=$contributionRecurID"; - } - - $membershipID = CRM_Utils_Array::value('membershipID', $params); - if ($membershipID) { - $privateData .= ",membershipID=$membershipID"; - } - - $relatedContactID = CRM_Utils_Array::value('related_contact', $params); - if ($relatedContactID) { - $privateData .= ",relatedContactID=$relatedContactID"; - - $onBehalfDupeAlert = CRM_Utils_Array::value('onbehalf_dupe_alert', $params); - if ($onBehalfDupeAlert) { - $privateData .= ",onBehalfDupeAlert=$onBehalfDupeAlert"; - } - } - } - - // Allow further manipulation of the arguments via custom hooks .. - CRM_Utils_Hook::alterPaymentProcessorParams($this, $params, $privateData); - - $cart->SetMerchantPrivateData($privateData); - - if ($component == "event") { - $returnURL = CRM_Utils_System::url('civicrm/event/register', - "_qf_ThankYou_display=1&qfKey={$params['qfKey']}", - TRUE, NULL, FALSE - ); - } - elseif ($component == "contribute") { - $returnURL = CRM_Utils_System::url('civicrm/contribute/transact', - "_qf_ThankYou_display=1&qfKey={$params['qfKey']}", - TRUE, NULL, FALSE - ); - } - $cart->SetContinueShoppingUrl($returnURL); - - $cartVal = base64_encode($cart->GetXML()); - $signatureVal = base64_encode($cart->CalcHmacSha1($cart->GetXML())); - - $googleParams = array( - 'cart' => $cartVal, - 'signature' => $signatureVal, - ); - - require_once 'HTTP/Request.php'; - $params = array( - 'method' => HTTP_REQUEST_METHOD_POST, - 'allowRedirects' => FALSE, - ); - $request = new HTTP_Request($url, $params); - foreach ($googleParams as $key => $value) { - $request->addPostData($key, $value); - } - - $result = $request->sendRequest(); - - if (PEAR::isError($result)) { - CRM_Core_Error::fatal($result->getMessage()); - } - - if ($request->getResponseCode() != 302) { - CRM_Core_Error::fatal(ts('Invalid response code received from Google Checkout: %1', - array(1 => $request->getResponseCode()) - )); - } - CRM_Utils_System::redirect($request->getResponseHeader('location')); - CRM_Utils_System::civiExit(); - } - - /** - * Hash_call: Function to perform the API call to PayPal using API signature - * - * @paymentProcessor is the array of payment processor settings value. - * @searchParamsnvpStr is the array of search params. - * returns an associtive array containing the response from the server. - * - * @param $paymentProcessor - * @param $searchParams - * - * @return array|object - * @throws \Exception - */ - public function invokeAPI($paymentProcessor, $searchParams) { - $merchantID = $paymentProcessor['user_name']; - $merchantKey = $paymentProcessor['password']; - $siteURL = rtrim(str_replace('https://', '', $paymentProcessor['url_site']), '/'); - - $url = "https://{$merchantID}:{$merchantKey}@{$siteURL}/api/checkout/v2/reports/Merchant/{$merchantID}"; - $xml = self::buildXMLQuery($searchParams); - - if (!function_exists('curl_init')) { - CRM_Core_Error::fatal("curl functions NOT available."); - } - - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_VERBOSE, 1); - - //turning off the server and peer verification(TrustManager Concept). - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, Civi::settings()->get('verifySSL')); - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, Civi::settings()->get('verifySSL') ? 2 : 0); - - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_POST, 1); - - //setting the nvpreq as POST FIELD to curl - curl_setopt($ch, CURLOPT_POSTFIELDS, $xml); - - //getting response from server - $xmlResponse = curl_exec($ch); - - // strip slashes if needed - if (get_magic_quotes_gpc()) { - $xmlResponse = stripslashes($xmlResponse); - } - - if (curl_errno($ch)) { - $e = CRM_Core_Error::singleton(); - $e->push(curl_errno($ch), - 0, NULL, - curl_error($ch) - ); - return $e; - } - else { - curl_close($ch); - } - - return self::getArrayFromXML($xmlResponse); - } - - /** - * @param array $searchParams - * - * @return string - */ - public static function buildXMLQuery($searchParams) { - $xml = ' -'; - - if (array_key_exists('next-page-token', $searchParams)) { - $xml .= ' -' . $searchParams['next-page-token'] . ''; - } - if (array_key_exists('start', $searchParams)) { - $xml .= ' -' . $searchParams['start'] . ' -' . $searchParams['end'] . ''; - } - if (array_key_exists('notification-types', $searchParams)) { - $xml .= ' - -' . implode($searchParams['notification-types'], ' -') . ' -'; - } - if (array_key_exists('order-numbers', $searchParams)) { - $xml .= ' - -' . implode($searchParams['order-numbers'], ' -') . ' -'; - } - $xml .= ' -'; - - return $xml; - } - - /** - * @param $xmlData - * - * @return array - */ - public static function getArrayFromXML($xmlData) { - require_once 'Google/library/xml-processing/gc_xmlparser.php'; - $xmlParser = new gc_XmlParser($xmlData); - $root = $xmlParser->GetRoot(); - $data = $xmlParser->GetData(); - - return array($root, $data); - } - - /** - * @param null $errorCode - * @param null $errorMessage - * - * @return object - */ - public function &error($errorCode = NULL, $errorMessage = NULL) { - $e = &CRM_Core_Error::singleton(); - if ($errorCode) { - $e->push($errorCode, 0, NULL, $errorMessage); - } - else { - $e->push(9001, 0, NULL, 'Unknown System Error.'); - } - return $e; - } - - /** - * @return string - */ - public function accountLoginURL() { - return ($this->_mode == 'test') ? 'https://sandbox.google.com/checkout/sell' : 'https://checkout.google.com/'; - } - - /** - * @param string $message - * @param array $params - * - * @return bool|object - */ - public function cancelSubscription(&$message = '', $params = array()) { - $orderNo = CRM_Utils_Array::value('subscriptionId', $params); - - $merchant_id = $this->_paymentProcessor['user_name']; - $merchant_key = $this->_paymentProcessor['password']; - $server_type = ($this->_mode == 'test') ? 'sandbox' : ''; - - $googleRequest = new GoogleRequest($merchant_id, $merchant_key, $server_type); - $result = $googleRequest->SendCancelItems($orderNo, array(), 'Cancelled by admin', ''); - $message = "{$result[0]}: {$result[1]}"; - - if ($result[0] != 200) { - return self::error($result[0], $result[1]); - } - return TRUE; - } - -} diff --git a/CRM/Core/Payment/GoogleIPN.php b/CRM/Core/Payment/GoogleIPN.php deleted file mode 100644 index 2e107a62df..0000000000 --- a/CRM/Core/Payment/GoogleIPN.php +++ /dev/null @@ -1,710 +0,0 @@ -Integration as the - * "API Callback URL' - * Order processing commands can be sent automatically by placing these - * commands appropriately - * - * To use this code for merchant-calculated feedback, this url must be - * set also as the merchant-calculations-url when the cart is posted - * Depending on your calculations for shipping, taxes, coupons and gift - * certificates update parts of the code as required. - */ - -define('GOOGLE_DEBUG_PP', 0); - -/** - * Class CRM_Core_Payment_GoogleIPN. - */ -class CRM_Core_Payment_GoogleIPN extends CRM_Core_Payment_BaseIPN { - - /** - * We only need one instance of this object. So we use the singleton - * pattern and cache the instance in this variable - * - * @var object - */ - static private $_singleton = NULL; - - /** - * Mode of operation: live or test - * - * @var object - */ - protected $_mode = NULL; - - /** - * @param string $name - * @param $type - * @param $object - * @param bool $abort - * - * @return mixed - */ - public static function retrieve($name, $type, $object, $abort = TRUE) { - $value = CRM_Utils_Array::value($name, $object); - if ($abort && $value === NULL) { - CRM_Core_Error::debug_log_message("Could not find an entry for $name"); - echo "Failure: Missing Parameter

"; - exit(); - } - - if ($value) { - if (!CRM_Utils_Type::validate($value, $type)) { - CRM_Core_Error::debug_log_message("Could not find a valid entry for $name"); - echo "Failure: Invalid Parameter

"; - exit(); - } - } - - return $value; - } - - /** - * Constructor. - * - * @param string $mode - * The mode of operation: live or test. - * - * @param $paymentProcessor - * - * @return \CRM_Core_Payment_GoogleIPN - */ - public function __construct($mode, &$paymentProcessor) { - parent::__construct(); - - $this->_mode = $mode; - $this->_paymentProcessor = $paymentProcessor; - } - - /** - * The function gets called when a new order takes place. - * - * @param xml $dataRoot - * Response send by google in xml format. - * @param array $privateData - * Contains the name value pair of . - * - * @param string $component - * - * @return bool - */ - public function newOrderNotify($dataRoot, $privateData, $component) { - $ids = $input = $params = array(); - - $input['component'] = strtolower($component); - - $ids['contact'] = self::retrieve('contactID', 'Integer', $privateData, TRUE); - $ids['contribution'] = self::retrieve('contributionID', 'Integer', $privateData, TRUE); - - $ids['contributionRecur'] = $ids['contributionPage'] = NULL; - if ($input['component'] == "event") { - $ids['event'] = self::retrieve('eventID', 'Integer', $privateData, TRUE); - $ids['participant'] = self::retrieve('participantID', 'Integer', $privateData, TRUE); - $ids['membership'] = NULL; - } - else { - $ids['membership'] = self::retrieve('membershipID', 'Integer', $privateData, FALSE); - $ids['related_contact'] = self::retrieve('relatedContactID', 'Integer', $privateData, FALSE); - $ids['onbehalf_dupe_alert'] = self::retrieve('onBehalfDupeAlert', 'Integer', $privateData, FALSE); - $ids['contributionRecur'] = self::retrieve('contributionRecurID', 'Integer', $privateData, FALSE); - } - - $paymentProcessorID = CRM_Core_DAO::getFieldValue( - 'CRM_Financial_DAO_PaymentProcessorType', - 'Google_Checkout', - 'id', - 'payment_processor_type' - ); - - if (!$this->validateData($input, $ids, $objects, TRUE, $paymentProcessorID)) { - return FALSE; - } - - $input['invoice'] = $privateData['invoiceID']; - $input['newInvoice'] = $dataRoot['google-order-number']['VALUE']; - - if ($ids['contributionRecur']) { - if ($objects['contributionRecur']->invoice_id == $dataRoot['serial-number']) { - CRM_Core_Error::debug_log_message("The new order notification already handled: {$dataRoot['serial-number']}."); - return FALSE; - } - else { - $transaction = new CRM_Core_Transaction(); - - CRM_Core_Error::debug_log_message("New order for an installment received."); - $recur = &$objects['contributionRecur']; - - // fix dates that already exist - $dates = array('create', 'start', 'end', 'cancel', 'modified'); - foreach ($dates as $date) { - $name = "{$date}_date"; - if ($recur->$name) { - $recur->$name = CRM_Utils_Date::isoToMysql($recur->$name); - } - } - $recur->invoice_id = $dataRoot['serial-number']; - $recur->processor_id = $input['newInvoice']; - $recur->save(); - - if ($objects['contribution']->contribution_status_id == 1) { - // create a contribution and then get it processed - $contribution = new CRM_Contribute_DAO_Contribution(); - $contribution->contact_id = $ids['contact']; - $contribution->financial_type_id = $objects['contributionType']->id; - $contribution->contribution_page_id = $objects['contribution']->contribution_page_id; - $contribution->contribution_recur_id = $ids['contributionRecur']; - $contribution->receive_date = date('YmdHis'); - $contribution->currency = $objects['contribution']->currency; - $contribution->payment_instrument_id = $objects['contribution']->payment_instrument_id; - $contribution->amount_level = $objects['contribution']->amount_level; - $contribution->address_id = $objects['contribution']->address_id; - $contribution->invoice_id = $input['invoice']; - $contribution->total_amount = $dataRoot['order-total']['VALUE']; - $contribution->contribution_status_id = 2; - $contribution->campaign_id = $objects['contribution']->campaign_id; - - $objects['contribution'] = $contribution; - } - $transaction->commit(); - } - } - - // make sure the invoice is valid and matches what we have in the contribution record - $contribution = &$objects['contribution']; - - if ($contribution->invoice_id != $input['invoice']) { - CRM_Core_Error::debug_log_message("Invoice values don't match between database and IPN request"); - return FALSE; - } - - // lets replace invoice-id with google-order-number because thats what is common and unique - // in subsequent calls or notifications sent by google. - $contribution->invoice_id = $input['newInvoice']; - - $input['amount'] = $dataRoot['order-total']['VALUE']; - - if ($contribution->total_amount != $input['amount']) { - CRM_Core_Error::debug_log_message("Amount values dont match between database and IPN request"); - return FALSE; - } - - if (!$this->getInput($input, $ids, $dataRoot)) { - return FALSE; - } - - $transaction = new CRM_Core_Transaction(); - - // check if contribution is already completed, if so we ignore this ipn - if ($contribution->contribution_status_id == 1) { - CRM_Core_Error::debug_log_message("returning since contribution has already been handled"); - return FALSE; - } - else { - /* Since trxn_id hasn't got any use here, - * lets make use of it by passing the eventID/membershipTypeID to next level. - * And change trxn_id to google-order-number before finishing db update */ - - if (!empty($ids['event'])) { - $contribution->trxn_id = $ids['event'] . CRM_Core_DAO::VALUE_SEPARATOR . $ids['participant']; - } - elseif (!empty($ids['membership'])) { - $contribution->trxn_id = $ids['membership'][0] . CRM_Core_DAO::VALUE_SEPARATOR . $ids['related_contact'] . CRM_Core_DAO::VALUE_SEPARATOR . $ids['onbehalf_dupe_alert']; - } - } - - $contribution->save(); - $transaction->commit(); - - return TRUE; - } - - /** - * The function gets called when the state(CHARGED, CANCELLED..) changes for an order - * - * @param string $status - * Status of the transaction send by google. - * @param $dataRoot - * @param array $privateData - * Contains the name value pair of . - * - * @param string $component - * - * @return bool - */ - public function orderStateChange($status, $dataRoot, $privateData, $component) { - $input = $objects = $ids = array(); - $input['component'] = strtolower($component); - - $ids['contributionRecur'] = self::retrieve('contributionRecurID', 'Integer', $privateData, FALSE); - $serial = $dataRoot['serial-number']; - $orderNo = $dataRoot['google-order-number']['VALUE']; - - $contribution = new CRM_Contribute_BAO_Contribution(); - $contribution->invoice_id = $orderNo; - - if (!$contribution->find(TRUE)) { - CRM_Core_Error::debug_log_message("orderStateChange: Could not find contribution record with invoice id: $serial"); - return FALSE; - } - - // Google sends the charged notification twice. - // So to make sure, code is not executed again. - if ($contribution->contribution_status_id == 1) { - CRM_Core_Error::debug_log_message("Contribution already handled (ContributionID = {$contribution->id})."); - return FALSE; - } - - // make sure invoice is set to serial no for recurring payments, to avoid violating uniqueness - $contribution->invoice_id = $ids['contributionRecur'] ? $serial : $orderNo; - - $objects['contribution'] = &$contribution; - $ids['contribution'] = $contribution->id; - $ids['contact'] = $contribution->contact_id; - - $ids['event'] = $ids['participant'] = $ids['membership'] = NULL; - $ids['contributionPage'] = NULL; - - if ($input['component'] == "event") { - list($ids['event'], $ids['participant']) = explode(CRM_Core_DAO::VALUE_SEPARATOR, - $contribution->trxn_id - ); - } - else { - $ids['related_contact'] = NULL; - $ids['onbehalf_dupe_alert'] = NULL; - if ($contribution->trxn_id) { - list($ids['membership'], $ids['related_contact'], $ids['onbehalf_dupe_alert']) = explode(CRM_Core_DAO::VALUE_SEPARATOR, - $contribution->trxn_id - ); - } - foreach (array( - 'membership', - 'related_contact', - 'onbehalf_dupe_alert', - ) as $fld) { - if (!is_numeric($ids[$fld])) { - unset($ids[$fld]); - } - } - } - - $paymentProcessorID = CRM_Core_DAO::getFieldValue( - 'CRM_Financial_DAO_PaymentProcessorType', - 'Google_Checkout', - 'id', - 'payment_processor_type' - ); - - $this->loadObjects($input, $ids, $objects, TRUE, $paymentProcessorID); - - $transaction = new CRM_Core_Transaction(); - - if ($status == 'PAYMENT_DECLINED' || - $status == 'CANCELLED_BY_GOOGLE' || - $status == 'CANCELLED' - ) { - return $this->failed($objects, $transaction); - } - - $input['amount'] = $contribution->total_amount; - $input['fee_amount'] = NULL; - $input['net_amount'] = NULL; - $input['trxn_id'] = $ids['contributionRecur'] ? $serial : $dataRoot['google-order-number']['VALUE']; - $input['is_test'] = $contribution->is_test; - - $recur = NULL; - if ($ids['contributionRecur']) { - $recur = $objects['contributionRecur']; - } - $this->completeTransaction($input, $ids, $objects, $transaction, $recur); - - $this->completeRecur($input, $ids, $objects); - } - - /** - * @param $input - * @param $ids - * @param $objects - */ - public function completeRecur($input, $ids, $objects) { - if ($ids['contributionRecur']) { - $recur = &$objects['contributionRecur']; - $contributionCount = CRM_Core_DAO::singleValueQuery(" -SELECT count(*) -FROM civicrm_contribution -WHERE contribution_recur_id = {$ids['contributionRecur']} -"); - $autoRenewMembership = FALSE; - if ($recur->id && - isset($ids['membership']) && - $ids['membership'] - ) { - $autoRenewMembership = TRUE; - } - if ($recur->installments && ($contributionCount >= $recur->installments)) { - $contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name'); - - $recur->create_date = CRM_Utils_Date::isoToMysql($recur->create_date); - $recur->start_date = CRM_Utils_Date::isoToMysql($recur->start_date); - $recur->cancel_date = CRM_Utils_Date::isoToMysql($recur->cancel_date); - $recur->end_date = date('YmdHis'); - $recur->modified_date = date('YmdHis'); - $recur->contribution_status_id = array_search('Completed', $contributionStatus); - $recur->trnx_id = $dataRoot['google-order-number']['VALUE']; - $recur->save(); - - //send recurring Notification email for user - CRM_Contribute_BAO_ContributionPage::recurringNotify( - CRM_Core_Payment::RECURRING_PAYMENT_END, - $ids['contact'], - $ids['contributionPage'], - $recur, - $autoRenewMembership - ); - } - elseif ($contributionCount == 1) { - CRM_Contribute_BAO_ContributionPage::recurringNotify( - CRM_Core_Payment::RECURRING_PAYMENT_START, - $ids['contact'], - $ids['contributionPage'], - $recur, - $autoRenewMembership - ); - } - } - } - - /** - * @deprecated - * Payment processor singletons removed - this is an IPN so left but probably can go - * Singleton function used to manage this object - * - * @param string $mode - * The mode of operation: live or test. - * - * @param $component - * @param $paymentProcessor - * - * @return object - */ - public static function &singleton($mode, $component, &$paymentProcessor) { - if (self::$_singleton === NULL) { - self::$_singleton = new CRM_Core_Payment_GoogleIPN($mode, $paymentProcessor); - } - return self::$_singleton; - } - - /** - * The function retrieves the amount the contribution is for, based on the order-no google sends - * - * @param int $orderNo - * send by google. - * - * @return amount - */ - public function getAmount($orderNo) { - $contribution = new CRM_Contribute_DAO_Contribution(); - $contribution->invoice_id = $orderNo; - if (!$contribution->find(TRUE)) { - CRM_Core_Error::debug_log_message("getAmount: Could not find contribution record with invoice id: $orderNo"); - echo "Failure: Could not find contribution record with invoice id: $orderNo

"; - exit(); - } - return $contribution->total_amount; - } - - /** - * The function returns the component(Event/Contribute..), given the google-order-no and merchant-private-data - * - * @param array $privateData - * Contains the name value pair of . - * @param int $orderNo - * send by google. - * @param string $root - * Root of xml-response. - * - * @param $response - * @param $serial - * @internal param \xml $xml_response response send by google in xml format - * @return array - * context of this call (test, module, payment processor id) - */ - public function getContext($privateData, $orderNo, $root, $response, $serial) { - $contributionID = CRM_Utils_Array::value('contributionID', $privateData); - $contribution = new CRM_Contribute_DAO_Contribution(); - if ($root == 'new-order-notification') { - $contribution->id = $contributionID; - } - else { - $contribution->invoice_id = $orderNo; - } - if (!$contribution->find(TRUE)) { - CRM_Core_Error::debug_log_message("getContext: Could not find contribution record with invoice id: $orderNo"); - $response->SendAck($serial); - } - - $module = 'Contribute'; - if (stristr($contribution->source, ts('Online Contribution'))) { - $module = 'Contribute'; - } - elseif (stristr($contribution->source, ts('Online Event Registration'))) { - $module = 'Event'; - } - $isTest = $contribution->is_test; - - $ids = $input = $objects = array(); - $objects['contribution'] = &$contribution; - $ids['contributionRecur'] = self::retrieve('contributionRecurID', 'Integer', $privateData, FALSE); - $input['component'] = strtolower($module); - - if (!$ids['contributionRecur'] && $contribution->contribution_status_id == 1) { - CRM_Core_Error::debug_log_message("Contribution already handled (ContributionID = {$contribution->id})."); - // There is no point in going further. Return ack so we don't receive the same ipn. - $response->SendAck($serial); - } - - if ($input['component'] == 'event') { - if ($root == 'new-order-notification') { - $ids['event'] = $privateData['eventID']; - } - else { - list($ids['event'], $ids['participant']) = explode(CRM_Core_DAO::VALUE_SEPARATOR, $contribution->trxn_id); - } - } - - $paymentProcessorID = CRM_Core_DAO::getFieldValue( - 'CRM_Financial_DAO_PaymentProcessor', - 'Google_Checkout', - 'id', - 'payment_processor_type' - ); - - $this->loadObjects($input, $ids, $objects, FALSE, $paymentProcessorID); - - if (!$ids['paymentProcessor']) { - CRM_Core_Error::debug_log_message("Payment processor could not be retrieved."); - // There is no point in going further. Return ack so we don't receive the same ipn. - $response->SendAck($serial); - } - - return array($isTest, $input['component'], $ids['paymentProcessor']); - } - - /** - * This method is handles the response that will be invoked (from extern/googleNotify) every time - * a notification or request is sent by the Google Server. - * - * @param string $xml_response - */ - public static function main($xml_response) { - require_once 'Google/library/googleresponse.php'; - require_once 'Google/library/googlerequest.php'; - require_once 'Google/library/googlemerchantcalculations.php'; - require_once 'Google/library/googleresult.php'; - require_once 'Google/library/xml-processing/gc_xmlparser.php'; - - $config = CRM_Core_Config::singleton(); - - // Retrieve the XML sent in the HTTP POST request to the ResponseHandler - if (get_magic_quotes_gpc()) { - $xml_response = stripslashes($xml_response); - } - - $headers = CRM_Utils_System::getAllHeaders(); - - if (GOOGLE_DEBUG_PP) { - CRM_Core_Error::debug_var('RESPONSE', $xml_response, TRUE, TRUE, 'Google'); - } - - // Retrieve the root and data from the xml response - $response = new GoogleResponse(); - list($root, $data) = $response->GetParsedXML($xml_response); - // lets retrieve the private-data & order-no - $privateData = NULL; - if (array_key_exists('shopping-cart', $data[$root])) { - $privateData = $data[$root]['shopping-cart']['merchant-private-data']['VALUE']; - } - if (empty($privateData) && array_key_exists('order-summary', $data[$root]) - && array_key_exists('shopping-cart', $data[$root]['order-summary']) - ) { - $privateData = $data[$root]['order-summary']['shopping-cart']['merchant-private-data']['VALUE']; - } - $privateData = $privateData ? self::stringToArray($privateData) : ''; - $orderNo = $data[$root]['google-order-number']['VALUE']; - $serial = $data[$root]['serial-number']; - - // a dummy object to call get context and a parent function inside it. - $ipn = new CRM_Core_Payment_GoogleIPN('live', $dummyProcessor); - list($mode, $module, $paymentProcessorID) = $ipn->getContext($privateData, $orderNo, $root, $response, $serial); - $mode = $mode ? 'test' : 'live'; - - $paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($paymentProcessorID, $mode); - $merchant_id = $paymentProcessor['user_name']; - $merchant_key = $paymentProcessor['password']; - $response->SetMerchantAuthentication($merchant_id, $merchant_key); - - $server_type = ($mode == 'test') ? 'sandbox' : 'production'; - $request = new GoogleRequest($merchant_id, $merchant_key, $server_type); - - $ipn = self::singleton($mode, $module, $paymentProcessor); - - if (GOOGLE_DEBUG_PP) { - CRM_Core_Error::debug_var('RESPONSE-ROOT', $response->root, TRUE, TRUE, 'Google'); - } - - //Check status and take appropriate action - $status = $response->HttpAuthentication($headers); - - switch ($root) { - case "request-received": - case "error": - case "diagnosis": - case "checkout-redirect": - case "merchant-calculation-callback": - break; - - case "new-order-notification": - $response->SendAck($serial, FALSE); - $ipn->newOrderNotify($data[$root], $privateData, $module); - break; - - case "order-state-change-notification": - $response->SendAck($serial, FALSE); - $new_financial_state = $data[$root]['new-financial-order-state']['VALUE']; - $new_fulfillment_order = $data[$root]['new-fulfillment-order-state']['VALUE']; - - switch ($new_financial_state) { - case 'CHARGEABLE': - break; - - case 'CHARGED': - case 'PAYMENT_DECLINED': - case 'CANCELLED': - case 'CANCELLED_BY_GOOGLE': - $ipn->orderStateChange($new_financial_state, $data[$root], $privateData, $module); - break; - - case 'REVIEWING': - case 'CHARGING': - break; - - default: - break; - } - break; - - case "authorization-amount-notification": - $response->SendAck($serial, FALSE); - $new_financial_state = $data[$root]['order-summary']['financial-order-state']['VALUE']; - $new_fulfillment_order = $data[$root]['order-summary']['fulfillment-order-state']['VALUE']; - - switch ($new_financial_state) { - case 'CHARGEABLE': - // For google-handled subscriptions chargeorder needn't be initiated, - // assuming auto-charging is turned on. - //$request->SendProcessOrder($data[$root]['google-order-number']['VALUE']); - //$request->SendChargeOrder($data[$root]['google-order-number']['VALUE'],''); - break; - - case 'CHARGED': - case 'PAYMENT_DECLINED': - case 'CANCELLED': - break; - - case 'REVIEWING': - case 'CHARGING': - case 'CANCELLED_BY_GOOGLE': - break; - - default: - break; - } - break; - - case "charge-amount-notification": - case "chargeback-amount-notification": - case "refund-amount-notification": - case "risk-information-notification": - $response->SendAck($serial); - break; - - default: - break; - } - } - - /** - * @param $input - * @param $ids - * @param $dataRoot - * - * @return bool - */ - public function getInput(&$input, &$ids, $dataRoot) { - if (!$this->getBillingID($ids)) { - return FALSE; - } - - $billingID = $ids['billing']; - $lookup = array( - "first_name" => 'contact-name', - // "last-name" not available with google (every thing in contact-name) - "last_name" => 'last_name', - "street_address-{$billingID}" => 'address1', - "city-{$billingID}" => 'city', - "state-{$billingID}" => 'region', - "postal_code-{$billingID}" => 'postal-code', - "country-{$billingID}" => 'country-code', - ); - - foreach ($lookup as $name => $googleName) { - if (array_key_exists($googleName, $dataRoot['buyer-billing-address'])) { - $value = $dataRoot['buyer-billing-address'][$googleName]['VALUE']; - } - $input[$name] = $value ? $value : NULL; - } - return TRUE; - } - - /** - * Converts the comma separated name-value pairs in - * to an array of name-value pairs. - * - * @param string $str - * - * @return array - */ - public static function stringToArray($str) { - $vars = $labels = array(); - $labels = explode(',', $str); - foreach ($labels as $label) { - $terms = explode('=', $label); - $vars[$terms[0]] = $terms[1]; - } - return $vars; - } - -} diff --git a/CRM/Event/Form/Registration/Confirm.php b/CRM/Event/Form/Registration/Confirm.php index 7cea482f67..bc835801d0 100644 --- a/CRM/Event/Form/Registration/Confirm.php +++ b/CRM/Event/Form/Registration/Confirm.php @@ -304,44 +304,20 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { //consider total amount. $this->assign('isAmountzero', ($this->_totalAmount <= 0) ? TRUE : FALSE); - // @todo this needs to GO! We are getting rid of references to processor types in the code base in favour of - // over-ride-able functions on them. - // The processor effectively has a 'buildForm' hook it can use if it needs to. - // The tricky thing is that we have no way of testing this code out - perhaps it hasn't worked for years! - if ($this->_paymentProcessor['payment_processor_type'] == 'Google_Checkout' && empty($this->_params[0]['is_pay_later']) && !($this->_params[0]['amount'] == 0) && - !$this->_allowWaitlist && !$this->_requireApproval - ) { - $this->_checkoutButtonName = $this->getButtonName('next', 'checkout'); - $this->add('image', - $this->_checkoutButtonName, - $this->_paymentProcessor['url_button'], - array('class' => 'crm-form-submit') - ); - - $this->addButtons(array( - array( - 'type' => 'back', - 'name' => ts('Go Back'), - ), - ) - ); - } - else { - $contribButton = ts('Continue'); - $this->addButtons(array( - array( - 'type' => 'back', - 'name' => ts('Go Back'), - ), - array( - 'type' => 'next', - 'name' => $contribButton, - 'isDefault' => TRUE, - 'js' => array('onclick' => "return submitOnce(this,'" . $this->_name . "','" . ts('Processing') . "');"), - ), - ) - ); - } + $contribButton = ts('Continue'); + $this->addButtons(array( + array( + 'type' => 'back', + 'name' => ts('Go Back'), + ), + array( + 'type' => 'next', + 'name' => $contribButton, + 'isDefault' => TRUE, + 'js' => array('onclick' => "return submitOnce(this,'" . $this->_name . "','" . ts('Processing') . "');"), + ), + ) + ); $defaults = array(); $fields = array(); diff --git a/bin/ContributionProcessor.php b/bin/ContributionProcessor.php index ae976e7e9a..b90655b705 100644 --- a/bin/ContributionProcessor.php +++ b/bin/ContributionProcessor.php @@ -72,40 +72,6 @@ class CiviContributeProcessor { ), ); - static $_googleParamsMapper = array( - //category => array(google_param => civicrm_field); - 'contact' => array( - 'first-name' => 'first_name', - 'last-name' => 'last_name', - 'contact-name' => 'display_name', - 'email' => 'email', - ), - 'location' => array( - 'address1' => 'street_address', - 'address2' => 'supplemental_address_1', - 'city' => 'city', - 'postal-code' => 'postal_code', - 'country-code' => 'country', - ), - 'transaction' => array( - 'total-charge-amount' => 'total_amount', - 'google-order-number' => 'trxn_id', - 'currency' => 'currency', - 'item-name' => 'source', - 'item-description' => 'note', - 'timestamp' => 'receive_date', - 'latest-charge-fee' => 'fee_amount', - 'net-amount' => 'net_amount', - 'times' => 'installments', - 'period' => 'frequency_unit', - 'frequency_interval' => 'frequency_interval', - 'start_date' => 'start_date', - 'modified_date' => 'modified_date', - 'trxn_type' => 'trxn_type', - 'amount' => 'amount', - ), - ); - static $_csvParamsMapper = array( // Note: if csv header is not present in the mapper, header itself // is considered as a civicrm field. @@ -239,82 +205,6 @@ class CiviContributeProcessor { } while ($result['l_errorcode0'] == '11002'); } - /** - * @param $paymentProcessor - * @param $paymentMode - * @param $start - * @param $end - */ - public static function google($paymentProcessor, $paymentMode, $start, $end) { - require_once "CRM/Contribute/BAO/Contribution/Utils.php"; - require_once 'CRM/Core/Payment/Google.php'; - $nextPageToken = TRUE; - $searchParams = array( - 'start' => $start, - 'end' => $end, - 'notification-types' => array('charge-amount'), - ); - - $response = CRM_Core_Payment_Google::invokeAPI($paymentProcessor, $searchParams); - - while ($nextPageToken) { - if ($response[0] == 'error') { - CRM_Core_Error::debug_log_message("GOOGLE ERROR: " . - $response[1]['error']['error-message']['VALUE'], TRUE - ); - } - $nextPageToken = isset($response[1][$response[0]]['next-page-token']['VALUE']) ? $response[1][$response[0]]['next-page-token']['VALUE'] : FALSE; - - if (is_array($response[1][$response[0]]['notifications']['charge-amount-notification'])) { - - if (array_key_exists('google-order-number', - $response[1][$response[0]]['notifications']['charge-amount-notification'] - )) { - // sometimes 'charge-amount-notification' itself is an absolute - // array and not array of arrays. This is the case when there is only one - // charge-amount-notification. Hack for this special case - - $chrgAmt = $response[1][$response[0]]['notifications']['charge-amount-notification']; - unset($response[1][$response[0]]['notifications']['charge-amount-notification']); - $response[1][$response[0]]['notifications']['charge-amount-notification'][] = $chrgAmt; - } - - foreach ($response[1][$response[0]]['notifications']['charge-amount-notification'] as $amtData) { - $searchParams = array( - 'order-numbers' => array($amtData['google-order-number']['VALUE']), - 'notification-types' => array('risk-information', 'new-order', 'charge-amount'), - ); - $response = CRM_Core_Payment_Google::invokeAPI($paymentProcessor, - $searchParams - ); - // append amount information as well - $response[] = $amtData; - - $params = self::formatAPIParams($response, - self::$_googleParamsMapper, - 'google' - ); - if ($paymentMode == 'test') { - $params['transaction']['is_test'] = 1; - } - else { - $params['transaction']['is_test'] = 0; - } - if (self::processAPIContribution($params)) { - CRM_Core_Error::debug_log_message("Processed - {$params['email']}, {$amtData['total-charge-amount']['VALUE']}, {$amtData['google-order-number']['VALUE']} ..

", TRUE); - } - else { - CRM_Core_Error::debug_log_message("Skipped - {$params['email']}, {$amtData['total-charge-amount']['VALUE']}, {$amtData['google-order-number']['VALUE']} ..

", TRUE); - } - } - - if ($nextPageToken) { - $searchParams = array('next-page-token' => $nextPageToken); - $response = CRM_Core_Payment_Google::invokeAPI($paymentProcessor, $searchParams); - } - } - } - } - public static function csv() { $csvFile = '/home/deepak/Desktop/crm-4247.csv'; $delimiter = ";"; @@ -365,7 +255,6 @@ class CiviContributeProcessor { switch ($type) { case 'paypal': - case 'google': $start = CRM_Utils_Request::retrieve('start', 'String', CRM_Core_DAO::$_nullObject, FALSE, 31, 'REQUEST' ); @@ -410,7 +299,6 @@ class CiviContributeProcessor { if (!in_array($type, array( 'paypal', - 'google', 'csv', )) ) { @@ -508,98 +396,6 @@ class CiviContributeProcessor { return $params; } - if ($type == 'google') { - // return if response smell invalid - if (!array_key_exists('risk-information-notification', $apiParams[1][$apiParams[0]]['notifications'])) { - return FALSE; - } - $riskInfo = &$apiParams[1][$apiParams[0]]['notifications']['risk-information-notification']; - - if (array_key_exists('new-order-notification', $apiParams[1][$apiParams[0]]['notifications'])) { - $newOrder = &$apiParams[1][$apiParams[0]]['notifications']['new-order-notification']; - } - - if ($riskInfo['google-order-number']['VALUE'] == $apiParams[2]['google-order-number']['VALUE']) { - foreach ($riskInfo['risk-information']['billing-address'] as $field => $info) { - if (!empty($mapper['location'][$field])) { - $params['address'][1][$mapper['location'][$field]] = $info['VALUE']; - } - elseif (!empty($mapper['contact'][$field])) { - if ($newOrder && !empty($newOrder['buyer-billing-address']['structured-name'])) { - foreach ($newOrder['buyer-billing-address']['structured-name'] as $namePart => $nameValue) { - $params[$mapper['contact'][$namePart]] = $nameValue['VALUE']; - } - } - else { - $params[$mapper['contact'][$field]] = $info['VALUE']; - } - } - elseif (!empty($mapper['transaction'][$field])) { - $transaction[$mapper['transaction'][$field]] = $info['VALUE']; - } - } - - // Response is an huge array. Lets pickup only those which we ineterested in - // using a local mapper, rather than traversing the entire array. - $localMapper = array( - 'google-order-number' => $riskInfo['google-order-number']['VALUE'], - 'total-charge-amount' => $apiParams[2]['total-charge-amount']['VALUE'], - 'currency' => $apiParams[2]['total-charge-amount']['currency'], - 'item-name' => $newOrder['shopping-cart']['items']['item']['item-name']['VALUE'], - 'timestamp' => $apiParams[2]['timestamp']['VALUE'], - ); - if (array_key_exists('latest-charge-fee', $apiParams[2])) { - $localMapper['latest-charge-fee'] = $apiParams[2]['latest-charge-fee']['total']['VALUE']; - $localMapper['net-amount'] = $localMapper['total-charge-amount'] - $localMapper['latest-charge-fee']; - } - - // This is a subscription (recurring) donation. - if (array_key_exists('subscription', $newOrder['shopping-cart']['items']['item'])) { - $subscription = $newOrder['shopping-cart']['items']['item']['subscription']; - $localMapper['amount'] = $newOrder['order-total']['VALUE']; - $localMapper['times'] = $subscription['payments']['subscription-payment']['times']; - // Convert Google's period to one compatible with the CiviCRM db field. - $freqUnits = array( - 'DAILY' => 'day', - 'WEEKLY' => 'week', - 'MONHTLY' => 'month', - 'YEARLY' => 'year', - ); - $localMapper['period'] = $freqUnits[$subscription['period']]; - // Unlike PayPal, Google has no concept of freq. interval, it is always 1. - $localMapper['frequency_interval'] = '1'; - // Google Checkout dates are in ISO-8601 format. We need a format that - // MySQL likes - $unix_timestamp = strtotime($localMapper['timestamp']); - $mysql_date = date('YmdHis', $unix_timestamp); - $localMapper['modified_date'] = $mysql_date; - $localMapper['start_date'] = $mysql_date; - // This is PayPal's nomenclature, but just use it for Google as well since - // we act on the value of trxn_type in processAPIContribution(). - $localMapper['trxn_type'] = 'subscrpayment'; - } - - foreach ($localMapper as $localKey => $localVal) { - if (!empty($mapper['transaction'][$localKey])) { - $transaction[$mapper['transaction'][$localKey]] = $localVal; - } - } - - if (empty($params) && empty($transaction)) { - continue; - } - - if (!empty($transaction) && $category) { - $params['transaction'] = $transaction; - } - else { - $params += $transaction; - } - - CRM_Contribute_BAO_Contribution_Utils::_fillCommonParams($params, $type); - } - return $params; - } } /** diff --git a/extern/googleNotify.php b/extern/googleNotify.php deleted file mode 100644 index 7f14ff0bb6..0000000000 --- a/extern/googleNotify.php +++ /dev/null @@ -1,46 +0,0 @@ -alert('payment_notification processor_name=Google_Checkout', $_REQUEST); - -$rawPostData = file_get_contents('php://input'); -CRM_Core_Payment_GoogleIPN::main($rawPostData); diff --git a/templates/CRM/Admin/Page/PaymentProcessor.hlp b/templates/CRM/Admin/Page/PaymentProcessor.hlp index 570c65d40d..43457607c9 100644 --- a/templates/CRM/Admin/Page/PaymentProcessor.hlp +++ b/templates/CRM/Admin/Page/PaymentProcessor.hlp @@ -186,113 +186,6 @@

{ts}The Recurring Payments URL is not currently used.{/ts}

{/htxt} -{htxt id='Google_Checkout-live-user-name'} -

{ts}Enter the Merchant ID from your Live account.{/ts}

-

{ts}How do I Find my Merchant-ID?{/ts}

-

{ts}After signing in to your account, click on the Settings tab. Then click on the Integration link on the left side of the page. Your 10- or 15-digit Merchant ID and your Merchant Key will both be listed under the Account information header.{/ts}

-{/htxt} -{htxt id='Google_Checkout-live-password'} -

{ts}Enter the Merchant Key from your Live account.{/ts}

-

{ts}How do I Find my Merchant Key?{/ts}

-

{ts}After signing in to your account, click on the Settings tab. Then click on the Integration link on the left side of the page. Your 10- or 15-digit Merchant ID and your Merchant Key will both be listed under the Account information header.{/ts}

-{/htxt} -{htxt id='Google_Checkout-test-user-name'} -

{ts}Enter the Merchant ID from your Sandbox account.{/ts}

-

{ts}How do I Find my Merchant-ID?{/ts}

-

{ts}After signing in to your account, click on the Settings tab. Then click on the Integration link on the left side of the page. Your 10- or 15-digit Merchant ID and your Merchant Key will both be listed under the Account information header.{/ts}

-{/htxt} -{htxt id='Google_Checkout-test-password'} -

{ts}Enter the Merchant Key from your Sandbox account.{/ts}

-

{ts}How do I Find my Merchant Key?{/ts}

-

{ts}After signing in to your account, click on the Settings tab. Then click on the Integration link on the left side of the page. Your 10- or 15-digit Merchant ID and your Merchant Key will both be listed under the Account information header.{/ts}

-{/htxt} -{htxt id='Google_Checkout-test-url-site'} -{ts}The URL for Google Checkout's TEST Payment server. Use the default value unless otherwise indicated by Google.{/ts} -{/htxt} -{htxt id='Google_Checkout-live-url-site'} -{ts}The URL for Google Checkout's LIVE Payment server. Use the default value unless otherwise indicated by Google.{/ts} -{/htxt} -{htxt id='Google_Checkout-test-url-button'} -

{ts 1=http://sandbox.google.com/checkout/buttons/checkout.gif}The base URL for the TEST - Image is: %1{/ts}

-

{ts}To display an image, you must add several parameters to this URL as name=value pairs.{/ts}

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{ts}Parameters{/ts}{ts}Values{/ts}{ts}Description{/ts}
w180/168/160 ({ts}large/medium/small{/ts}){ts}width of the button in pixels{/ts}
h46/44/43 ({ts}large/medium/small{/ts}){ts}height of the button in pixels{/ts}
stylewhite/trans..{ts}background color for the button{/ts}
varianttext/disabled{ts}whether the button is clickable or disabled{/ts}
locen_US{ts}a locale associated with the transaction (optional){/ts}
merchant_id{ts 1=1234567890}(e.g %1){/ts}{ts}Merchant ID{/ts}
- -

{ts}Example of a large Google Checkout button on a white background (For TEST Account):{/ts}

-

http://sandbox.google.com/checkout/buttons/checkout.gif?merchant_id=1234567890&w=180&h=46&style=white&variant=text&loc=en_US

-{/htxt} - -{htxt id='Google_Checkout-live-url-button'} -

{ts 1=http://checkout.google.com/buttons/checkout.gif}The base URL for the LIVE - Image is: %1{/ts}

-

{ts}To display an image, you must add several parameters to this URL as name=value pairs.{/ts}

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{ts}Parameters{/ts}{ts}Values{/ts}{ts}Description{/ts}
w180/168/160 ({ts}large/medium/small{/ts}){ts}width of the button in pixels{/ts}
h46/44/43 ({ts}large/medium/small{/ts}){ts}height of the button in pixels{/ts}
stylewhite/trans..{ts}background color for the button{/ts}
varianttext/disabled{ts}whether the button is clickable or disabled{/ts}
locen_US{ts}a locale associated with the transaction (optional){/ts}
merchant_id{ts 1=1234567890}(e.g %1){/ts}{ts}Merchant ID{/ts}
-

{ts}Example of a large Google Checkout button on a white background (For LIVE Account):{/ts}

-

http://checkout.google.com/buttons/checkout.gif?merchant_id=1234567890&w=180&h=46&style=white&variant=text&loc=en_US

-{/htxt} - {htxt id='Dummy-live-user-name'} {ts}Set up a 'Dummy' Processor if you want to test Online Contribution pages or Event Registration pages prior to selecting and configuring a real payment processor. You can enter any values for User Name and Site URL.{/ts}

{/htxt} diff --git a/templates/CRM/Contribute/Form/Contribution/Confirm.tpl b/templates/CRM/Contribute/Form/Contribution/Confirm.tpl index 40690f41cd..308e37d465 100644 --- a/templates/CRM/Contribute/Form/Contribution/Confirm.tpl +++ b/templates/CRM/Contribute/Form/Contribution/Confirm.tpl @@ -33,11 +33,7 @@

{ts}Please verify the information below carefully. Click Go Back if you need to make changes.{/ts} {if $contributeMode EQ 'notify' and ! $is_pay_later} - {if $paymentProcessor.payment_processor_type EQ 'Google_Checkout'} - {ts}Click the Google Checkout button to checkout to Google, where you will select your payment method and complete the contribution.{/ts} - {else} - {ts 1=$paymentProcessor.name 2=$button}Click the %2 button to go to %1, where you will select your payment method and complete the contribution.{/ts} - {/if} + {ts 1=$paymentProcessor.name 2=$button}Click the %2 button to go to %1, where you will select your payment method and complete the contribution.{/ts} {elseif ! $is_monetary or $amount LE 0.0 or $is_pay_later} {ts 1=$button}To complete this transaction, click the %1 button below.{/ts} {else} @@ -279,19 +275,6 @@

{/if} - {if $paymentProcessor.payment_processor_type EQ 'Google_Checkout' and $is_monetary and ( $amount GT 0 OR $minimum_fee GT 0 ) and ! $is_pay_later} -
{ts}Checkout with Google{/ts} - - - - - - - -
{ts}Click the Google Checkout button to continue.{/ts}
{$form._qf_Confirm_next_checkout.html} {ts}Checkout securely. Pay without sharing your financial information.{/ts}
-
- {/if} -
{include file="CRM/common/formButtons.tpl" location="bottom"}
diff --git a/templates/CRM/Event/Form/Registration/Confirm.tpl b/templates/CRM/Event/Form/Registration/Confirm.tpl index 65acac50b3..e828b246a5 100644 --- a/templates/CRM/Event/Form/Registration/Confirm.tpl +++ b/templates/CRM/Event/Form/Registration/Confirm.tpl @@ -193,21 +193,6 @@ {/if} - {if $paymentProcessor.payment_processor_type EQ 'Google_Checkout' and $paidEvent and !$is_pay_later and ! $isAmountzero and !$isOnWaitlist and !$isRequireApproval} -
{ts}Checkout with Google{/ts} -
- - - - - - - -
{ts}Click the Google Checkout button to continue.{/ts}
{$form._qf_Confirm_next_checkout.html} {ts}Checkout securely. Pay without sharing your financial information.{/ts}
-
-
- {/if} -
{include file="CRM/common/formButtons.tpl" location="bottom"}
diff --git a/templates/CRM/Member/Form/MembershipBlock.hlp b/templates/CRM/Member/Form/MembershipBlock.hlp index a4250af723..57a2ca2bdc 100644 --- a/templates/CRM/Member/Form/MembershipBlock.hlp +++ b/templates/CRM/Member/Form/MembershipBlock.hlp @@ -31,7 +31,6 @@

{ts}With this configuration, the membership fee is automatically charged, and users have an option to make an additional contribution (two separate payment transactions will be generated).{/ts}

{ts}The contribution amount covering the membership fee will use the financial type configured with the selected membership type (see the membership types configuration tool to review those settings). Any additional contribution will use the financial type configured for this online contribution page.{/ts}

{ts}If this option is NOT checked and you include a Contribution Amount section, then a single transaction is processed for their contribution amount which must at least cover the selected membership fee.{/ts}

-

{ts}NOTE: This option is NOT available for PayPal Website Payments Standard and Google Checkout.{/ts}

{/htxt} {htxt id="id-display-fee-title"} diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index 05918b957b..2a30190389 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -858,13 +858,6 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { 'test_password' => '7ARxW575w736eF5p', ); } - elseif ($processorType == 'Google_Checkout') { - // FIXME: we 'll need to make a new separate account for testing - $processorSettings = array( - 'user_name' => '559999327053114', - 'password' => 'R2zv2g60-A7GXKJYl0nR0g', - ); - } elseif ($processorType == 'PayPal') { $processorSettings = array( 'test_user_name' => '559999327053114', diff --git a/tests/phpunit/WebTest/Contribute/VerifySSLContributionTest.php b/tests/phpunit/WebTest/Contribute/VerifySSLContributionTest.php index 7856134123..f4d9556673 100644 --- a/tests/phpunit/WebTest/Contribute/VerifySSLContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/VerifySSLContributionTest.php @@ -60,7 +60,6 @@ class WebTest_Contribute_VerifySSLContributionTest extends CiviSeleniumTestCase $contributionPageTitle = "Verify SSL ($hash)"; $this->names['PayPal'] = "PayPal Pro ($hash)"; $this->names['AuthNet'] = "AuthNet ($hash)"; - //$this->names['Google_Checkout'] = "Google Checkout ($hash)"; //$this->names['PayPal_Standard'] = "PayPal Standard ($hash)"; $processors = array(); diff --git a/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipGCTest.php b/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipGCTest.php index 15d48f9e99..4e9e477fa6 100644 --- a/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipGCTest.php +++ b/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipGCTest.php @@ -56,9 +56,6 @@ class WebTest_Member_OnlineAutoRenewMembershipGCTest extends CiviSeleniumTestCas $this->click("_qf_Confirm_next_checkout"); - // FIXME: By this time pending records has already been created. Formatting for external page (google checkout in this case) - - // has changed a bit. No point in adding test for external page as we 'll test with fake transactions. } public function testOnlineAutoRenewMembershipAuthenticated() { @@ -85,97 +82,6 @@ class WebTest_Member_OnlineAutoRenewMembershipGCTest extends CiviSeleniumTestCas $this->click("_qf_Confirm_next_checkout"); - // FIXME: By this time pending records has already been created. Formatting for external page (google checkout in this case) - - // has changed a bit. No point in adding test for external page as we 'll test with fake transactions. - } - - /** - * @return null - */ - public function _configureMembershipPage() { - static $pageId = NULL; - - if (!$pageId) { - $this->webtestLogin(); - - //add payment processor. - $hash = substr(sha1(rand()), 0, 7); - $rand = 2 * rand(2, 50); - $processorName = "Webtest Auto Renew Google Checkout" . $hash; - $this->webtestAddPaymentProcessor($processorName, 'Google_Checkout'); - - // -- start updating membership types - $this->openCiviPage('admin/member/membershipType/add', 'action=update&id=1&reset=1'); - - $this->waitForElementPresent("xpath=//div[@id='membership_type_form']//table/tbody/tr[6]/td/label[contains(text(), 'Auto-renew Option')]/../../td[2]/label[contains(text(), 'Give option, but not required')]"); - $this->click("xpath=//div[@id='membership_type_form']//table/tbody/tr[6]/td/label[contains(text(), 'Auto-renew Option')]/../../td[2]/label[contains(text(), 'Give option, but not required')]"); - - $this->type("duration_interval", "1"); - $this->select("duration_unit", "label=year"); - - $this->click("_qf_MembershipType_upload-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->openCiviPage('admin/member/membershipType/add', 'action=update&id=2&reset=1'); - - $this->waitForElementPresent("xpath=//div[@id='membership_type_form']//table/tbody/tr[6]/td/label[contains(text(), 'Auto-renew Option')]/../../td[2]/label[contains(text(), 'Give option, but not required')]"); - $this->click("xpath=//div[@id='membership_type_form']//table/tbody/tr[6]/td/label[contains(text(), 'Auto-renew Option')]/../../td[2]/label[contains(text(), 'Give option, but not required')]"); - - $this->type("duration_interval", "1"); - $this->select("duration_unit", "label=year"); - - $this->click("_qf_MembershipType_upload-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - // create contribution page with randomized title and default params - $amountSection = FALSE; - $payLater = TRUE; - $onBehalf = FALSE; - $pledges = FALSE; - $recurring = TRUE; - $membershipTypes = array( - array('id' => 1, 'auto_renew' => 1), - array('id' => 2, 'auto_renew' => 1), - ); - $memPriceSetId = NULL; - $friend = TRUE; - $profilePreId = NULL; - $profilePostId = NULL; - $premiums = TRUE; - $widget = TRUE; - $pcp = TRUE; - - $contributionTitle = "Title $hash"; - $pageId = $this->webtestAddContributionPage($hash, - $rand, - $contributionTitle, - array($processorName => 'Google_Checkout'), - $amountSection, - $payLater, - $onBehalf, - $pledges, - $recurring, - $membershipTypes, - $memPriceSetId, - $friend, - $profilePreId, - $profilePostId, - $premiums, - $widget, - $pcp, - FALSE - ); - - //make sure we do have required permissions. - $permissions = array("edit-1-make-online-contributions", "edit-1-profile-listings-and-forms"); - $this->changePermissions($permissions); - - // now logout and do membership test that way - $this->webtestLogout(); - } - - return $pageId; } } diff --git a/xml/templates/civicrm_data.tpl b/xml/templates/civicrm_data.tpl index 1177767786..3e287673b0 100644 --- a/xml/templates/civicrm_data.tpl +++ b/xml/templates/civicrm_data.tpl @@ -1121,7 +1121,6 @@ VALUES ('PayPal_Standard', '{ts escape="sql"}PayPal - Website Payments Standard{/ts}', NULL,1,0,'{ts escape="sql"}Merchant Account Email{/ts}',NULL,NULL,NULL,'Payment_PayPalImpl','https://www.paypal.com/',NULL,'https://www.paypal.com/',NULL,'https://www.sandbox.paypal.com/',NULL,'https://www.sandbox.paypal.com/',NULL,4,1), ('PayPal', '{ts escape="sql"}PayPal - Website Payments Pro{/ts}', NULL,1,0,'{ts escape="sql"}User Name{/ts}','{ts escape="sql"}Password{/ts}','{ts escape="sql"}Signature{/ts}',NULL,'Payment_PayPalImpl','https://www.paypal.com/','https://api-3t.paypal.com/','https://www.paypal.com/','https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif','https://www.sandbox.paypal.com/','https://api-3t.sandbox.paypal.com/','https://www.sandbox.paypal.com/','https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif',3, 1 ), ('PayPal_Express', '{ts escape="sql"}PayPal - Express{/ts}', NULL,1,0,'{ts escape="sql"}User Name{/ts}','{ts escape="sql"}Password{/ts}','{ts escape="sql"}Signature{/ts}',NULL,'Payment_PayPalImpl','https://www.paypal.com/','https://api-3t.paypal.com/',NULL,'https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif','https://www.sandbox.paypal.com/','https://api-3t.sandbox.paypal.com/',NULL,'https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif',2, 1), - ('Google_Checkout', '{ts escape="sql"}Google Checkout{/ts}', NULL,1,0,'{ts escape="sql"}Merchant ID{/ts}','{ts escape="sql"}Key{/ts}',NULL,NULL,'Payment_Google','https://checkout.google.com/',NULL,'https://checkout.google.com/','https://checkout.google.com/buttons/checkout.gif?merchant_id=YOURMERCHANTIDHERE&w=160&h=43&style=white&variant=text&loc=en_US','https://sandbox.google.com/checkout/',NULL,'https://sandbox.google.com/checkout/','https://sandbox.google.com/checkout/buttons/checkout.gif?merchant_id=YOURMERCHANTIDHERE&w=160&h=43&style=white&variant=text&loc=en_US',4,1), ('AuthNet', '{ts escape="sql"}Authorize.Net{/ts}', NULL,1,0,'{ts escape="sql"}API Login{/ts}','{ts escape="sql"}Payment Key{/ts}','{ts escape="sql"}MD5 Hash{/ts}',NULL,'Payment_AuthorizeNet','https://secure2.authorize.net/gateway/transact.dll',NULL,'https://api2.authorize.net/xml/v1/request.api',NULL,'https://test.authorize.net/gateway/transact.dll',NULL,'https://apitest.authorize.net/xml/v1/request.api',NULL,1,1), ('PayJunction', '{ts escape="sql"}PayJunction{/ts}', NULL,1,0,'User Name','Password',NULL,NULL,'Payment_PayJunction','https://payjunction.com/quick_link',NULL,NULL,NULL,'https://www.payjunctionlabs.com/quick_link',NULL,NULL,NULL,1,1), ('eWAY', '{ts escape="sql"}eWAY (Single Currency){/ts}', NULL,1,0,'Customer ID',NULL,NULL,NULL,'Payment_eWAY','https://www.eway.com.au/gateway_cvn/xmlpayment.asp',NULL,NULL,NULL,'https://www.eway.com.au/gateway_cvn/xmltest/testpage.asp',NULL,NULL,NULL,1,0), -- 2.25.1