Vantiv / payfac-mp-sdk-dotnet

Worldpay's .NET SDK for PayFac Merchant Provisioner API
MIT License
2 stars 2 forks source link

originalLegalEntityId is not properly serialized on legalEntityResponse #4

Open bdunn313 opened 4 years ago

bdunn313 commented 4 years ago

When creating a legalEntity and a 200 success is received with an originalLegalEntityId & originalLegalEntityStatus in the response instead of a legalEntityId or legalEntityIdResponse then legalEntityResponse.legalEntityId == null and legalEntityResponse.originallegalEntityId == null.

I would expect in the above scenario for legalEntityId == null but for originallegalEntityId to equal the originalLegalEntityId from the response XML.

This appears to be a serialization issue - the XML is cased with an upper-case "Legal" while the C# property is written with a lower-case "legal". This appears to also be the issue with originalLegalEntityStatus.

I believe the following property needs to be changed, or extra code needs to be added to properly convert the raw XML into the properties listed above https://github.com/Vantiv/payfac-mp-sdk-dotnet/blob/13.x/PayFacMpSDK/PayFacMpSDK/Generated.cs#L3693

Example request XML (preprod env url removed):

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<legalEntityCreateRequest
    xmlns="http://preprod-url">
    <legalEntityName>Yarrgh Pirate Co.</legalEntityName>
    <legalEntityType>INDIVIDUAL_SOLE_PROPRIETORSHIP</legalEntityType>
    <legalEntityOwnershipType>PRIVATE</legalEntityOwnershipType>
    <doingBusinessAs>Jolly Roger Services</doingBusinessAs>
    <taxId>551351516</taxId>
    <contactPhone>5555555555</contactPhone>
    <annualCreditCardSalesVolume>0</annualCreditCardSalesVolume>
    <hasAcceptedCreditCards>false</hasAcceptedCreditCards>
    <address>
        <streetAddress1>2223 Executive Dr</streetAddress1>
        <streetAddress2>Suite 104</streetAddress2>
        <city>Detroit</city>
        <stateProvince>MI</stateProvince>
        <postalCode>48201</postalCode>
        <countryCode>USA</countryCode>
    </address>
    <principal>
        <firstName>Joeya</firstName>
        <lastName>Schmoeya</lastName>
        <emailAddress>joe2a@example.com</emailAddress>
        <ssn>111111113</ssn>
        <contactPhone>1111111111</contactPhone>
        <dateOfBirth>1982-01-31</dateOfBirth>
        <address>
            <streetAddress1>900 Chelmsford St</streetAddress1>
            <streetAddress2>Ste 5</streetAddress2>
            <city>Royal Oak</city>
            <stateProvince>MI</stateProvince>
            <postalCode>48067</postalCode>
            <countryCode>USA</countryCode>
        </address>
        <stakePercent>100</stakePercent>
    </principal>
    <yearsInBusiness>0</yearsInBusiness>
</legalEntityCreateRequest>

Example response XML (preprod env url removed):

<legalEntityCreateResponse xmlns="http://preprod-url" duplicate="true">
    <transactionId>83982920810924792</transactionId>
    <originalLegalEntityId>83982920810690989</originalLegalEntityId>
    <originalLegalEntityStatus>Approved</originalLegalEntityStatus>
</legalEntityCreateResponse>

Example C# code to generate above XML (config removed):

var request = new legalEntityCreateRequest
{
    legalEntityName = "Yarrgh Pirate Co.",
    legalEntityType = legalEntityType.LIMITED_LIABILITY_COMPANY,
    legalEntityOwnershipType = legalEntityOwnershipType.PRIVATE,
    doingBusinessAs = "Jolly Roger Services",
    taxId = "551351516",
    contactPhone = "5555555555",
    annualCreditCardSalesVolume = "0",
    hasAcceptedCreditCards = false,
    address =  new address()
    {
        streetAddress1 = "2223 Executive Dr",
        city = "Suite 104",
        stateProvince = "Detroit",
        postalCode = "48201",
        countryCode = "USA"
    },
    principal = new legalEntityPrincipal
    {
        firstName = "Joeya",
        lastName = "Schmoeya",
        emailAddress = "joe2a@example.com",
        ssn = "111111113",
        contactPhone = "1111111111",
        dateOfBirth =  (new DateTime(1982, 1, 31)).Value,
        address = new principalAddress()
        {
            streetAddress1 = "900 Chelmsford St",
            streetAddress2 = "Ste 5",
            city = "Royal Oak",
            stateProvince = "MI",
            postalCode = "48067",
            countryCode = "USA"
        },
        stakePercent = 100
    },
    yearsInBusiness = "0",
};
var response = request.PostLegalEntityCreateRequest();
if (respose.legalEntityId == null) {
  Assert.True(response.orignallegalEntityId, null);
  Assert.True(response.originallegalEntityStatus, null);
}

Please let me know if further info is needed.

Edit: had a typo in my example code

bdunn313 commented 4 years ago

Any update on this?

VantivSDK commented 4 years ago

Thanks for reaching out to us with the details. We have released new version 13.0.4 of the SDK with the fixes. Please check it out.