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

[FEATURE] Enable Reverse Request Creation via Mandae V1 API #3

Open
guibranco opened this issue Feb 13, 2019 · 1 comment
Open

[FEATURE] Enable Reverse Request Creation via Mandae V1 API #3

guibranco opened this issue Feb 13, 2019 · 1 comment
Labels
enhancement feature A feature request gitauto GitAuto label to trigger the app in a issue. hacktoberfest Participation in the Hacktoberfest event help wanted

Comments

@guibranco
Copy link
Owner

guibranco commented Feb 13, 2019

Description

Add support for requesting a reverse (return shipment) through the Mandae V1 API. This feature will allow the system to submit a reverse request by sending the necessary data in an HTTP POST request to the Mandae API.

Feature Objective

  • Implement a method to send a reverse request to the Mandae V1 API using an HTTP POST request.
  • The reverse request will take customer and package details, and execute the API call to create the reverse shipment.

Tasks:

  1. API Integration:

    • Perform an HTTP POST request to the Mandae V1 API endpoint for creating reverse requests.
    • The method should accept reverse request data (e.g., sender details, recipient details, package dimensions, and tracking number) as input.
  2. Input Data:

    • Accept necessary details for reverse request creation, such as:
      • Tracking Number
      • Sender Information (name, address, etc.)
      • Recipient Information
      • Package Details (weight, dimensions, reason for return, etc.)
    • Ensure proper validation of input data before making the API request.
  3. POST Request Handling:

    • Serialize the reverse request data to JSON format.
    • Send an HTTP POST request to the Mandae API with the serialized data.
    • Handle successful and error responses appropriately, providing meaningful feedback to the caller.
  4. Response Handling:

    • Parse the API response and return the reverse shipment creation status, including the reverse shipment ID and any related metadata (e.g., status, timestamps).
    • Provide error handling for cases such as invalid data, authentication failure, or API unavailability.

Example API Call:

public async Task<ReverseResponse> RequestReverseAsync(ReverseRequest reverseRequest)
{
    var apiUrl = "https://api.mandae.com/v1/reverses";
    var jsonContent = JsonConvert.SerializeObject(reverseRequest);
    var content = new StringContent(jsonContent, Encoding.UTF8, "application/json");

    var response = await _httpClient.PostAsync(apiUrl, content);

    if (!response.IsSuccessStatusCode)
    {
        // Handle error response
        throw new HttpRequestException("Failed to create reverse shipment");
    }

    var reverseResponse = await response.Content.ReadAsAsync<ReverseResponse>();
    return reverseResponse;
}

Expected Outcome:

  • Success: The system successfully submits the reverse request and returns the reverse shipment details, such as the reverse shipment ID, status, and any additional information from the API response.
  • Failure: The system provides detailed error messages indicating the cause of failure (e.g., invalid request data, authentication issues, API errors).

Tech Notes:

  • Ensure that sensitive data (like authentication tokens) are securely handled during the API request.
  • Add unit tests and integration tests to cover the following scenarios:
    • Valid reverse request creation
    • Invalid input data handling
    • Error response from the API

Resources:

@guibranco guibranco self-assigned this Feb 13, 2019
@guibranco guibranco added this to the Mandaê V1 endpoints milestone Feb 13, 2019
@guibranco guibranco removed their assignment Jun 30, 2023
@guibranco guibranco added the hacktoberfest Participation in the Hacktoberfest event label Oct 7, 2023
@guibranco guibranco changed the title Request reverse [FEATURE] Request reverse May 15, 2024
@gitauto-ai gitauto-ai bot added the gitauto GitAuto label to trigger the app in a issue. label Aug 22, 2024
Copy link

gitauto-ai bot commented Aug 22, 2024

Sorry, we have an error. Please try again.

Have feedback or need help?
Feel free to email [email protected].

@guibranco guibranco changed the title [FEATURE] Request reverse [FEATURE] Enable Reverse Request Creation via Mandae V1 API Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement feature A feature request gitauto GitAuto label to trigger the app in a issue. hacktoberfest Participation in the Hacktoberfest event help wanted
Projects
None yet
Development

No branches or pull requests

1 participant