Uploaded image for project: 'Blesta Core'
  1. Blesta Core
  2. CORE-4437

Import Manager: Payment account defaults are wrong

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.1.3, 5.2.0-b1
    • Component/s: None
    • Labels:
      None

      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'
                          ];
      

        Activity

        jonathan Jonathan Reissmueller created issue -
        jonathan Jonathan Reissmueller made changes -
        Field Original Value New Value
        Rank Ranked higher
        jonathan Jonathan Reissmueller made changes -
        Sprint 5.2.0 Sprint 3 [ 140 ]
        jonathan Jonathan Reissmueller made changes -
        Rank Ranked lower
        jonathan Jonathan Reissmueller made changes -
        Rank Ranked higher
        abdy Abdy Franco made changes -
        Assignee Abdy Franco [ abdy ]
        abdy Abdy Franco made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        abdy Abdy Franco made changes -
        Remaining Estimate 0 minutes [ 0 ]
        Time Spent 45 minutes [ 2700 ]
        Worklog Id 15207 [ 15207 ]
        abdy Abdy Franco made changes -
        Status In Progress [ 3 ] In Review [ 5 ]
        Resolution Fixed [ 1 ]
        jonathan Jonathan Reissmueller made changes -
        Fix Version/s 5.1.3 [ 11716 ]
        Original Estimate 0 minutes [ 0 ]
        jonathan Jonathan Reissmueller made changes -
        Rank Ranked higher
        jonathan Jonathan Reissmueller made changes -
        Status In Review [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            abdy Abdy Franco
            Reporter:
            jonathan Jonathan Reissmueller
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Fix Release Date:
              24/Aug/21

              Time Tracking

              Estimated:
              Original Estimate - 0 minutes
              0m
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 45 minutes
              45m

                Agile