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

Introduce strong-typed fields for 'reasonCode' and 'message' (response of erroneous API calls) #18

Open
DanielPickens opened this issue Dec 18, 2024 · 0 comments

Comments

@DanielPickens
Copy link

DanielPickens commented Dec 18, 2024

Description
Add new feature to introduce strong-typed fields for 'reasonCode' and 'message' (response of erroneous API calls) when response objects make calls to AmazonPaymentResponse for API calls.

Why is this needed:
This would fix the low hanging fruit of 'reasonCode" and "message" not adhering to strong-typed fields for identifying responses of the API calls that are erroneous and for what reason, and assimilates this source of truth by coupling the PaymentRespons calls to strong-typed fields for to a higher grandiosity than was known before, allowing an advantage in terms of security for paymentresponse types for 'responseCode" and error "message" rendering for erroneous code inspection if questions arise as to where the reponse calls were causing error- the strong-typed field group will allow for better a adherence that maintains a higher input level into where the response codes and messages are derived from.

Method Reference:

namespace Amazon.Pay.API.Types
{
 
    /// <summary>
    /// Response object for API calls
    /// </summary>
    public class AmazonPayResponse
    {
        public Uri Url { get; internal set; }

        public HttpMethod Method { get; internal set; }

        public string RawRequest { get; internal set; }

        public string RawResponse { get; internal set; }

        public string RequestId { get; internal set; }

        public int Status { get; internal set; }

        public int Retries { get; internal set; }

        public long Duration { get; internal set; }

        public bool Success
        {
            get
            {
                if ( Status >= 200 && Status <= 299 ) return true;
                else return false;
            }
        }

        public Dictionary<string,string> Headers { get; internal set; }
    }
}

What would you like to be added:
Update the NameSpace.types and introduce strong-typed fields for 'reasonCode' and 'message' (response of erroneous API calls)
to handle strong-type fields when payment response API calls make aynchronous calls that authenticate responses to AmazonPaymentResponse and these need to have strong-typed fields and this is important because they provide type safety and prevent type errors. This will assure that variables being used are consistently adhering to strong-types according to their declared type and catch type-related errors during compliation, such as making an new class object:

 public class ErrorResponse
    {
        public string ReasonCode { get; set; }
        public string Message { get; set; }
    }

Who is this for:
@amazon:namespace Amazon.Pay.API.Types

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

No branches or pull requests

1 participant