Details
Description
The current default for imported cc details are problematic. For example, the default for "first_name" is null, but that is an invalid value.
In import_manager/components/migrators/whmcs/8.0/whmcs8_0.php change the code starting at line 600 from
// Save card $card = [ 'contact_id' => $this->mappings['primary_contacts'][$credit_card->client_id], 'first_name' => $credit_card->{$mapping['accounts_cc']['first_name']} ?: null, 'last_name' => $credit_card->{$mapping['accounts_cc']['last_name']} ?: null, 'address1' => $credit_card->{$mapping['accounts_cc']['address1']} ?: null, 'address2' => $credit_card->{$mapping['accounts_cc']['address2']} ?: null, 'state' => !empty($credit_card->{$mapping['accounts_cc']['state']}) ? substr($credit_card->{$mapping['accounts_cc']['state']}, 0, 2) : 'XX', 'city' => $credit_card->{$mapping['accounts_cc']['city']} ?: null, 'zip' => $credit_card->{$mapping['accounts_cc']['zip']} ?: '00000', 'country' => $credit_card->{$mapping['accounts_cc']['country']} ?: null, 'number' => isset($credit_card->{$mapping['accounts_cc']['number']}) ? $this->GatewayManager->systemEncrypt( $credit_card->{$mapping['accounts_cc']['number']} ) : null, 'expiration' => isset($credit_card->{$mapping['accounts_cc']['expiration']}) ? $this->GatewayManager->systemEncrypt( date('Ym', strtotime($credit_card->{$mapping['accounts_cc']['expiration']})) ) : null, 'last4' => isset($credit_card->{$mapping['accounts_cc']['last4']}) ? $this->GatewayManager->systemEncrypt( $credit_card->{$mapping['accounts_cc']['last4']} ) : null, 'type' => isset($credit_card->{$mapping['accounts_cc']['type']}) ? $this->getCreditCardType($credit_card->{$mapping['accounts_cc']['type']}) : 'other', 'gateway_id' => $gateway_id, 'client_reference_id' => $credit_card->{$mapping['accounts_cc']['client_reference_id']} ?: null, 'reference_id' => $credit_card->{$mapping['accounts_cc']['reference_id']} ?: null, 'status' => 'active' ];
To
// Save card $card = [ 'contact_id' => $this->mappings['primary_contacts'][$credit_card->client_id], 'first_name' => $credit_card->{$mapping['accounts_cc']['first_name']} ?? $this->default_firstname, 'last_name' => $credit_card->{$mapping['accounts_cc']['last_name']} ?? $this->default_lastname, 'address1' => $credit_card->{$mapping['accounts_cc']['address1']} ?? '', 'address2' => $credit_card->{$mapping['accounts_cc']['address2']} ?? null, 'state' => !empty($credit_card->{$mapping['accounts_cc']['state']}) ? substr($credit_card->{$mapping['accounts_cc']['state']}, 0, 2) : 'XX', 'city' => $credit_card->{$mapping['accounts_cc']['city']} ?? '', 'zip' => $credit_card->{$mapping['accounts_cc']['zip']} ?? '00000', 'country' => $credit_card->{$mapping['accounts_cc']['country']} ?? $this->default_country, 'number' => isset($credit_card->{$mapping['accounts_cc']['number']}) ? $this->GatewayManager->systemEncrypt( $credit_card->{$mapping['accounts_cc']['number']} ) : null, 'expiration' => isset($credit_card->{$mapping['accounts_cc']['expiration']}) ? $this->GatewayManager->systemEncrypt( date('Ym', strtotime($credit_card->{$mapping['accounts_cc']['expiration']})) ) : null, 'last4' => isset($credit_card->{$mapping['accounts_cc']['last4']}) ? $this->GatewayManager->systemEncrypt( $credit_card->{$mapping['accounts_cc']['last4']} ) : null, 'type' => isset($credit_card->{$mapping['accounts_cc']['type']}) ? $this->getCreditCardType($credit_card->{$mapping['accounts_cc']['type']}) : 'other', 'gateway_id' => $gateway_id, 'client_reference_id' => $credit_card->{$mapping['accounts_cc']['client_reference_id']} ?? null, 'reference_id' => $credit_card->{$mapping['accounts_cc']['reference_id']} ?? null, 'status' => 'active' ];