GithubHelp home page GithubHelp logo

Comments (6)

Dthurman avatar Dthurman commented on July 17, 2024

I'm investigating your issue and have two questions.

  1. Are you using the gateway model ( SubscriptionGateway) or the new controller model (ARBCreateSubscriptionController)?

  2. Can you include the line of code where your are executing the request?

Thanks

from sdk-dotnet.

gorgi avatar gorgi commented on July 17, 2024

I am using the SubscriptionGateway. Here's my simple code:

subscription request
The exception's Data field is empty, there is no way to get the error codes.

from sdk-dotnet.

Dthurman avatar Dthurman commented on July 17, 2024

Thanks. I'm able to repro it now.

from sdk-dotnet.

Dthurman avatar Dthurman commented on July 17, 2024

I have reproed the issue, and you are right, error handling is not ideal for the gateway model.
We are looking at how to handle the issue.

Going forward, the best approach would be to use the new "Controller" model.
Using the new model, your sample would look like this:

    [Test]
    public void TestSubscription_ExpiredCC()
    {
        Random rnd = new Random(DateTime.Now.Millisecond);
        ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = CustomMerchantAuthenticationType;
        ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = TestEnvironment;
        //create a subscription
        var subscriptionDef = new ARBSubscriptionType
        {


            paymentSchedule = new paymentScheduleType
            {
                interval = new paymentScheduleTypeInterval
                {
                    length = 7,
                    unit = ARBSubscriptionUnitEnum.days
                },
                startDate = DateTime.UtcNow,
                totalOccurrences = 2,
            },


            amount = 9.99M,
            billTo = new nameAndAddressType
            {
                address = "1234 Elm St NE",
                city = "Bellevue",
                state = "WA",
                zip = "98007",
                firstName = "First",
                lastName = "Last"
            },

            payment = new paymentType
            {
                Item = new creditCardType
                             {
                                 cardCode = "655",
                                 cardNumber = "4007000",
                                 expirationDate = "122013",
                             }
            },

            customer = new customerType { email = "[email protected]", id = "5", },

            order = new orderType { description = string.Format("member monthly {0}", rnd.Next(99999)) },
        };

        var arbRequest = new ARBCreateSubscriptionRequest { subscription = subscriptionDef };
        var arbController = new ARBCreateSubscriptionController(arbRequest);
        arbController.Execute();

        var arbCreateResponse = arbController.GetApiResponse();

        //If request responds with an error, walk the messages and get code and text for each message.
        if (arbController.GetResultCode() == messageTypeEnum.Error)
        {
            foreach(var msg in arbCreateResponse.messages.message)
            {
                Console.WriteLine("Error Num = {0}, Message = {1}", msg.code, msg.text);
            }
        }
    }

from sdk-dotnet.

Dthurman avatar Dthurman commented on July 17, 2024

I have added a sample to the future branch, that walks through the error messages returned by a failed create subscription request.

Gorgi, does this resolve your issue?

from sdk-dotnet.

gorgi avatar gorgi commented on July 17, 2024

We switched to the new Controller model. Thanks!

from sdk-dotnet.

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.