adebisi-fa / paystack-dotnet

PayStack API for .Net Developers!
http://developers.paystack.co/docs
MIT License
37 stars 37 forks source link

ArgumentException: Accessed JArray values with invalid key value: "metadata". Int32 array index expected #15

Closed ddynamight closed 5 years ago

ddynamight commented 5 years ago

Hi @adebisi-fa,

I have a bit of an issue using the list bank endpoint. Anytime I call it like this. var banks = payApi.Miscellaneous.ListBanks(itemsPerPage: 50, page: 1);

OR var banks = payApi.Miscellaneous.ListBanks(itemsPerPage: 50, page: 1).AsJObject();

OR var banks = payApi.Miscellaneous.ListBanks(itemsPerPage: 50, page: 1).RawJson;

OR var banks = payApi.Miscellaneous.ListBanks(itemsPerPage: 50, page: 1).Data;

I always get the below error

An unhandled exception occurred while processing the request. ArgumentException: Accessed JArray values with invalid key value: "metadata". Int32 array index expected. Newtonsoft.Json.Linq.JArray.get_Item(object key).

Kindly help look into this. No matter what I do. Kindly help me look into this. I guess I am missing something here.

adebisi-fa commented 5 years ago

Hello @ddynamight ,

I'll look it up and revert, asap.

Cheers.

ddynamight commented 5 years ago

Hello @adebisi-fa, So far, I have found this to affect the Transfer interface too as well Thank you for the reply, a quick fix will be appreciated. Regards.

adebisi-fa commented 5 years ago

Thanks @ddynamight,

Kindly check if v0.7.5 fix this issue.

Thanks, please.

ddynamight commented 5 years ago

@adebisi-fa, thanks for the fix, v0.7.5 did fixed the error, sorry to bother you again.

But I keep getting this error. When I tried using the transfer interface too.

An unhandled exception occurred while processing the request. NullReferenceException: Object reference not set to an instance of an object. PayStack.Net.PayStackApi.ParseAndResolveMetadata(ref string rawJson)

First when I tried creating a recipient like this

var recipentRequest = new CreateTransferRecipientRequest { Name = disbursement.Name, AccountNumber = disbursement.Account, BankCode = "057", Currency = "NGN", Description = $"Fund Transter For {request.Reference}", Type = "nuban" }; var recipientResult = payApi.Transfers.Recipients.Create(recipentRequest);

is there something I am missing here.

A quick response will be so much appreciated.