Giter VIP home page Giter VIP logo

Comments (5)

shrakuma avatar shrakuma commented on September 28, 2024

Elliott, thanks for your suggestion. I will review the parsing of the error messages request and get back to you once we discuss in our sprint

from amazon-pay-sdk-php.

kailight avatar kailight commented on September 28, 2024

I am working with this library and its very hard to handle the errors - have to dig in the arrays to understand why payments get stuck. Please note that not all errors are getting handled with exceptions, such as invalid payment method error that is in some other place in XML.

from amazon-pay-sdk-php.

bmeynell avatar bmeynell commented on September 28, 2024

Agreed. I believe I am looking for similar answers. I arrived here in search of the best practice for error handing the API calls. For example, is any sort of specific Exception's thrown or are they all a simple generic Exception class? For example, what if Amazon is down and cannot be communicated with? There's the "service status" API call but if the Amazon API is down that probably defaults the purpose of that call. Looking at the code I saw an invokePost method which looked like the right spot for these cases. If so, is the recommended way to wrap each API call like so?

try {
    $response = $this                                                              
        ->amazonPay                                                                   
        ->setOrderReferenceDetails(array(                                          
            'amazon_order_reference_id' => $order->getAmazonReferenceId(),         
            'seller_order_id' => $order->getAmazonOrderId(),                       
            'amount' => $order->getTotal(),                                        
            'currency_code' => 'USD',                                              
            'seller_note' => 'Hello World.',                               
            'store_name' => 'Our Shop!',                                       
    )); 
} catch (\Exception $e) {
  // Perform error handing here ...
}

from amazon-pay-sdk-php.

mablae avatar mablae commented on September 28, 2024

@bmeynell This library is a total mess. 😄 It does not throw exceptions at all. You have to "ask" the client if there was an error on an boolean var.

When implementing an Exception Approach it would be nice to wrap them into super classes Like ClientException == 4xx and ServiceException = 5xx

ClientException would then wrap around the response object and extract useful messages and and Error codes from it?

from amazon-pay-sdk-php.

lotsofbytes avatar lotsofbytes commented on September 28, 2024

frustrated without error code.

the "charge" method returns an exception because of Suspended caused by InvvalidPaymentMethod
"The Order Reference is in the Suspended State. It should be in the Draft or Open State"

I want to identify this with the exception error code but currently only the string above.

from amazon-pay-sdk-php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.