Skip to content

Commit

Permalink
Merge pull request #241 from TakteS/master
Browse files Browse the repository at this point in the history
Add change invoices ability
  • Loading branch information
begedin authored Jul 6, 2017
2 parents 802694c + d89e865 commit 26f2d6a
Show file tree
Hide file tree
Showing 12 changed files with 370 additions and 100 deletions.
36 changes: 36 additions & 0 deletions fixture/vcr_cassettes/invoices_test/change.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[
{
"request": {
"body": "closed=true",
"headers": {
"Authorization": "Bearer STRIPE_SECRET_KEY",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "Stripe/v1 stripity-stripe/1.4.0"
},
"method": "post",
"options": [],
"request_body": "",
"url": "https://api.stripe.com/v1/invoices/in_1Ac79wCM35SG8uZjktE8OgYt"
},
"response": {
"body": "{\n \"id\": \"in_1Ac79wCM35SG8uZjktE8OgYt\",\n \"object\": \"invoice\",\n \"amount_due\": 10,\n \"application_fee\": null,\n \"attempt_count\": 0,\n \"attempted\": false,\n \"charge\": null,\n \"closed\": true,\n \"currency\": \"usd\",\n \"customer\": \"cus_Ay3GqeMIz0WkEm\",\n \"date\": 1499236728,\n \"description\": null,\n \"discount\": null,\n \"ending_balance\": null,\n \"forgiven\": false,\n \"lines\": {\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"ii_1Ac79wCM35SG8uZjg219Etgu\",\n \"object\": \"line_item\",\n \"amount\": 10,\n \"currency\": \"usd\",\n \"description\": null,\n \"discountable\": true,\n \"livemode\": false,\n \"metadata\": {},\n \"period\": {\n \"start\": 1499236728,\n \"end\": 1499236728\n },\n \"plan\": null,\n \"proration\": false,\n \"quantity\": null,\n \"subscription\": \"sub_Ay3GDAbPurf2VP\",\n \"type\": \"invoiceitem\"\n }\n ],\n \"has_more\": false,\n \"total_count\": 1,\n \"url\": \"/v1/invoices/in_1Ac79wCM35SG8uZjktE8OgYt/lines\"\n },\n \"livemode\": false,\n \"metadata\": {\n \"app_order_id\": \"ABC1234\",\n \"app_attr1\": \"xyz1\"\n },\n \"next_payment_attempt\": null,\n \"paid\": false,\n \"period_end\": 1499236728,\n \"period_start\": 1499236727,\n \"receipt_number\": null,\n \"starting_balance\": 0,\n \"statement_descriptor\": null,\n \"subscription\": \"sub_Ay3GDAbPurf2VP\",\n \"subtotal\": 10,\n \"tax\": null,\n \"tax_percent\": null,\n \"total\": 10,\n \"webhooks_delivered_at\": 1499236728\n}\n",
"headers": {
"Server": "nginx",
"Date": "Wed, 05 Jul 2017 06:38:54 GMT",
"Content-Type": "application/json",
"Content-Length": "1457",
"Connection": "keep-alive",
"Access-Control-Allow-Credentials": "true",
"Access-Control-Allow-Methods": "GET, POST, HEAD, OPTIONS, DELETE",
"Access-Control-Allow-Origin": "*",
"Access-Control-Max-Age": "300",
"Cache-Control": "no-cache, no-store",
"Request-Id": "req_Ay3G8KLLy1Yv6X",
"Stripe-Version": "2017-06-05",
"Strict-Transport-Security": "max-age=31556926; includeSubDomains"
},
"status_code": 200,
"type": "ok"
}
}
]
36 changes: 36 additions & 0 deletions fixture/vcr_cassettes/invoices_test/change_with_key.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[
{
"request": {
"body": "description=Some+description&closed=true",
"headers": {
"Authorization": "Bearer STRIPE_SECRET_KEY",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "Stripe/v1 stripity-stripe/1.4.0"
},
"method": "post",
"options": [],
"request_body": "",
"url": "https://api.stripe.com/v1/invoices/in_1Ac79wCM35SG8uZjktE8OgYt"
},
"response": {
"body": "{\n \"id\": \"in_1Ac79wCM35SG8uZjktE8OgYt\",\n \"object\": \"invoice\",\n \"amount_due\": 10,\n \"application_fee\": null,\n \"attempt_count\": 0,\n \"attempted\": false,\n \"charge\": null,\n \"closed\": true,\n \"currency\": \"usd\",\n \"customer\": \"cus_Ay3GqeMIz0WkEm\",\n \"date\": 1499236728,\n \"description\": \"Some description\",\n \"discount\": null,\n \"ending_balance\": null,\n \"forgiven\": false,\n \"lines\": {\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"ii_1Ac79wCM35SG8uZjg219Etgu\",\n \"object\": \"line_item\",\n \"amount\": 10,\n \"currency\": \"usd\",\n \"description\": null,\n \"discountable\": true,\n \"livemode\": false,\n \"metadata\": {},\n \"period\": {\n \"start\": 1499236728,\n \"end\": 1499236728\n },\n \"plan\": null,\n \"proration\": false,\n \"quantity\": null,\n \"subscription\": \"sub_Ay3GDAbPurf2VP\",\n \"type\": \"invoiceitem\"\n }\n ],\n \"has_more\": false,\n \"total_count\": 1,\n \"url\": \"/v1/invoices/in_1Ac79wCM35SG8uZjktE8OgYt/lines\"\n },\n \"livemode\": false,\n \"metadata\": {\n \"app_order_id\": \"ABC1234\",\n \"app_attr1\": \"xyz1\"\n },\n \"next_payment_attempt\": null,\n \"paid\": false,\n \"period_end\": 1499236728,\n \"period_start\": 1499236727,\n \"receipt_number\": null,\n \"starting_balance\": 0,\n \"statement_descriptor\": null,\n \"subscription\": \"sub_Ay3GDAbPurf2VP\",\n \"subtotal\": 10,\n \"tax\": null,\n \"tax_percent\": null,\n \"total\": 10,\n \"webhooks_delivered_at\": 1499236728\n}\n",
"headers": {
"Server": "nginx",
"Date": "Wed, 05 Jul 2017 06:38:54 GMT",
"Content-Type": "application/json",
"Content-Length": "1471",
"Connection": "keep-alive",
"Access-Control-Allow-Credentials": "true",
"Access-Control-Allow-Methods": "GET, POST, HEAD, OPTIONS, DELETE",
"Access-Control-Allow-Origin": "*",
"Access-Control-Max-Age": "300",
"Cache-Control": "no-cache, no-store",
"Request-Id": "req_Ay3GHpvn2KCuEW",
"Stripe-Version": "2017-06-05",
"Strict-Transport-Security": "max-age=31556926; includeSubDomains"
},
"status_code": 200,
"type": "ok"
}
}
]
16 changes: 8 additions & 8 deletions fixture/vcr_cassettes/invoices_test/metadata.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[
{
"request": {
"body": "customer=cus_8r2jCf6wk8YLyU&subscription=sub_8r2j78r42DD6xb&metadata[app_order_id]=ABC123&metadata[app_attr1]=xyz",
"body": "customer=cus_Ay3G4eTAX3FgXd&subscription=sub_Ay3GRYIf5J5VBt&metadata[app_order_id]=ABC123&metadata[app_attr1]=xyz",
"headers": {
"Authorization": "Bearer non_empty_secret_key_string",
"Authorization": "Bearer STRIPE_SECRET_KEY",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "Stripe/v1 stripity-stripe/1.4.0"
},
Expand All @@ -13,24 +13,24 @@
"url": "https://api.stripe.com/v1/invoices"
},
"response": {
"body": "{\n \"id\": \"in_8r2jKmLwYMLHlI\",\n \"object\": \"invoice\",\n \"amount_due\": 10,\n \"application_fee\": null,\n \"attempt_count\": 0,\n \"attempted\": false,\n \"charge\": null,\n \"closed\": false,\n \"currency\": \"usd\",\n \"customer\": \"cus_8r2jCf6wk8YLyU\",\n \"date\": 1469020927,\n \"description\": null,\n \"discount\": null,\n \"ending_balance\": null,\n \"forgiven\": false,\n \"lines\": {\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"ii_8r2jQGLNFUFPyj\",\n \"object\": \"line_item\",\n \"amount\": 10,\n \"currency\": \"usd\",\n \"description\": null,\n \"discountable\": true,\n \"livemode\": false,\n \"metadata\": {},\n \"period\": {\n \"start\": 1469020927,\n \"end\": 1469020927\n },\n \"plan\": null,\n \"proration\": false,\n \"quantity\": null,\n \"subscription\": \"sub_8r2j78r42DD6xb\",\n \"type\": \"invoiceitem\"\n }\n ],\n \"has_more\": false,\n \"total_count\": 1,\n \"url\": \"/v1/invoices/in_8r2jKmLwYMLHlI/lines\"\n },\n \"livemode\": false,\n \"metadata\": {\n \"app_order_id\": \"ABC123\",\n \"app_attr1\": \"xyz\"\n },\n \"next_payment_attempt\": 1469024527,\n \"paid\": false,\n \"period_end\": 1469020927,\n \"period_start\": 1469020924,\n \"receipt_number\": null,\n \"starting_balance\": 0,\n \"statement_descriptor\": null,\n \"subscription\": \"sub_8r2j78r42DD6xb\",\n \"subtotal\": 10,\n \"tax\": null,\n \"tax_percent\": null,\n \"total\": 10,\n \"webhooks_delivered_at\": null\n}\n",
"body": "{\n \"id\": \"in_1Ac79xCM35SG8uZj5FxDwLZH\",\n \"object\": \"invoice\",\n \"amount_due\": 10,\n \"application_fee\": null,\n \"attempt_count\": 0,\n \"attempted\": false,\n \"charge\": null,\n \"closed\": false,\n \"currency\": \"usd\",\n \"customer\": \"cus_Ay3G4eTAX3FgXd\",\n \"date\": 1499236729,\n \"description\": null,\n \"discount\": null,\n \"ending_balance\": null,\n \"forgiven\": false,\n \"lines\": {\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"ii_1Ac79uCM35SG8uZjpj88VkZX\",\n \"object\": \"line_item\",\n \"amount\": 10,\n \"currency\": \"usd\",\n \"description\": null,\n \"discountable\": true,\n \"livemode\": false,\n \"metadata\": {},\n \"period\": {\n \"start\": 1499236726,\n \"end\": 1499236726\n },\n \"plan\": null,\n \"proration\": false,\n \"quantity\": null,\n \"subscription\": \"sub_Ay3GRYIf5J5VBt\",\n \"type\": \"invoiceitem\"\n }\n ],\n \"has_more\": false,\n \"total_count\": 1,\n \"url\": \"/v1/invoices/in_1Ac79xCM35SG8uZj5FxDwLZH/lines\"\n },\n \"livemode\": false,\n \"metadata\": {\n \"app_order_id\": \"ABC123\",\n \"app_attr1\": \"xyz\"\n },\n \"next_payment_attempt\": 1499240329,\n \"paid\": false,\n \"period_end\": 1499236729,\n \"period_start\": 1499236725,\n \"receipt_number\": null,\n \"starting_balance\": 0,\n \"statement_descriptor\": null,\n \"subscription\": \"sub_Ay3GRYIf5J5VBt\",\n \"subtotal\": 10,\n \"tax\": null,\n \"tax_percent\": null,\n \"total\": 10,\n \"webhooks_delivered_at\": null\n}\n",
"headers": {
"Server": "nginx",
"Date": "Wed, 20 Jul 2016 13:22:07 GMT",
"Date": "Wed, 05 Jul 2017 06:38:49 GMT",
"Content-Type": "application/json",
"Content-Length": "1426",
"Content-Length": "1456",
"Connection": "keep-alive",
"Access-Control-Allow-Credentials": "true",
"Access-Control-Allow-Methods": "GET, POST, HEAD, OPTIONS, DELETE",
"Access-Control-Allow-Origin": "*",
"Access-Control-Max-Age": "300",
"Cache-Control": "no-cache, no-store",
"Request-Id": "req_8r2jNGytTMKD07",
"Stripe-Version": "2016-07-06",
"Request-Id": "req_Ay3GJVxOOUjn60",
"Stripe-Version": "2017-06-05",
"Strict-Transport-Security": "max-age=31556926; includeSubDomains"
},
"status_code": 200,
"type": "ok"
}
}
]
]
Loading

0 comments on commit 26f2d6a

Please sign in to comment.