Loading src/Plugin/Commerce/PaymentGateway/SveaCheckout.php +11 −1 Original line number Diff line number Diff line Loading @@ -373,7 +373,6 @@ class SveaCheckout extends OffsitePaymentGatewayBase implements SveaCheckoutInte */ protected function populateProfile(ProfileInterface $profile, array $address) { $mapping = [ // For B2B customers "FullName" field contains the company name. 'FullName' => 'organization', 'FirstName' => 'given_name', 'LastName' => 'family_name', Loading @@ -383,6 +382,17 @@ class SveaCheckout extends OffsitePaymentGatewayBase implements SveaCheckoutInte 'StreetAddress' => 'address_line1', 'StreetAddress2' => 'address_line2', ]; // For B2B customers "FullName" field contains the company name, in other // cases it will just create duplicated data for first/last names in // billing/shipping profiles. Omit such cases. if ($address['FirstName'] || $address['LastName']) { $full_name = implode(' ', [$address['FirstName'], $address['LastName']]); if ($full_name == $address['FullName']) { unset($mapping['FullName']); } } foreach ($address as $key => $value) { if (isset($mapping[$key])) { $profile->address->{$mapping[$key]} = $value; Loading Loading
src/Plugin/Commerce/PaymentGateway/SveaCheckout.php +11 −1 Original line number Diff line number Diff line Loading @@ -373,7 +373,6 @@ class SveaCheckout extends OffsitePaymentGatewayBase implements SveaCheckoutInte */ protected function populateProfile(ProfileInterface $profile, array $address) { $mapping = [ // For B2B customers "FullName" field contains the company name. 'FullName' => 'organization', 'FirstName' => 'given_name', 'LastName' => 'family_name', Loading @@ -383,6 +382,17 @@ class SveaCheckout extends OffsitePaymentGatewayBase implements SveaCheckoutInte 'StreetAddress' => 'address_line1', 'StreetAddress2' => 'address_line2', ]; // For B2B customers "FullName" field contains the company name, in other // cases it will just create duplicated data for first/last names in // billing/shipping profiles. Omit such cases. if ($address['FirstName'] || $address['LastName']) { $full_name = implode(' ', [$address['FirstName'], $address['LastName']]); if ($full_name == $address['FullName']) { unset($mapping['FullName']); } } foreach ($address as $key => $value) { if (isset($mapping[$key])) { $profile->address->{$mapping[$key]} = $value; Loading