braintree / braintree_dotnet

Braintree .NET library
https://developer.paypal.com/braintree/docs/start/overview
MIT License
136 stars 73 forks source link

Make 'Request Download of Advanced Search' available via SDK #127

Closed prlb-davidslye closed 2 years ago

prlb-davidslye commented 2 years ago

General information

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.

hollabaq86 commented 2 years ago

👋 @prlb-davidslye Thanks for reaching out. I've gone ahead and forwarded your feature request to our product teams for consideration.