#Luis GOIÁS luismendes070

1 messages · Page 1 of 1 (latest)

cloud grottoBOT
sharp imp
#

Hi, can you add more details here? Are you using a specific resource that you can share with me?

undone gulch
#

using Stripe;

public class StripeCredCardTest{

[Fact]
public void Test(){
    // a
    CreditCardHelper creditCardHelper = new CreditCardHelper();
    // a
    creditCardHelper.isValid = creditCardHelper.ExampleFunction(
        new PaymentIntentCreateOptions().PaymentMethodData('4111111111111111');
    );
    // a
    Assert.True(creditCardHelper.isValid);
}

}

#

using Stripe;
using System;

namespace CreditCardHelperNamespace
{

public static class CreditCardHelper
{
    public bool isValid { get; set; }
public CreditCardHelper()
    {
        StripeConfiguration.ApiKey = Environment.GetEnvironmentVariable("SECRET_KEY");
        // isValid = ExampleFunction('4111111111111111');
    } // end constructor

    // using Stripe;



    static void ExampleFunction(PaymentIntentCreateOptions options)
    {
        try
        {
            var service = new PaymentIntentService();
            service.Create(options);
            Console.WriteLine("No error.");
        }
        catch (StripeException e)
        {
            switch (e.StripeError.Type)
            {
                case "card_error":
                    Console.WriteLine($"A payment error occurred: {error.Message}");
                    break;
                case "invalid_request_error":
                    Console.WriteLine("An invalid request occurred.");
                    break;
                default:
                    Console.WriteLine("Another problem occurred, maybe unrelated to Stripe.");
                    break;
            }
        }
    } // end function Stripe ExampleFunction

} // end class

} // end namespace

sharp imp
#

Thank you, I'm getting help from someone who has more experience with dotnet. Thank you for your patience

hallow crypt
#

Hello! I'm taking over and catching up...

undone gulch
#

Hello!

hallow crypt
#

I'm not sure I understand what you need. What's blocking you?

undone gulch
#

\AspNetCore.Docs.Samples\mvc\action-return-types\7.x\WebApiSample\Test\StripeCredCardTest.cs(8,69): error CS1012

hallow crypt
#

Which one of the lines above is line 8?

#

Oh, wait, you're using single quotes. Try using double quotes.

undone gulch
#

the test

hallow crypt
#

Like here for example: PaymentIntentCreateOptions().PaymentMethodData('4111111111111111'); Use "4111111111111111" instead. You may need to adjust that in several places.

undone gulch
#

Thank You

hallow crypt
#

Does that resolve the error?

undone gulch
#

There are two errors now

#

error CS1026 and error CS1513 Test line 11

hallow crypt
#

CS1026 is a syntax error that indicates you're likely missing a ) somewhere.

#

CS1513 is also a syntax error about a missing }.

undone gulch
#

It's the Test class namespace.