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

          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