hps / heartland-nodejs

Heartland's node.js SDK for connecting to our Portico Payment Gateway.
GNU General Public License v2.0
10 stars 12 forks source link

Ability to set TxnDescriptor? #23

Closed charlie-s closed 5 years ago

charlie-s commented 5 years ago

We'd like to set a custom transaction descriptor (TxnDescriptor, not the "memo") for our transactions so that we have some control over how charges appear on customer's statements. It appears that this value is the TxnDescriptor, but the node.js library doesn't support a method of setting this. Am I incorrect in my initial assumption? In either event, do you have a recommended method for setting this?

slogsdon commented 5 years ago

@charlie-s We don't currently have the TxnDescriptor field exposed via this SDK to pass a dynamic descriptor for a transaction, so it would require a code change (either directly or via fork) to the SDK itself. We don't currently have this work on our backlog, but we would be open to any PRs to add this capability.

While not ideal, there are two additional paths to pass a dynamic descriptor:

  1. Integrate directly to the gateway to pass this information
  2. Integrate with our newer SDK that connects to our Portico gateway as well as the Global Payments eCommerce gateway.

Option 2 above would look like this to complete an authorization request with a dynamic descriptor:

const {
  CreditCardData,
  ServicesConfig,
  ServicesContainer,
} = require("globalpayments-api");

const config = new ServicesConfig();
config.secretApiKey = "skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A";
config.serviceUrl = "https://cert.api2-c.heartlandportico.com";
ServicesContainer.configure(config);

const card = new CreditCardData();
card.token = ""; // token value

card
  .charge(10.00)
  .withCurrency("USD")
  .withDynamicDescriptor("YOUR DESCRIPTOR")
  .execute()
  .then((response) => {
    const result = response.responseCode;
    const message = response.responseMessage;
  })
  .catch((e) => {
    // handle  errors
  });
charlie-s commented 5 years ago

Happy to try out the new SDK. I didn't realize it existed, actually. I'll check that out and file any issues in the appropriate repo.

charlie-s commented 5 years ago

I'm attempting to add this to the current Heartland SDK instead of migrating to GlobalPayments. I've added a descriptor argument to the relevant function calls in hps-credit-service.js and set the property on the transaction if it's been supplied, ex:

if (hlp.defNn(descriptor)) tx.TxnDescriptor = descriptor;

I can see that the TxnDescriptor is being included in the request, and have also tested it with invalid data to ensure that the SOAP client verifies it properly:

{ 
    CardData: {
        TokenData: {
            CardPresent: 'N',
            ReaderPresent: 'N',
            TokenValue: 'supt_xxx'
        },
        TokenRequest: 'Y'
    },
    Amt: 15.95,
    CardHolderData: { ... },
    AdditionalTxnFields: { Description: 'Store Name' },
    TxnDescriptor: 'Store Name',
    AllowDup: 'Y'
}

So everything looks good, but when I check my bank, it's using our DBA name instead of the dynamic descriptor. I've followed the docs closely. I did see this note there:

Updates to your Portico device settings are required to use this feature.

Does this include API transactions? (do I have to have this enabled by SecureSubmit support?)

slogsdon commented 5 years ago

@charlie-s I believe you're correct there. You should be able to reach out to SecureSubmitCert@e-hps.com to get that sorted.