-
- if ($this->_contributeMode == 'express') {
- // rfp == redirect from paypal
- $rfp = CRM_Utils_Request::retrieve('rfp', 'Boolean',
- CRM_Core_DAO::$_nullObject, FALSE, NULL, 'GET'
- );
- if ($rfp) {
- $payment = Civi\Payment\System::singleton()->getByProcessor($this->_paymentProcessor);
- $expressParams = $payment->getPreApprovalDetails($this->get('pre_approval_parameters'));
-
- $this->_params['payer'] = CRM_Utils_Array::value('payer', $expressParams);
- $this->_params['payer_id'] = $expressParams['payer_id'];
- $this->_params['payer_status'] = $expressParams['payer_status'];
-
- CRM_Core_Payment_Form::mapParams($this->_bltID, $expressParams, $this->_params, FALSE);
-
- // fix state and country id if present
- if (!empty($this->_params["billing_state_province_id-{$this->_bltID}"])) {
- $this->_params["billing_state_province-{$this->_bltID}"] = CRM_Core_PseudoConstant::stateProvinceAbbreviation($this->_params["billing_state_province_id-{$this->_bltID}"]);
- }
- if (!empty($this->_params["billing_country_id-{$this->_bltID}"]) && $this->_params["billing_country_id-{$this->_bltID}"]) {
- $this->_params["billing_country-{$this->_bltID}"] = CRM_Core_PseudoConstant::countryIsoCode($this->_params["billing_country_id-{$this->_bltID}"]);
- }
-
- // set a few other parameters for PayPal
- $this->_params['token'] = $this->get('token');
-
- $this->_params['amount'] = $this->get('amount');
-
- if (!empty($this->_membershipBlock)) {
- $this->_params['selectMembership'] = $this->get('selectMembership');
- }
- // we use this here to incorporate any changes made by folks in hooks
- $this->_params['currencyID'] = $config->defaultCurrency;
-
- // also merge all the other values from the profile fields
- $values = $this->controller->exportValues('Main');
- $skipFields = array(
- 'amount',
- 'amount_other',
- "billing_street_address-{$this->_bltID}",
- "billing_city-{$this->_bltID}",
- "billing_state_province_id-{$this->_bltID}",
- "billing_postal_code-{$this->_bltID}",
- "billing_country_id-{$this->_bltID}",
- );
- foreach ($values as $name => $value) {
- // skip amount field
- if (!in_array($name, $skipFields)) {
- $this->_params[$name] = $value;
- }
- }
- $this->set('getExpressCheckoutDetails', $this->_params);
- }
- else {
- $this->_params = $this->get('getExpressCheckoutDetails');
- }