{"action":"closed","issue":{"url":"https://api.github.com/repos/Mangopay/mangopay2-net-sdk/issues/18","repository_url":"https://api.github.com/repos/Mangopay/mangopay2-net-sdk","labels_url":"https://api.github.com/repos/Mangopay/mangopay2-net-sdk/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/Mangopay/mangopay2-net-sdk/issues/18/comments","events_url":"https://api.github.com/repos/Mangopay/mangopay2-net-sdk/issues/18/events","html_url":"https://github.com/Mangopay/mangopay2-net-sdk/issues/18","id":158809625,"number":18,"title":"PayIns.CreateCardDirect throws null reference exception","user":{"login":"reddyBell","id":6731436,"avatar_url":"https://avatars.githubusercontent.com/u/6731436?v=3","gravatar_id":"","url":"https://api.github.com/users/reddyBell","html_url":"https://github.com/reddyBell","followers_url":"https://api.github.com/users/reddyBell/followers","following_url":"https://api.github.com/users/reddyBell/following{/other_user}","gists_url":"https://api.github.com/users/reddyBell/gists{/gist_id}","starred_url":"https://api.github.com/users/reddyBell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reddyBell/subscriptions","organizations_url":"https://api.github.com/users/reddyBell/orgs","repos_url":"https://api.github.com/users/reddyBell/repos","events_url":"https://api.github.com/users/reddyBell/events{/privacy}","received_events_url":"https://api.github.com/users/reddyBell/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2016-06-07T01:18:57Z","updated_at":"2016-06-15T17:49:14Z","closed_at":"2016-06-15T17:49:14Z","body":"For some reason : MangoPayApi.PayIns.CreateCardDirect(...) throws a null reference exception  while the transaction seems to go just fine : \r\n\r\nHere's a log (sandbox environment) : \r\n\r\nCard registration : \r\n\r\n```\r\nPOST https://api.sandbox.mangopay.com/v2/my-app/CardRegistrations/13851264 HTTP/1.1\r\nHost: api.sandbox.mangopay.com\r\nConnection: keep-alive\r\nContent-Length: 186\r\nPragma: no-cache\r\nCache-Control: no-cache\r\nOrigin: http://localhost:56898\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36\r\nContent-type: application/x-www-form-urlencoded\r\nAccept: */*\r\nReferer: http://localhost:56898/index.html\r\nAccept-Encoding: gzip, deflate, br\r\nAccept-Language: en-US,en;q=0.8\r\n\r\nId=13851264&RegistrationData=data%3DWFSUMMF63bMOVTJI5pIqW2Wga8qJ1mPOOiAyRe37l4Wrh7me1LotdTX4l5oALFVJIeibKnNMtUe65WTUsKc4w3i4P5sQMcetYWR3iJoHyZtiTjfMtFT8ICKQ1UEeY8TdkXvOWuMugGhwJp0VppBukA\r\n \r\n```\r\n\r\nResponse :\r\n\r\n```\r\nHTTP/1.1 200 OK\r\nCache-Control: no-cache\r\nPragma: no-cache\r\nContent-Type: application/json; charset=utf-8\r\nExpires: -1\r\nServer: Leetchi\r\nAccess-Control-Allow-Origin: http://localhost:56898\r\nDate: Tue, 07 Jun 2016 01:03:32 GMT\r\nContent-Length: 623\r\n\r\n{\"Id\":\"13851264\",\"Tag\":null,\"CreationDate\":1465261411,\"UserId\":\"13464662\",\"AccessKey\":\"1X0m87dmM2LiwFgxPLBJ\",\"PreregistrationData\":\"S8HjKhXaPXeNlzbaHMqIv-vHl38GEqrOQZSxxIjc_ZqsvTNfScbIfCNjAl8CT0BeS4wCy-yiraxeE65tmxOe8A\",\"RegistrationData\":\"data=WFSUMMF63bMOVTJI5pIqW2Wga8qJ1mPOOiAyRe37l4Wrh7me1LotdTX4l5oALFVJIeibKnNMtUe65WTUsKc4w3i4P5sQMcetYWR3iJoHyZtiTjfMtFT8ICKQ1UEeY8TdkXvOWuMugGhwJp0VppBukA\",\"CardId\":\"13851265\",\"CardType\":\"CB_VISA_MASTERCARD\",\"CardRegistrationURL\":\"https://homologation-webpayment.payline.com/webpayment/getToken\",\"ResultCode\":\"000000\",\"ResultMessage\":\"Success\",\"Currency\":\"EUR\",\"Status\":\"VALIDATED\"}\r\n```\r\n\r\nCall to CreateCardDirect :\r\n\r\n```\r\nPOST https://api.sandbox.mangopay.com/v2.01/my-app/payins/card/direct HTTP/1.1\r\nAuthorization: Bearer 13611e5b2f454e76a18bb7aeebc329e6\r\nAccept: application/json, application/xml, text/json, text/x-json, text/javascript, text/xml, application/json\r\nUser-Agent: RestSharp/104.4.0.0\r\nContent-Type: application/json\r\nHost: api.sandbox.mangopay.com\r\nContent-Length: 341\r\nAccept-Encoding: gzip, deflate\r\n\r\n{\"AuthorId\":\"13464662\",\"CreditedUserId\":\"12845567\",\"DebitedFunds\":{\"Currency\":\"EUR\",\"Amount\":25200},\"Fees\":{\"Currency\":\"EUR\",\"Amount\":0},\"CreditedWalletId\":\"12845568\",\"SecureModeReturnURL\":\"http://mywebsite.com/secure-payment-success\",\"CardId\":\"13851265\",\"SecureMode\":\"FORCE\",\"CardType\":null,\"Tag\":null}\r\n```\r\n\r\nResponse :\r\n\r\n```\r\nHTTP/1.1 200 OK\r\nCache-Control: no-cache\r\nPragma: no-cache\r\nContent-Type: application/json; charset=utf-8\r\nExpires: -1\r\nServer: Leetchi\r\nDate: Tue, 07 Jun 2016 01:03:34 GMT\r\nContent-Length: 802\r\n\r\n{\"Id\":\"13851266\",\"Tag\":null,\"CreationDate\":1465261412,\"AuthorId\":\"13464662\",\"CreditedUserId\":\"12845567\",\"DebitedFunds\":{\"Currency\":\"EUR\",\"Amount\":25200},\"CreditedFunds\":{\"Currency\":\"EUR\",\"Amount\":25200},\"Fees\":{\"Currency\":\"EUR\",\"Amount\":0},\"Status\":\"CREATED\",\"ResultCode\":null,\"ResultMessage\":null,\"ExecutionDate\":null,\"Type\":\"PAYIN\",\"Nature\":\"REGULAR\",\"CreditedWalletId\":\"12845568\",\"DebitedWalletId\":null,\"PaymentType\":\"CARD\",\"ExecutionType\":\"DIRECT\",\"SecureMode\":\"FORCE\",\"CardId\":\"13851265\",\"SecureModeReturnURL\":\"http://mywebsite.com/secure-payment-success?transactionId=13851266\",\"SecureModeRedirectURL\":\"https://api.sandbox.mangopay.com:443/Redirect/ACSWithValidation?token=1c65ae3edc704a5a946bef27dff64e57\",\"SecureModeNeeded\":true,\"StatementDescriptor\":null}\r\n```\r\n\r\nAs you can see the status is set to \"Created\", however CreateCardDirect throws the following exception instead of returning :\r\n\r\n> System.NullReferenceException: Object reference not set to an instance of an object.\r\n>    at MangoPay.SDK.Core.RestTool.DoRequest[U,T](String idempotencyKey, String urlMethod, Pagination pagination, T entity)\r\n>    at MangoPay.SDK.Core.RestTool.Request[U,T](String idempotencyKey, String urlMethod, String requestType, Dictionary`2 requestData, Pagination pagination, T entity)\r\n>    at MangoPay.SDK.Core.APIs.ApiBase.CreateObject[U,T](String idempotencyKey, MethodKey methodKey, T entity, String entityId, String secondEntityId)\r\n>    at MangoPay.SDK.Core.APIs.ApiBase.CreateObject[U,T](String idempotencyKey, MethodKey methodKey, T entity, String entityId)\r\n>    at MangoPay.SDK.Core.APIs.ApiBase.CreateObject[U,T](String idempotencyKey, MethodKey methodKey, T entity)\r\n>    at MangoPay.SDK.Core.APIs.ApiPayIns.CreateCardDirect(String idempotencyKey, PayInCardDirectPostDTO payIn)\r\n>    at MangoPay.SDK.Core.APIs.ApiPayIns.CreateCardDirect(PayInCardDirectPostDTO payIn)\r\n\r\nThis happens at a very bad time, we are in a hurry to deliver a product...."}}
{"actor":{"display_login":"hobailey"}}