braintree_dotnet icon indicating copy to clipboard operation
braintree_dotnet copied to clipboard

Make 'Request Download of Advanced Search' available via SDK

Open prlb-davidslye opened this issue 3 years ago • 0 comments

General information

  • SDK/Library version: 5.13.0
  • Environment: Sandbox, Production
  • Language, language version, and OS: NET, all OS'

Issue description

Add an API endpoint to support queuing a downloadable advanced search for transactions, and also in the SDK.

For the scope of this Issue, it would be allowing a queuing of the downloadable advanced search. In a future Issue, it would include retrieving that downloadable advanced search via the SDK.

API

request:
POST api.braintreegateway.com/merchants/{id}/transactions/advanced_search/submit_for_download

response:
202 Accepted 
{
    Location: https://api.sandbox.braintreegateway.com/merchants/{id}/downloads/advanced_search/{download_id}
}

SDK

ITransactionGateway.cs

Task<ResultImpl<AdvancedSearchDownload>> SubmitTransactionSearchForDownloadAsync(TransactionSearchRequest query);

TransactionGateway.cs

...
public virtual async Task<ResultImpl<AdvancedSearchDownload>> SubmitTransactionSearchForDownloadAsync(TransactionSearchRequest query)
        {
            NodeWrapper response = new NodeWrapper(await service.PostAsync(service.MerchantPath() + "/transactions/advanced_search/submit_for_download", query).ConfigureAwait(false));

            return new ResultImpl<AdvancedSearchDownload>(new NodeWrapper(response), gateway);
        }

Context:

Via the Control Panel in Braintree, we can use the merchants/{id}/transactions/advanced_search route to perform a search, and then use the merchants/{id}/transactions/download_advanced_search_results route to trigger a downloadable copy of the transaction advanced search results.

In the Control Panel view, the response to the requesting a download of the advanced search transactions is an HTTP 302 response, leading to the /merchants/{id}/downloads page.

Request:


POST merchants/{id}//transactions/download_advanced_search_results

Response:

HTTP 302 { Location: https://sandbox.braintreegateway.com/merchants/{id}/downloads }

These downloads can be found through the Control Panel UI at merchants/{id}/downloads (and more specifically, from https://sandbox.braintreegateway.com/merchants/{id}/categorized_downloads ) which would be superb to have available from the SDK. Any particular download can currently be found at the url GET https://sandbox.braintreegateway.com/merchants/{id}/downloads/{download_id}.

By allowing this to be accessed through the SDK we can more efficiently retrieve advanced searches without holding open a network call during the advanced search.

prlb-davidslye avatar Jul 28 '22 22:07 prlb-davidslye