{"action":"created","issue":{"url":"https://api.github.com/repos/drastik/com.drastikbydesign.stripe/issues/132","repository_url":"https://api.github.com/repos/drastik/com.drastikbydesign.stripe","labels_url":"https://api.github.com/repos/drastik/com.drastikbydesign.stripe/issues/132/labels{/name}","comments_url":"https://api.github.com/repos/drastik/com.drastikbydesign.stripe/issues/132/comments","events_url":"https://api.github.com/repos/drastik/com.drastikbydesign.stripe/issues/132/events","html_url":"https://github.com/drastik/com.drastikbydesign.stripe/pull/132","id":133458094,"number":132,"title":"New feature:  multiple subscriptions per customer.","user":{"login":"h-c-c","id":5252344,"avatar_url":"https://avatars.githubusercontent.com/u/5252344?v=3","gravatar_id":"","url":"https://api.github.com/users/h-c-c","html_url":"https://github.com/h-c-c","followers_url":"https://api.github.com/users/h-c-c/followers","following_url":"https://api.github.com/users/h-c-c/following{/other_user}","gists_url":"https://api.github.com/users/h-c-c/gists{/gist_id}","starred_url":"https://api.github.com/users/h-c-c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/h-c-c/subscriptions","organizations_url":"https://api.github.com/users/h-c-c/orgs","repos_url":"https://api.github.com/users/h-c-c/repos","events_url":"https://api.github.com/users/h-c-c/events{/privacy}","received_events_url":"https://api.github.com/users/h-c-c/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-02-13T18:45:32Z","updated_at":"2016-02-15T20:55:33Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/drastik/com.drastikbydesign.stripe/pulls/132","html_url":"https://github.com/drastik/com.drastikbydesign.stripe/pull/132","diff_url":"https://github.com/drastik/com.drastikbydesign.stripe/pull/132.diff","patch_url":"https://github.com/drastik/com.drastikbydesign.stripe/pull/132.patch"},"body":"and some fixes for a couple other problems.  I use it in production.  NB: You'll be super sad if you try an use this on an existing production install without looking at UPGRADE.txt."},"comment":{"url":"https://api.github.com/repos/drastik/com.drastikbydesign.stripe/issues/comments/184389805","html_url":"https://github.com/drastik/com.drastikbydesign.stripe/pull/132#issuecomment-184389805","issue_url":"https://api.github.com/repos/drastik/com.drastikbydesign.stripe/issues/132","id":184389805,"user":{"login":"BorislavZlatanov","id":3427319,"avatar_url":"https://avatars.githubusercontent.com/u/3427319?v=3","gravatar_id":"","url":"https://api.github.com/users/BorislavZlatanov","html_url":"https://github.com/BorislavZlatanov","followers_url":"https://api.github.com/users/BorislavZlatanov/followers","following_url":"https://api.github.com/users/BorislavZlatanov/following{/other_user}","gists_url":"https://api.github.com/users/BorislavZlatanov/gists{/gist_id}","starred_url":"https://api.github.com/users/BorislavZlatanov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BorislavZlatanov/subscriptions","organizations_url":"https://api.github.com/users/BorislavZlatanov/orgs","repos_url":"https://api.github.com/users/BorislavZlatanov/repos","events_url":"https://api.github.com/users/BorislavZlatanov/events{/privacy}","received_events_url":"https://api.github.com/users/BorislavZlatanov/received_events","type":"User","site_admin":false},"created_at":"2016-02-15T20:55:33Z","updated_at":"2016-02-15T20:55:33Z","body":"Re: 1. Yeah, I tested now I also get \"card declined\". Cool. :)\r\n\r\nRe: 2. Let's test this. When I put a non-existing customer_id in the query parameters so that I have:\r\n\r\n```\r\n\r\n$query_params = array(\r\n  1 => array('blahblah', 'String'),\r\n);\r\n\r\n$rel_info_query = CRM_Core_DAO::executeQuery(\"SELECT invoice_id, end_time\r\n  FROM civicrm_stripe_subscriptions\r\n  WHERE customer_id = %1\",\r\n  $query_params);  \r\n  \r\nif (!empty($rel_info_query)) {\r\n  $rel_info_query->fetch();\r\necho '<pre>';\r\nvar_dump($rel_info_query);\r\necho '</pre>';\r\n  if(!empty($rel_info_query->invoice_id)) {\r\n\t$invoice_id = $rel_info_query->invoice_id;\r\n\t$end_time = $rel_info_query->end_time;\r\n  } else {\r\n\tCRM_Core_Error::Fatal(\"Error relating this customer ($customer_id) to the one in civicrm_stripe_subscriptions\");\r\n\texit();\r\n  }\r\n}\r\n\r\n```\r\n\r\nHere's what I get from the var_dump above with a non-existing customer:\r\n\r\n```\r\n\r\nobject(CRM_Core_DAO)#963 (12) {\r\n  [\"_DB_DataObject_version\"]=>\r\n  string(6) \"1.8.12\"\r\n  [\"__table\"]=>\r\n  NULL\r\n  [\"N\"]=>\r\n  int(0)\r\n  [\"_database_dsn\"]=>\r\n  string(0) \"\"\r\n  [\"_database_dsn_md5\"]=>\r\n  string(32) \"e37733545fb90ac5bdbbc37234basrab\"\r\n  [\"_database\"]=>\r\n  string(17) \"mydb\"\r\n  [\"_query\"]=>\r\n  array(7) {\r\n    [\"condition\"]=>\r\n    string(0) \"\"\r\n    [\"group_by\"]=>\r\n    string(0) \"\"\r\n    [\"order_by\"]=>\r\n    string(0) \"\"\r\n    [\"having\"]=>\r\n    string(0) \"\"\r\n    [\"limit_start\"]=>\r\n    string(0) \"\"\r\n    [\"limit_count\"]=>\r\n    string(0) \"\"\r\n    [\"data_select\"]=>\r\n    string(1) \"*\"\r\n  }\r\n  [\"_DB_resultid\"]=>\r\n  int(8)\r\n  [\"_resultFields\"]=>\r\n  bool(false)\r\n  [\"_link_loaded\"]=>\r\n  bool(false)\r\n  [\"_join\"]=>\r\n  string(0) \"\"\r\n  [\"_lastError\"]=>\r\n  bool(false)\r\n}\r\n\r\n```\r\n\r\nHere's what I get with an existing customer:\r\n\r\n```\r\n\r\nobject(CRM_Core_DAO)#963 (14) {\r\n  [\"_DB_DataObject_version\"]=>\r\n  string(6) \"1.8.12\"\r\n  [\"__table\"]=>\r\n  NULL\r\n  [\"N\"]=>\r\n  int(1)\r\n  [\"_database_dsn\"]=>\r\n  string(0) \"\"\r\n  [\"_database_dsn_md5\"]=>\r\n  string(32) \"e37733545fb90ac5bdbbc37234basrab\"\r\n  [\"_database\"]=>\r\n  string(17) \"mydb\"\r\n  [\"_query\"]=>\r\n  bool(false)\r\n  [\"_DB_resultid\"]=>\r\n  int(8)\r\n  [\"_resultFields\"]=>\r\n  bool(false)\r\n  [\"_link_loaded\"]=>\r\n  bool(false)\r\n  [\"_join\"]=>\r\n  string(0) \"\"\r\n  [\"_lastError\"]=>\r\n  bool(false)\r\n  [\"invoice_id\"]=>\r\n  string(32) \"5bhasn38bmuu66df281cfbec9a6ee\"\r\n  [\"end_time\"]=>\r\n  string(1) \"0\"\r\n}\r\n\r\n```\r\n\r\nSeems that $rel_info_query->invoice_id does not exist if the query doesn't match any customer.\r\n\r\nRe: 3. I just tested this with your code. I made a recurring contribution without having any webhook set up in Stripe.com. And the contribution remains Pending in Civi. In Stripe.com the payment is completed, but in Civi the contribution is Pending. This is what happens on my end. So yeah, I am baffled.\r\n\r\nCan you do the same test and see what happens? Make sure no webhook endpoint is set up on Stripe.com and submit a RECURRING  (not single) contribution. Then see what the contribution status is in Civi. Keep in mind, we are talking about the status in Civi, not in Stripe.com.\r\n\r\nBtw, about `'is_email_receipt' => 1`, I imagine it defaults to true because it sends out email receipts even without providing that argument.\r\n\r\nRe: 4. Hmm. I imagine the Fix Version/s in the Jira issue is incorrect. But anyways, I downloaded 4.6.12 and the patch is in there. \r\n\r\nCheers, buddy. :)"}}