CIM: return duplicate CustomerProfileID when duplicate is detected

Status: Comments Requested
by on ‎04-06-2017 10:28 AM

When creating a customer profile and receiving the E000039 error that tells us there is a duplicate customer profile that already exists it would be useful to get that duplicate profile ID in the response other than inside the error text. While technically possible to pull it out of the error message it would be much easier and less prone to issue if we could get it back somewhere directly, such as the CustomerProfileID filed that already exists on the createCustomerProfileResponse object. 

Comments
by Administrator Administrator
on ‎06-15-2017 02:19 PM
Status changed to: Comments Requested
 
by Authorize.Net Expert Authorize.Net Expert
‎01-02-2018 03:33 PM - edited ‎01-02-2018 03:33 PM

@InnovAdam @RichardH  we do provide duplicate customerID in the error message

I just tried one in Sanbox env and following is error message i get  the following message 

 

E00039 : A duplicate record with ID 1813856003 already exists.

by
on ‎01-23-2018 09:02 AM

This is the second comment I've read from you where you failed to read the actual request.

The request ***is*** to be able to get the duplicate customerID without parsing the error message.

 

This is possible for payment profiles.[1]   This is not possible for customer profiles.[2]

 

[1] java api for payment profiles:

                     duplicateId = response.getCustomerPaymentProfileId()

 

[2] java api for customer profiles:

 

                     /* Hope that Authorize.net doesn't change the error message text */

                     if ("E00039".equals(message.getCode())) {
                         String text = message.getText();
                          int startPos = -1;
                          if (text.startsWith("A duplicate record with ID ")) {
                              startPos = "A duplicate record with ID ".length();
                          }
                         int endPos = text.lastIndexOf(" already exists.");
                         if ((startPos != -1) && (endPos != -1)) {
                             duplicateId = text.substring(startPos, endPos);
                         }
                     }

 

by
‎08-09-2018 09:28 PM - edited ‎08-09-2018 09:28 PM

Same thing happened to me man.

by
on ‎11-17-2020 04:44 AM

Reviewing this again today, I think the best approach will be to provide a unique ID. I worked with mfer at the time who determined cloning was the only reliable way to prevent a duplicate submission. That very well could've been based on jQuery / JavaScript oddities of the time ... Drupal Commerce is quite old. Alaskasworld 

If we're making a fix here, let's do it in the smallest way possible: use a unique ID for the cloned button.

by
on ‎11-18-2020 02:26 AM

I'm looping through a bunch of JSON files to parse them and output to CSV. What I would like to do is parse but only output the duplicate elements. Tellthebell 

 

Code I'm using to just parse every thing I'm needing and out put to CSV:

$json_files = Get-ChildItem C:\Users\lzimbelman\Desktop\auth\*.json foreach ($file in $json_files) { $profiles = Get-Content $file | ConvertFrom-Json $results = foreach ($paymentprofile in $profiles.profile.paymentProfiles) { $CustomObject = [PSCustomObject]@{ 'customerPaymentProfileId' = $paymentprofile.customerPaymentProfileId 'accountType' = if ($paymentprofile.payment.PSObject.Properties.Name -eq "creditCard") { "creditCard" } else {"bankAccount"} 'lastFour' = if ($paymentprofile.payment.PSObject.Properties.Name -eq "creditCard") {$paymentprofile.payment.creditCard.cardNumber} else {$paymentprofile.payment.bankAccount.accountNumber} } $CustomObject | Add-Member -MemberType NoteProperty -Name customerProfileId -Value $profiles.profile.customerProfileId $CustomObject | Add-Member -MemberType NoteProperty -Name customerId -Value $profiles.profile.merchantCustomerId $CustomObject } $results | Export-Csv C:\Users\lzimbelman\Desktop\test3.csv -Append -NoTypeInformation }

by
on ‎11-19-2020 01:44 AM

You can also try the below code. It is also working well.

 

if you pull the conversion to Guid outside your query you'll probably end up with better performance since comparing Guids is probably faster than comparing strings. Target Redcard 

 

var customerProfileGuid = new Guid(customerProfileId);

wrap in try catch if needed

var accountQuery = from C in CustomerModel.CustomerProfile where C.CustomerId == customerProfileGuid select C;