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

Authorize.Net CIM profile storage updates

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.9.0-b1
    • Component/s: Gateways
    • Labels:
      None

      Description

      Problem

      Authorize.Net CIM allows ACH and CC to be stored offsite. However, their API returns an error attempting to create new customer or payment profiles if they detect a duplicate. See https://support.authorize.net/authkb/index?page=content&id=A116&pmv=print

      API docs:
      https://developer.authorize.net/api/reference/#customer-profiles-get-customer-profile-ids

      i.e.:

      Function Fields Used For Duplicate Profile Verification
      createCustomerProfileRequest merchantCustomerId
      description
      e-mail
      createCustomerPaymentProfileRequest customerProfileId
      cardNumber
      accountNumber
      routingNumber
      billToFirstName
      billToLastName
      billToAddress
      billToZip
      createCustomerShippingAddressRequest customerProfileId
      firstName
      lastName
      address
      zip
      phoneNumber

      If one of the above functions is submitted, and if the fields used for duplicate profile verification contain the exact details as an existing profile, E00039 will occur.

      Note: The error response will include the ID number of the duplicate profile.

      Example error response

      <createCustomerProfileResponse
      	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      	xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
      	<messages>
      		<resultCode>Error</resultCode>
      		<message>
      			<code>E00039</code>
      			<text>A duplicate record with ID 1220992516 already exists.</text>
      		</message>
      	</messages>
      	<customerPaymentProfileIdList />
      	<customerShippingAddressIdList />
      	<validationDirectResponseList />
      </createCustomerProfileResponse>
      

      If an error occurs, the profile ID is returned, albeit in a text message we would have to parse (note: unreliably) and use to re-attempt storage.

      Changes

      Current behavior

      When storing a CC or ACH account, we currently:

      1. Attempt to create the customer profile (if we can't re-use one we already have)
      2. Attempt to create a new payment profile for the account details
      3. Return the customer profile ID and payment profile ID (which will be stored with the Payment Account in Blesta)

      New behavior

      This has to be updated to:

      1. Attempt to create the customer profile (if we can't re-use one we already have)
        • Look for error E00039
        • Parse the text message E00039 for customer profile ID
        • Set the parsed profile ID as the customer profile ID for creating the payment profile
      2. Attempt to create a new payment profile for the account details
        • Look for error E00039
        • Parse the text message E00039 for payment profile ID
        • Set the parsed profile ID as the payment profile ID for the account
      3. If either profile currently exists (i.e. we are not adding them new), then we must update the profiles (see AuthorizeNetCim::update, ::updateProfile, ::updatePaymentProfile)
      4. Only on success, return the customer profile ID and payment profile ID (which will be stored with the Payment Account in Blesta). On failure, return false

        Activity

        Hide
        jonathan Jonathan Reissmueller added a comment -

        To just not allow you to submit payment credentials that already exist in Authorize.net. But I actually ended up implementing a fix with the best of both worlds that will reject the duplicate if it exists in Blesta, but link it up instead if it only exists in Authorize.net.

        Show
        jonathan Jonathan Reissmueller added a comment - To just not allow you to submit payment credentials that already exist in Authorize.net. But I actually ended up implementing a fix with the best of both worlds that will reject the duplicate if it exists in Blesta, but link it up instead if it only exists in Authorize.net.
        Hide
        admin Paul Phillips added a comment -

        What would be the alternative?

        Show
        admin Paul Phillips added a comment - What would be the alternative?
        Hide
        jonathan Jonathan Reissmueller added a comment - - edited

        Do we really want to ignore when the payment account already exists? In this way we could have multiple payment accounts in Blesta being paired with the same Authorize.net payment profile.

        Show
        jonathan Jonathan Reissmueller added a comment - - edited Do we really want to ignore when the payment account already exists? In this way we could have multiple payment accounts in Blesta being paired with the same Authorize.net payment profile.
        Hide
        admin Paul Phillips added a comment -

        This has been reported by some customers lately. If the client deletes an existing payment account before creating a new one then they are unable to create a new one and staff needs to log into authorize.net and delete the profile first.

        Show
        admin Paul Phillips added a comment - This has been reported by some customers lately. If the client deletes an existing payment account before creating a new one then they are unable to create a new one and staff needs to log into authorize.net and delete the profile first.

          People

          • Assignee:
            jonathan Jonathan Reissmueller
            Reporter:
            tyson Tyson Phillips (Inactive)
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Fix Release Date:
              31/Mar/20

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 3 hours, 28 minutes
              3h 28m

                Agile