0

I'm trying to create and Idempotency Key for each associated request. I have a lot of functions which modify the base Idempotency Key like so:

public async Task<PaymentMethod> CreatePaymentMethodAsync(string customerId, string paymentMethodId, string idemBase)
{
    //...
    var requestOptions = this.GetDefaultOptions(idemBase, nameof(StripeConnectService.CreatePaymentMethodAsync));
}

public async Task<PaymentIntent> CapturePaymentIntentAsync(string paymentIntentId, long? amountInCents, 
   string idemBase)
{
    //...
    var requestOptions = this.GetDefaultOptions(idemBase, nameof(StripeConnectService.CapturePaymentIntentAsync));
}

I would prefer not having to explictly pass the function name using the name of operator, it is prone to copy and paste errors and would prefer a simpler way, preferably one that doesn't use reflection.

johnny 5
  • 19,893
  • 50
  • 121
  • 195
  • 1
    Look for CallerMemberName – Sir Rufo May 04 '20 at 00:02
  • Thanks, I was unclear originally if that uses reflection or now but now I'm [aware that it doesn't](https://stackoverflow.com/questions/16053079/does-callermembernameattribute-use-reflection) – johnny 5 May 04 '20 at 23:11

0 Answers0