Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up requests with Sparse Response Descriptors? #2

Open
nickyr opened this issue Oct 17, 2016 · 3 comments
Open

Speed up requests with Sparse Response Descriptors? #2

nickyr opened this issue Oct 17, 2016 · 3 comments

Comments

@nickyr
Copy link
Contributor

nickyr commented Oct 17, 2016

From the Vindicia API:

The Sparse Response Description (SRD) parameter enables the calling system to constrain a method call to return only components you specify. This gives you greater control over returned content, and improves response time within the Vindicia platform by reducing the processing needed for the call.

Speeding up the response could be worthwhile. They certainly return a ton of stuff that we don't need. If I recall correctly the default SOAP library does not make use of the SRD.

Although, with the initial release of 13.0.0 software, CashBox supports SRD only for the Transaction and TransactionItem objects, implementation is ongoing for all SOAP objects. Therefore, if you specify an SRD on a field or object that has not been implemented, you will receive a normal return. Contact Vindicia Technical Support for updates on SRD implementation for this release.

You'd think they could have updated that in the version 18 API...

This will be a bit of work because some of the response parsing code might need to change and the responses used in the unit tests definitely will need to change.

Downsides:

  1. It might make things a little harder to debug if you're using this Omnipay library because you won't see the full response unless you get rid of the SRD.
  2. You would have to call a fetch function to get the full object, you wouldn't be able to get it off a different request.
@nickyr
Copy link
Contributor Author

nickyr commented Feb 4, 2019

Looks like they sometimes also call this a Sparse Return Descriptor

@nickyr
Copy link
Contributor Author

nickyr commented Feb 4, 2019

Example, from https://www.vindicia.com/documents/2000ProgGuide_Book.pdf

The following example uses the Transaction.fetchByAccount() method, where transactions is the name of the returned data element.

'{"transactions": [
"VID", "merchantTransactionId", "amount", "currency", "timestamp",
{"transactionItems": ["sku", "name","price","quantity", "taxType"]},
"statusLog"
]}'

With this SRD, any transaction object returned will contain just the VID, merchantTransactionId, amount, currency, and timestamp, and two complex subitems: transactionItems and statusLog. The transactionItems will be limited to sku, name, price, quantity, and taxType, and statusLog will be complete.

@nickyr
Copy link
Contributor Author

nickyr commented Feb 5, 2019

I thought we were actually gonna need this so I was gonna do it, but now it looks like we don't, so I'm not going to.

But a tip for the future: AbstractRequest::sendData blanks out the srd field, so that will need to be changed in order to set srd in the *Request::getData methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant