}
/**
- * @return null|string
- * @throws \Civi\Payment\Exception\PaymentProcessorException
+ * Get url for users to manage this recurring contribution for this processor.
+ *
+ * @param int $entityID
+ * @param null $entity
+ * @param string $action
+ *
+ * @return string|null
+ * @throws \CRM_Core_Exception
*/
- public function cancelSubscriptionURL() {
+ public function subscriptionURL($entityID = NULL, $entity = NULL, $action = 'cancel') {
if ($this->isPayPalType($this::PAYPAL_STANDARD)) {
+ if ($action !== 'cancel') {
+ return NULL;
+ }
return "{$this->_paymentProcessor['url_site']}cgi-bin/webscr?cmd=_subscr-find&alias=" . urlencode($this->_paymentProcessor['user_name']);
}
- else {
- return NULL;
- }
+ return parent::subscriptionURL($entityID, $entity, $action);
}
/**
$sub = empty($params['is_recur']) ? 'cgi-bin/webscr' : 'subscriptions';
$paypalURL = "{$url}{$sub}?$uri";
+ // Allow each CMS to do a pre-flight check before redirecting to PayPal.
+ CRM_Core_Config::singleton()->userSystem->prePostRedirect();
+
CRM_Utils_System::redirect($paypalURL);
}
// The contribution form passes a 'button' but the event form might still set one of these fields.
// @todo more standardisation & get paypal fully out of the form layer.
$possibleExpressFields = [
+ // @todo - we think these top 2 are likely not required & it's still here
+ // on a precautionary basis.
+ // see https://github.com/civicrm/civicrm-core/pull/18680
'_qf_Register_upload_express_x',
'_qf_Payment_upload_express_x',
+ '_qf_Register_upload_express',
+ '_qf_Payment_upload_express',
'_qf_Main_upload_express',
];
if (array_intersect_key($params, array_fill_keys($possibleExpressFields, 1))) {