Skip to content

Instantly share code, notes, and snippets.

@rickalday
Last active September 11, 2023 15:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rickalday/0c5334a126f9c5bb4bf941fb4fead561 to your computer and use it in GitHub Desktop.
Save rickalday/0c5334a126f9c5bb4bf941fb4fead561 to your computer and use it in GitHub Desktop.
Send a bunch of donation metadata to Salesforce
<?php
function addGiveSalesforceDonationArgs(
$args,
\GiveSalesforce\Salesforce\DataTransferObjects\SalesforceOpportunityData $data
) {
// Acknowledgement Status
$args['npsp__Acknowledgment_Status__c'] = "Acknowledged";
// Acknowledgement Date
$donationCompleteDate = give_get_meta($data->donationId, '_give_completed_date', true);
$datetime = new DateTime($donationCompleteDate);
$args['npsp__Acknowledgment_Date__c'] = $datetime->format(DateTime::ATOM);
// Payment Method
$paymentMethod = give_get_meta($data->donationId, '_give_payment_gateway', true);
$args['Payment_method'] = $paymentMethod;
// Tribute Type
$tributeType = give_get_meta($data->donationId, '_give_tributes_type', true);
$args['Tribute_type'] = $tributeType;
// Tribute Message
$tributeMessage = give_get_meta($data->donationId, '_give_tributes_mail_card_personalized_message', true);
$args['Tribute_message'] = $tributeMessage;
// Ecard message
$eCardMessage = give_get_meta($data->donationId, '_give_tributes_ecard_personalized_message', true);
$args['Ecard_message'] = $eCardMessage;
// Donation Message
$donationMessage = give_get_meta($data->donationId, '_give_donation_comment', true);
$args['Donation_message'] = $donationMessage;
// Contact billing address
$billingAddress = give_get_meta($data->donationId, '_give_donor_billing_address1', true);
$args['Billing_address'] = $billingAddress;
// Contact billing city
$billingCity = give_get_meta($data->donationId, '_give_donor_billing_city', true);
$args['Billing_city'] = $billingCity;
// Contact billing state
$billingState = give_get_meta($data->donationId, '_give_donor_billing_state', true);
$args['Billing_state'] = $billingState;
return $args;
}
add_filter('give_salesforce_donation_args', 'addGiveSalesforceDonationArgs');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment