{"action":"created","issue":{"url":"https://api.github.com/repos/pedropaf/saas-ecom/issues/8","labels_url":"https://api.github.com/repos/pedropaf/saas-ecom/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/pedropaf/saas-ecom/issues/8/comments","events_url":"https://api.github.com/repos/pedropaf/saas-ecom/issues/8/events","html_url":"https://github.com/pedropaf/saas-ecom/issues/8","id":82440223,"number":8,"title":"Invoice Paid Webhook Fails","user":{"login":"benfoster","id":827305,"avatar_url":"https://avatars.githubusercontent.com/u/827305?v=3","gravatar_id":"","url":"https://api.github.com/users/benfoster","html_url":"https://github.com/benfoster","followers_url":"https://api.github.com/users/benfoster/followers","following_url":"https://api.github.com/users/benfoster/following{/other_user}","gists_url":"https://api.github.com/users/benfoster/gists{/gist_id}","starred_url":"https://api.github.com/users/benfoster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benfoster/subscriptions","organizations_url":"https://api.github.com/users/benfoster/orgs","repos_url":"https://api.github.com/users/benfoster/repos","events_url":"https://api.github.com/users/benfoster/events{/privacy}","received_events_url":"https://api.github.com/users/benfoster/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-29T14:00:02Z","updated_at":"2015-06-03T01:13:31Z","closed_at":null,"body":"This was when running the MyNotes example. Not sure if it applies to the core code.\r\n\r\n`BillingAddress` is defined as a `[ComplexType]` which means it has to be initialised (even if it's properties are null). The current code will fail because `Invoice.BillingAddress` is null:\r\n\r\n> Null value for non-nullable member. Member: 'BillingAddress'.\r\n\r\nI guess (looking at the MyNotes example) that the solution would be to grab the user's current billing address and attach this to the invoice before saving. This would require a way to obtain the User from the Stripe Customer Id. As a temporary fix I did the following:\r\n\r\n```\r\n                case \"invoice.payment_succeeded\": // Occurs whenever an invoice attempts to be paid, and the payment succeeds.\r\n                    StripeInvoice stripeInvoice = Stripe.Mapper<StripeInvoice>.MapFromJson(stripeEvent.Data.Object.ToString());\r\n                    Invoice invoice = SaasEcom.Core.Infrastructure.Mappers.Map(stripeInvoice);\r\n                    if (invoice != null && invoice.Total > 0)\r\n                    {\r\n                        // TODO get the customer billing address\r\n                        // get the customer billing address\r\n                        // for now we still have to instantiate the address on the invoice\r\n                        invoice.BillingAddress = new BillingAddress();\r\n                        \r\n                        await InvoiceDataService.CreateOrUpdateAsync(invoice);\r\n\r\n                        // TODO: Send invoice by email\r\n\r\n                    }\r\n                    break;\r\n```\r\n\r\nPersonally I'm not a fan of the dependency on ASP.NET Identity and Entity Framework which is why I probably can't use this library. That said, it's a great point of reference!\r\n"},"comment":{"url":"https://api.github.com/repos/pedropaf/saas-ecom/issues/comments/108149260","html_url":"https://github.com/pedropaf/saas-ecom/issues/8#issuecomment-108149260","issue_url":"https://api.github.com/repos/pedropaf/saas-ecom/issues/8","id":108149260,"user":{"login":"pedropaf","id":1830498,"avatar_url":"https://avatars.githubusercontent.com/u/1830498?v=3","gravatar_id":"","url":"https://api.github.com/users/pedropaf","html_url":"https://github.com/pedropaf","followers_url":"https://api.github.com/users/pedropaf/followers","following_url":"https://api.github.com/users/pedropaf/following{/other_user}","gists_url":"https://api.github.com/users/pedropaf/gists{/gist_id}","starred_url":"https://api.github.com/users/pedropaf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pedropaf/subscriptions","organizations_url":"https://api.github.com/users/pedropaf/orgs","repos_url":"https://api.github.com/users/pedropaf/repos","events_url":"https://api.github.com/users/pedropaf/events{/privacy}","received_events_url":"https://api.github.com/users/pedropaf/received_events","type":"User","site_admin":false},"created_at":"2015-06-03T01:13:31Z","updated_at":"2015-06-03T01:13:31Z","body":"Thanks @benfoster I just added that to the sample, this kind of things probably need to be polished as some people will want different requirements. \r\n\r\nBy the way, aren't you using EF and Identity for Fabrik? Would you suggest to have SaasEcom.Core coded against a more generic abstraction and add another library that would implement the data layer using EF + Identity but leave it open for other implementations if needed?"}}