artfulrobot / uk.artfulrobot.civicrm.gocardless

A CiviCRM extension providing GoCardless integration to handle UK Direct Debits.
GNU Affero General Public License v3.0
5 stars 18 forks source link

supplemental_address_1 and supplemental_address_2 fields not copied to GoCardless #84

Closed TomCrawshaw closed 3 years ago

TomCrawshaw commented 4 years ago

Most of our addresses use data in supplemental_address_1 and supplemental_address_2 fields (e.g. a road name, village etc), and this should be copied across to GoCardless so the complete address is held there (although not necessary for the DD to go through). Could a patch be applied to do this in CRM/Core/Payment/GoCardless.php:

Line 353: elseif (preg_match('/^(street_address|supplemental_address_1|supplemental_address_2|city|postal_code|country|state_province)-(\d|\w+)+$/', $civi_prop, $matches)) {

Line 396 et seq: if (isset($_['supplemental_address_1'])) { $customer['addressline1'] .= ", " . $['supplemental_address1']; } if (isset($['supplemental_address_2'])) { $customer['addressline2'] = $['supplemental_address_2']; }

Thanks.

artfulrobot commented 4 years ago

Sounds good. Probably want to put in some checks so we don't end up with , Oxford as a value. Are you able to do a PR?

I take it you've checked that address_line2 is a thing?

TomCrawshaw commented 4 years ago

Thanks. I'll recast the code so that it shouldn't end up with a hanging comma, and "address_line2" does exist in GoCardless, so seems ok, but I'll do some more checking before trying a PR (if I can work out how to do that!)

TomCrawshaw commented 4 years ago

@artfulrobot Testing seems to show that the addition works in all reasonable cases, so I've created what I think is a valid PR for this, but since it's my first one may not have completed all the steps. Do you have to merge into master?

artfulrobot commented 3 years ago

Fixed by your pr, thanks