本文整理汇总了PHP中CRM_Contribute_BAO_Contribution::getPaymentProcessorReadyAddressParams方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contribute_BAO_Contribution::getPaymentProcessorReadyAddressParams方法的具体用法?PHP CRM_Contribute_BAO_Contribution::getPaymentProcessorReadyAddressParams怎么用?PHP CRM_Contribute_BAO_Contribution::getPaymentProcessorReadyAddressParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contribute_BAO_Contribution
的用法示例。
在下文中一共展示了CRM_Contribute_BAO_Contribution::getPaymentProcessorReadyAddressParams方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formatParamsForPaymentProcessor
/**
* Format the fields for the payment processor.
*
* In order to pass fields to the payment processor in a consistent way we add some renamed
* parameters.
*
* @param array $fields
*
* @return array
*/
protected function formatParamsForPaymentProcessor($fields)
{
// also add location name to the array
$this->_params["address_name-{$this->_bltID}"] = CRM_Utils_Array::value('billing_first_name', $this->_params) . ' ' . CRM_Utils_Array::value('billing_middle_name', $this->_params) . ' ' . CRM_Utils_Array::value('billing_last_name', $this->_params);
$this->_params["address_name-{$this->_bltID}"] = trim($this->_params["address_name-{$this->_bltID}"]);
// Add additional parameters that the payment processors are used to receiving.
if (!empty($this->_params["billing_state_province_id-{$this->_bltID}"])) {
$this->_params['state_province'] = $this->_params["state_province-{$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['country'] = $this->_params["country-{$this->_bltID}"] = $this->_params["billing_country-{$this->_bltID}"] = CRM_Core_PseudoConstant::countryIsoCode($this->_params["billing_country_id-{$this->_bltID}"]);
}
list($hasAddressField, $addressParams) = CRM_Contribute_BAO_Contribution::getPaymentProcessorReadyAddressParams($this->_params, $this->_bltID);
if ($hasAddressField) {
$this->_params = array_merge($this->_params, $addressParams);
}
$nameFields = array('first_name', 'middle_name', 'last_name');
foreach ($nameFields as $name) {
$fields[$name] = 1;
if (array_key_exists("billing_{$name}", $this->_params)) {
$this->_params[$name] = $this->_params["billing_{$name}"];
$this->_params['preserveDBName'] = TRUE;
}
}
return $fields;
}
示例2: processBillingAddress
/**
* Add the billing address to the contact who paid.
*/
protected function processBillingAddress()
{
$fields = array();
// set email for primary location.
$fields['email-Primary'] = 1;
$this->_params['email-5'] = $this->_params['email-Primary'] = $this->_contributorEmail;
// also add location name to the array
$this->_params["address_name-{$this->_bltID}"] = CRM_Utils_Array::value('billing_first_name', $this->_params) . ' ' . CRM_Utils_Array::value('billing_middle_name', $this->_params) . ' ' . CRM_Utils_Array::value('billing_last_name', $this->_params);
$this->_params["address_name-{$this->_bltID}"] = trim($this->_params["address_name-{$this->_bltID}"]);
$fields["address_name-{$this->_bltID}"] = 1;
$fields["email-{$this->_bltID}"] = 1;
list($hasBillingField, $addressParams) = CRM_Contribute_BAO_Contribution::getPaymentProcessorReadyAddressParams($this->_params, $this->_bltID);
$addressParams['preserveDBName'] = TRUE;
if ($hasBillingField) {
$addressParams = array_merge($this->_params, $addressParams);
//here we are setting up the billing contact - if different from the member they are already created
// but they will get billing details assigned
CRM_Contact_BAO_Contact::createProfileContact($addressParams, $fields, $this->_contributorContactID, NULL, NULL, CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_contactID, 'contact_type'));
}
}
示例3: processBillingAddress
/**
* Add the billing address to the contact who paid.
*
* Note that this function works based on the presence or otherwise of billing fields & can be called regardless of
* whether they are 'expected' (due to assumptions about the payment processor type or the setting to collect billing
* for pay later.
*/
protected function processBillingAddress()
{
$fields = array();
$fields['email-Primary'] = 1;
$this->_params['email-5'] = $this->_params['email-Primary'] = $this->_contributorEmail;
// now set the values for the billing location.
foreach (array_keys($this->_fields) as $name) {
$fields[$name] = 1;
}
// also add location name to the array
$this->_params["address_name-{$this->_bltID}"] = CRM_Utils_Array::value('billing_first_name', $this->_params) . ' ' . CRM_Utils_Array::value('billing_middle_name', $this->_params) . ' ' . CRM_Utils_Array::value('billing_last_name', $this->_params);
$this->_params["address_name-{$this->_bltID}"] = trim($this->_params["address_name-{$this->_bltID}"]);
$fields["address_name-{$this->_bltID}"] = 1;
//ensure we don't over-write the payer's email with the member's email
if ($this->_contributorContactID == $this->_contactID) {
$fields["email-{$this->_bltID}"] = 1;
}
list($hasBillingField, $addressParams) = CRM_Contribute_BAO_Contribution::getPaymentProcessorReadyAddressParams($this->_params, $this->_bltID);
$nameFields = array('first_name', 'middle_name', 'last_name');
foreach ($nameFields as $name) {
$fields[$name] = 1;
if (array_key_exists("billing_{$name}", $this->_params)) {
$this->_params[$name] = $this->_params["billing_{$name}"];
$this->_params['preserveDBName'] = TRUE;
}
}
if ($hasBillingField) {
$addressParams = array_merge($this->_params, $addressParams);
//here we are setting up the billing contact - if different from the member they are already created
// but they will get billing details assigned
CRM_Contact_BAO_Contact::createProfileContact($addressParams, $fields, $this->_contributorContactID, NULL, NULL, CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_contactID, 'contact_type'));
}
// Add additional parameters that the payment processors are used to receiving.
if (!empty($this->_params["billing_state_province_id-{$this->_bltID}"])) {
$this->_params["state_province-{$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["country-{$this->_bltID}"] = $this->_params["billing_country-{$this->_bltID}"] = CRM_Core_PseudoConstant::countryIsoCode($this->_params["billing_country_id-{$this->_bltID}"]);
}
}
示例4: processBillingAddress
/**
* Add the billing address to the contact who paid.
*
* Note that this function works based on the presence or otherwise of billing fields & can be called regardless of
* whether they are 'expected' (due to assumptions about the payment processor type or the setting to collect billing
* for pay later.
*/
protected function processBillingAddress()
{
$fields = array();
$fields['email-Primary'] = 1;
$this->_params['email-5'] = $this->_params['email-Primary'] = $this->_contributorEmail;
// now set the values for the billing location.
foreach (array_keys($this->_fields) as $name) {
$fields[$name] = 1;
}
$fields["address_name-{$this->_bltID}"] = 1;
//ensure we don't over-write the payer's email with the member's email
if ($this->_contributorContactID == $this->_contactID) {
$fields["email-{$this->_bltID}"] = 1;
}
list($hasBillingField, $addressParams) = CRM_Contribute_BAO_Contribution::getPaymentProcessorReadyAddressParams($this->_params, $this->_bltID);
$fields = $this->formatParamsForPaymentProcessor($fields);
if ($hasBillingField) {
$addressParams = array_merge($this->_params, $addressParams);
// CRM-18277 don't let this get passed in because we don't want contribution source to override contact source.
// Ideally we wouldn't just randomly merge everything into addressParams but just pass in a relevant array.
// Note this source field is covered by a unit test.
if (isset($addressParams['source'])) {
unset($addressParams['source']);
}
//here we are setting up the billing contact - if different from the member they are already created
// but they will get billing details assigned
CRM_Contact_BAO_Contact::createProfileContact($addressParams, $fields, $this->_contributorContactID, NULL, NULL, CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_contactID, 'contact_type'));
}
}
示例5: processBillingAddress
/**
* Add the billing address to the contact who paid.
*
* Note that this function works based on the presence or otherwise of billing fields & can be called regardless of
* whether they are 'expected' (due to assumptions about the payment processor type or the setting to collect billing
* for pay later.
*/
protected function processBillingAddress()
{
$fields = array();
$fields['email-Primary'] = 1;
$this->_params['email-5'] = $this->_params['email-Primary'] = $this->_contributorEmail;
// now set the values for the billing location.
foreach (array_keys($this->_fields) as $name) {
$fields[$name] = 1;
}
$fields["address_name-{$this->_bltID}"] = 1;
//ensure we don't over-write the payer's email with the member's email
if ($this->_contributorContactID == $this->_contactID) {
$fields["email-{$this->_bltID}"] = 1;
}
list($hasBillingField, $addressParams) = CRM_Contribute_BAO_Contribution::getPaymentProcessorReadyAddressParams($this->_params, $this->_bltID);
$fields = $this->formatParamsForPaymentProcessor($fields);
if ($hasBillingField) {
$addressParams = array_merge($this->_params, $addressParams);
//here we are setting up the billing contact - if different from the member they are already created
// but they will get billing details assigned
CRM_Contact_BAO_Contact::createProfileContact($addressParams, $fields, $this->_contributorContactID, NULL, NULL, CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_contactID, 'contact_type'));
}
}