cancel
Showing results for 
Search instead for 
Did you mean: 
InnovAdam
Member

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. 

8 Comments
Status changed to: Comments Requested
RichardH
Administrator Administrator
Administrator
 
bhav
Authorize.Net Expert Authorize.Net Expert
Authorize.Net Expert

@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.

mkienenb
Contributor

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);
                         }
                     }

 

binhngquang8
Member

Same thing happened to me man.

Alaskasworld
Member

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.

Alaskasworld
Member

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 }

Alaskasworld
Member

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;

 

jack43
Member

Same thing happened to me man in My mini aussiedoodle full grown.