From d103779de312f21d442b00a0d5af20c73fe37e4f Mon Sep 17 00:00:00 2001 From: Ivan Santos Date: Sun, 8 May 2016 15:34:20 -0700 Subject: [PATCH] ChargeTest with request vcr mock --- .../vcr_cassettes/stripe_charge_capture.json | 70 +++++++++ .../stripe_charge_capture_w_key.json | 70 +++++++++ .../vcr_cassettes/stripe_charge_create.json | 36 +++++ .../stripe_charge_create_w_key.json | 36 +++++ fixture/vcr_cassettes/stripe_charge_get.json | 70 +++++++++ .../stripe_charge_get_w_key.json | 70 +++++++++ fixture/vcr_cassettes/stripe_charge_list.json | 36 +++++ .../stripe_charge_list_w_keys.json | 36 +++++ .../vcr_cassettes/stripe_charge_refund.json | 70 +++++++++ .../stripe_charge_refund_w_key.json | 70 +++++++++ .../vcr_cassettes/stripe_charge_update.json | 70 +++++++++ .../stripe_charge_update_w_key.json | 70 +++++++++ test/stripe/charge_test.exs | 133 +++++++++++------- 13 files changed, 785 insertions(+), 52 deletions(-) create mode 100644 fixture/vcr_cassettes/stripe_charge_capture.json create mode 100644 fixture/vcr_cassettes/stripe_charge_capture_w_key.json create mode 100644 fixture/vcr_cassettes/stripe_charge_create.json create mode 100644 fixture/vcr_cassettes/stripe_charge_create_w_key.json create mode 100644 fixture/vcr_cassettes/stripe_charge_get.json create mode 100644 fixture/vcr_cassettes/stripe_charge_get_w_key.json create mode 100644 fixture/vcr_cassettes/stripe_charge_list.json create mode 100644 fixture/vcr_cassettes/stripe_charge_list_w_keys.json create mode 100644 fixture/vcr_cassettes/stripe_charge_refund.json create mode 100644 fixture/vcr_cassettes/stripe_charge_refund_w_key.json create mode 100644 fixture/vcr_cassettes/stripe_charge_update.json create mode 100644 fixture/vcr_cassettes/stripe_charge_update_w_key.json diff --git a/fixture/vcr_cassettes/stripe_charge_capture.json b/fixture/vcr_cassettes/stripe_charge_capture.json new file mode 100644 index 00000000..0741cd04 --- /dev/null +++ b/fixture/vcr_cassettes/stripe_charge_capture.json @@ -0,0 +1,70 @@ +[ + { + "request": { + "body": "amount=1000¤cy=USD&capture=false&source[object]=card&source[number]=4111111111111111&source[exp_month]=10&source[exp_year]=2020&source[country]=US&source[name]=Ducky Test&source[cvc]=123&description=1000%20Widgets", + "headers": { + "Authorization": "Bearer sk_test_Gwo3dv3LVt9d51pEppopW08N", + "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/charges" + }, + "response": { + "body": "{\n \"id\": \"ch_1890RTEG8ShdlEc4XSbQOPZx\",\n \"object\": \"charge\",\n \"amount\": 1000,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": null,\n \"captured\": false,\n \"card\": {\n \"id\": \"card_1890RTEG8ShdlEc4nghqnj3D\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746723,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"1000 Widgets\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1890RTEG8ShdlEc4XSbQOPZx/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890RTEG8ShdlEc4nghqnj3D\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n}\n", + "headers": { + "Server": "nginx", + "Date": "Sun, 08 May 2016 22:32:03 GMT", + "Content-Type": "application/json", + "Content-Length": "2088", + "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_8Pq7xEWxLsI4mc", + "Stripe-Version": "2015-01-11", + "Strict-Transport-Security": "max-age=31556926; includeSubDomains" + }, + "status_code": 200, + "type": "ok" + } + }, + { + "request": { + "body": "", + "headers": { + "Authorization": "Bearer sk_test_Gwo3dv3LVt9d51pEppopW08N", + "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/charges/ch_1890RTEG8ShdlEc4XSbQOPZx/capture" + }, + "response": { + "body": "{\n \"id\": \"ch_1890RTEG8ShdlEc4XSbQOPZx\",\n \"object\": \"charge\",\n \"amount\": 1000,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890RTEG8ShdlEc4bWtOYmqs\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890RTEG8ShdlEc4nghqnj3D\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746723,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"1000 Widgets\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1890RTEG8ShdlEc4XSbQOPZx/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890RTEG8ShdlEc4nghqnj3D\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n}\n", + "headers": { + "Server": "nginx", + "Date": "Sun, 08 May 2016 22:32:04 GMT", + "Content-Type": "application/json", + "Content-Length": "2113", + "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_8Pq7D8JsHOclet", + "Stripe-Version": "2015-01-11", + "Strict-Transport-Security": "max-age=31556926; includeSubDomains" + }, + "status_code": 200, + "type": "ok" + } + } +] \ No newline at end of file diff --git a/fixture/vcr_cassettes/stripe_charge_capture_w_key.json b/fixture/vcr_cassettes/stripe_charge_capture_w_key.json new file mode 100644 index 00000000..4b7ba561 --- /dev/null +++ b/fixture/vcr_cassettes/stripe_charge_capture_w_key.json @@ -0,0 +1,70 @@ +[ + { + "request": { + "body": "amount=1000¤cy=USD&capture=false&source[object]=card&source[number]=4111111111111111&source[exp_month]=10&source[exp_year]=2020&source[country]=US&source[name]=Ducky Test&source[cvc]=123&description=1000%20Widgets", + "headers": { + "Authorization": "Bearer sk_test_Gwo3dv3LVt9d51pEppopW08N", + "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/charges" + }, + "response": { + "body": "{\n \"id\": \"ch_1890RUEG8ShdlEc4a1G9mkmP\",\n \"object\": \"charge\",\n \"amount\": 1000,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": null,\n \"captured\": false,\n \"card\": {\n \"id\": \"card_1890RUEG8ShdlEc4DlD4P2GA\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746724,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"1000 Widgets\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1890RUEG8ShdlEc4a1G9mkmP/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890RUEG8ShdlEc4DlD4P2GA\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n}\n", + "headers": { + "Server": "nginx", + "Date": "Sun, 08 May 2016 22:32:04 GMT", + "Content-Type": "application/json", + "Content-Length": "2088", + "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_8Pq7bu5kpy67qi", + "Stripe-Version": "2015-01-11", + "Strict-Transport-Security": "max-age=31556926; includeSubDomains" + }, + "status_code": 200, + "type": "ok" + } + }, + { + "request": { + "body": "", + "headers": { + "Authorization": "Bearer sk_test_Gwo3dv3LVt9d51pEppopW08N", + "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/charges/ch_1890RUEG8ShdlEc4a1G9mkmP/capture" + }, + "response": { + "body": "{\n \"id\": \"ch_1890RUEG8ShdlEc4a1G9mkmP\",\n \"object\": \"charge\",\n \"amount\": 1000,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890RUEG8ShdlEc4cUkIr3qr\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890RUEG8ShdlEc4DlD4P2GA\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746724,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"1000 Widgets\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1890RUEG8ShdlEc4a1G9mkmP/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890RUEG8ShdlEc4DlD4P2GA\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n}\n", + "headers": { + "Server": "nginx", + "Date": "Sun, 08 May 2016 22:32:04 GMT", + "Content-Type": "application/json", + "Content-Length": "2113", + "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_8Pq7mdEntE1gEH", + "Stripe-Version": "2015-01-11", + "Strict-Transport-Security": "max-age=31556926; includeSubDomains" + }, + "status_code": 200, + "type": "ok" + } + } +] \ No newline at end of file diff --git a/fixture/vcr_cassettes/stripe_charge_create.json b/fixture/vcr_cassettes/stripe_charge_create.json new file mode 100644 index 00000000..ccd4f309 --- /dev/null +++ b/fixture/vcr_cassettes/stripe_charge_create.json @@ -0,0 +1,36 @@ +[ + { + "request": { + "body": "amount=1000¤cy=USD&source[object]=card&source[number]=4111111111111111&source[exp_month]=10&source[exp_year]=2020&source[country]=US&source[name]=Ducky Test&source[cvc]=123&description=1000%20Widgets", + "headers": { + "Authorization": "Bearer sk_test_Gwo3dv3LVt9d51pEppopW08N", + "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/charges" + }, + "response": { + "body": "{\n \"id\": \"ch_1890RQEG8ShdlEc4cZwY5Vlv\",\n \"object\": \"charge\",\n \"amount\": 1000,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890RREG8ShdlEc4trAls0Jl\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890RQEG8ShdlEc4Y1T3Dma3\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746720,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"1000 Widgets\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1890RQEG8ShdlEc4cZwY5Vlv/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890RQEG8ShdlEc4Y1T3Dma3\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n}\n", + "headers": { + "Server": "nginx", + "Date": "Sun, 08 May 2016 22:32:01 GMT", + "Content-Type": "application/json", + "Content-Length": "2113", + "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_8Pq7FGmOlNM4Vb", + "Stripe-Version": "2015-01-11", + "Strict-Transport-Security": "max-age=31556926; includeSubDomains" + }, + "status_code": 200, + "type": "ok" + } + } +] \ No newline at end of file diff --git a/fixture/vcr_cassettes/stripe_charge_create_w_key.json b/fixture/vcr_cassettes/stripe_charge_create_w_key.json new file mode 100644 index 00000000..23e8ac29 --- /dev/null +++ b/fixture/vcr_cassettes/stripe_charge_create_w_key.json @@ -0,0 +1,36 @@ +[ + { + "request": { + "body": "amount=1000¤cy=USD&source[object]=card&source[number]=4111111111111111&source[exp_month]=10&source[exp_year]=2020&source[country]=US&source[name]=Ducky Test&source[cvc]=123&description=1000%20Widgets", + "headers": { + "Authorization": "Bearer sk_test_Gwo3dv3LVt9d51pEppopW08N", + "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/charges" + }, + "response": { + "body": "{\n \"id\": \"ch_1890RREG8ShdlEc4WQvP7evQ\",\n \"object\": \"charge\",\n \"amount\": 1000,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890RREG8ShdlEc4y4ncsK5h\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890RREG8ShdlEc4XaBsHQj1\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746721,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"1000 Widgets\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1890RREG8ShdlEc4WQvP7evQ/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890RREG8ShdlEc4XaBsHQj1\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n}\n", + "headers": { + "Server": "nginx", + "Date": "Sun, 08 May 2016 22:32:01 GMT", + "Content-Type": "application/json", + "Content-Length": "2113", + "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_8Pq7YTDFVdE1V7", + "Stripe-Version": "2015-01-11", + "Strict-Transport-Security": "max-age=31556926; includeSubDomains" + }, + "status_code": 200, + "type": "ok" + } + } +] \ No newline at end of file diff --git a/fixture/vcr_cassettes/stripe_charge_get.json b/fixture/vcr_cassettes/stripe_charge_get.json new file mode 100644 index 00000000..98bc78e0 --- /dev/null +++ b/fixture/vcr_cassettes/stripe_charge_get.json @@ -0,0 +1,70 @@ +[ + { + "request": { + "body": "", + "headers": { + "Authorization": "Bearer sk_test_Gwo3dv3LVt9d51pEppopW08N", + "Content-Type": "application/x-www-form-urlencoded", + "User-Agent": "Stripe/v1 stripity-stripe/1.4.0" + }, + "method": "get", + "options": [], + "request_body": "", + "url": "https://api.stripe.com/v1/charges?limit=10" + }, + "response": { + "body": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"ch_1890RREG8ShdlEc4WQvP7evQ\",\n \"object\": \"charge\",\n \"amount\": 1000,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890RREG8ShdlEc4y4ncsK5h\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890RREG8ShdlEc4XaBsHQj1\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746721,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"1000 Widgets\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1890RREG8ShdlEc4WQvP7evQ/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890RREG8ShdlEc4XaBsHQj1\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n },\n {\n \"id\": \"ch_1890RQEG8ShdlEc4cZwY5Vlv\",\n \"object\": \"charge\",\n \"amount\": 1000,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890RREG8ShdlEc4trAls0Jl\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890RQEG8ShdlEc4Y1T3Dma3\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746720,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"1000 Widgets\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1890RQEG8ShdlEc4cZwY5Vlv/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890RQEG8ShdlEc4Y1T3Dma3\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n },\n {\n \"id\": \"ch_1890QWEG8ShdlEc4nE3rop0E\",\n \"object\": \"charge\",\n \"amount\": 1000,\n \"amount_refunded\": 500,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890QWEG8ShdlEc4Igbk67XW\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890QWEG8ShdlEc4RDzUW0dH\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746664,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"1000 Widgets\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"re_1890QWEG8ShdlEc4y1LuAI7J\",\n \"object\": \"refund\",\n \"amount\": 500,\n \"balance_transaction\": \"txn_1890QXEG8ShdlEc4nmbqAhG6\",\n \"charge\": \"ch_1890QWEG8ShdlEc4nE3rop0E\",\n \"created\": 1462746664,\n \"currency\": \"usd\",\n \"metadata\": {},\n \"reason\": null,\n \"receipt_number\": null,\n \"status\": \"succeeded\"\n }\n ],\n \"has_more\": false,\n \"total_count\": 1,\n \"url\": \"/v1/charges/ch_1890QWEG8ShdlEc4nE3rop0E/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890QWEG8ShdlEc4RDzUW0dH\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n },\n {\n \"id\": \"ch_1890QWEG8ShdlEc4c3YQ1r2X\",\n \"object\": \"charge\",\n \"amount\": 1000,\n \"amount_refunded\": 500,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890QWEG8ShdlEc4fTvTgmcj\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890QWEG8ShdlEc4EOvlZab8\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746664,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"1000 Widgets\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"re_1890QWEG8ShdlEc4Z0ykavyx\",\n \"object\": \"refund\",\n \"amount\": 500,\n \"balance_transaction\": \"txn_1890QWEG8ShdlEc4LZoEbHaf\",\n \"charge\": \"ch_1890QWEG8ShdlEc4c3YQ1r2X\",\n \"created\": 1462746664,\n \"currency\": \"usd\",\n \"metadata\": {},\n \"reason\": null,\n \"receipt_number\": null,\n \"status\": \"succeeded\"\n }\n ],\n \"has_more\": false,\n \"total_count\": 1,\n \"url\": \"/v1/charges/ch_1890QWEG8ShdlEc4c3YQ1r2X/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890QWEG8ShdlEc4EOvlZab8\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n },\n {\n \"id\": \"ch_1890QVEG8ShdlEc4IxaUpqSx\",\n \"object\": \"charge\",\n \"amount\": 1000,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890QVEG8ShdlEc4VLGieM87\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890QVEG8ShdlEc4qnBIihOg\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746663,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"Changed charge\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1890QVEG8ShdlEc4IxaUpqSx/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890QVEG8ShdlEc4qnBIihOg\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n },\n {\n \"id\": \"ch_1890QUEG8ShdlEc4PwzNrcTW\",\n \"object\": \"charge\",\n \"amount\": 1000,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890QUEG8ShdlEc4McJHWScN\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890QUEG8ShdlEc4ijIDqwK9\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746662,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"1000 Widgets\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1890QUEG8ShdlEc4PwzNrcTW/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890QUEG8ShdlEc4ijIDqwK9\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n },\n {\n \"id\": \"ch_1890QUEG8ShdlEc41EaHIFDE\",\n \"object\": \"charge\",\n \"amount\": 1000,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890QUEG8ShdlEc4A2i3g1Fw\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890QTEG8ShdlEc49RodoLKJ\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746662,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"1000 Widgets\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1890QUEG8ShdlEc41EaHIFDE/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890QTEG8ShdlEc49RodoLKJ\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n },\n {\n \"id\": \"ch_1890QSEG8ShdlEc41aJZ3NTI\",\n \"object\": \"charge\",\n \"amount\": 1000,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890QSEG8ShdlEc4VPSswvgq\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890QSEG8ShdlEc4mS5Hq0c1\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746660,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"1000 Widgets\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1890QSEG8ShdlEc41aJZ3NTI/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890QSEG8ShdlEc4mS5Hq0c1\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n },\n {\n \"id\": \"ch_1890QREG8ShdlEc4u3jFtGnw\",\n \"object\": \"charge\",\n \"amount\": 1000,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890QREG8ShdlEc4dxuoXMyf\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890QREG8ShdlEc44WeIWCU1\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746659,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"1000 Widgets\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1890QREG8ShdlEc4u3jFtGnw/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890QREG8ShdlEc44WeIWCU1\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n },\n {\n \"id\": \"ch_1881j8EG8ShdlEc4cFI86vaC\",\n \"object\": \"charge\",\n \"amount\": 100,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1881j8EG8ShdlEc4IyGM0C3x\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1881j1EG8ShdlEc4X20CnvPm\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": \"cus_8OpNtQFKErqGos\",\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 1,\n \"exp_year\": 2018,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Joe Test User\",\n \"tokenization_method\": null\n },\n \"created\": 1462513334,\n \"currency\": \"usd\",\n \"customer\": \"cus_8OpNtQFKErqGos\",\n \"description\": null,\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": \"in_1881j8EG8ShdlEc4bPtcp9T5\",\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1881j8EG8ShdlEc4cFI86vaC/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1881j1EG8ShdlEc4X20CnvPm\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": \"cus_8OpNtQFKErqGos\",\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 1,\n \"exp_year\": 2018,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Joe Test User\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n }\n ],\n \"has_more\": true,\n \"url\": \"/v1/charges\"\n}\n", + "headers": { + "Server": "nginx", + "Date": "Sun, 08 May 2016 22:32:02 GMT", + "Content-Type": "application/json", + "Content-Length": "25681", + "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_8Pq7Iu6Qoqvksr", + "Stripe-Version": "2015-01-11", + "Strict-Transport-Security": "max-age=31556926; includeSubDomains" + }, + "status_code": 200, + "type": "ok" + } + }, + { + "request": { + "body": "", + "headers": { + "Authorization": "Bearer sk_test_Gwo3dv3LVt9d51pEppopW08N", + "Content-Type": "application/x-www-form-urlencoded", + "User-Agent": "Stripe/v1 stripity-stripe/1.4.0" + }, + "method": "get", + "options": [], + "request_body": "", + "url": "https://api.stripe.com/v1/charges/ch_1890RREG8ShdlEc4WQvP7evQ" + }, + "response": { + "body": "{\n \"id\": \"ch_1890RREG8ShdlEc4WQvP7evQ\",\n \"object\": \"charge\",\n \"amount\": 1000,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890RREG8ShdlEc4y4ncsK5h\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890RREG8ShdlEc4XaBsHQj1\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746721,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"1000 Widgets\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1890RREG8ShdlEc4WQvP7evQ/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890RREG8ShdlEc4XaBsHQj1\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n}\n", + "headers": { + "Server": "nginx", + "Date": "Sun, 08 May 2016 22:32:03 GMT", + "Content-Type": "application/json", + "Content-Length": "2113", + "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_8Pq7OhL6dpLzN2", + "Stripe-Version": "2015-01-11", + "Strict-Transport-Security": "max-age=31556926; includeSubDomains" + }, + "status_code": 200, + "type": "ok" + } + } +] \ No newline at end of file diff --git a/fixture/vcr_cassettes/stripe_charge_get_w_key.json b/fixture/vcr_cassettes/stripe_charge_get_w_key.json new file mode 100644 index 00000000..0e909d36 --- /dev/null +++ b/fixture/vcr_cassettes/stripe_charge_get_w_key.json @@ -0,0 +1,70 @@ +[ + { + "request": { + "body": "", + "headers": { + "Authorization": "Bearer sk_test_Gwo3dv3LVt9d51pEppopW08N", + "Content-Type": "application/x-www-form-urlencoded", + "User-Agent": "Stripe/v1 stripity-stripe/1.4.0" + }, + "method": "get", + "options": [], + "request_body": "", + "url": "https://api.stripe.com/v1/charges?limit=1" + }, + "response": { + "body": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"ch_1890RREG8ShdlEc4WQvP7evQ\",\n \"object\": \"charge\",\n \"amount\": 1000,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890RREG8ShdlEc4y4ncsK5h\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890RREG8ShdlEc4XaBsHQj1\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746721,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"1000 Widgets\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1890RREG8ShdlEc4WQvP7evQ/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890RREG8ShdlEc4XaBsHQj1\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n }\n ],\n \"has_more\": true,\n \"url\": \"/v1/charges\"\n}\n", + "headers": { + "Server": "nginx", + "Date": "Sun, 08 May 2016 22:32:03 GMT", + "Content-Type": "application/json", + "Content-Length": "2545", + "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_8Pq7elt4LtzYs2", + "Stripe-Version": "2015-01-11", + "Strict-Transport-Security": "max-age=31556926; includeSubDomains" + }, + "status_code": 200, + "type": "ok" + } + }, + { + "request": { + "body": "", + "headers": { + "Authorization": "Bearer sk_test_Gwo3dv3LVt9d51pEppopW08N", + "Content-Type": "application/x-www-form-urlencoded", + "User-Agent": "Stripe/v1 stripity-stripe/1.4.0" + }, + "method": "get", + "options": [], + "request_body": "", + "url": "https://api.stripe.com/v1/charges/ch_1890RREG8ShdlEc4WQvP7evQ" + }, + "response": { + "body": "{\n \"id\": \"ch_1890RREG8ShdlEc4WQvP7evQ\",\n \"object\": \"charge\",\n \"amount\": 1000,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890RREG8ShdlEc4y4ncsK5h\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890RREG8ShdlEc4XaBsHQj1\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746721,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"1000 Widgets\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1890RREG8ShdlEc4WQvP7evQ/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890RREG8ShdlEc4XaBsHQj1\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n}\n", + "headers": { + "Server": "nginx", + "Date": "Sun, 08 May 2016 22:32:03 GMT", + "Content-Type": "application/json", + "Content-Length": "2113", + "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_8Pq7TJXAnv9s97", + "Stripe-Version": "2015-01-11", + "Strict-Transport-Security": "max-age=31556926; includeSubDomains" + }, + "status_code": 200, + "type": "ok" + } + } +] \ No newline at end of file diff --git a/fixture/vcr_cassettes/stripe_charge_list.json b/fixture/vcr_cassettes/stripe_charge_list.json new file mode 100644 index 00000000..8db46cad --- /dev/null +++ b/fixture/vcr_cassettes/stripe_charge_list.json @@ -0,0 +1,36 @@ +[ + { + "request": { + "body": "", + "headers": { + "Authorization": "Bearer sk_test_Gwo3dv3LVt9d51pEppopW08N", + "Content-Type": "application/x-www-form-urlencoded", + "User-Agent": "Stripe/v1 stripity-stripe/1.4.0" + }, + "method": "get", + "options": [], + "request_body": "", + "url": "https://api.stripe.com/v1/charges?limit=10" + }, + "response": { + "body": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"ch_1890RREG8ShdlEc4WQvP7evQ\",\n \"object\": \"charge\",\n \"amount\": 1000,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890RREG8ShdlEc4y4ncsK5h\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890RREG8ShdlEc4XaBsHQj1\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746721,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"1000 Widgets\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1890RREG8ShdlEc4WQvP7evQ/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890RREG8ShdlEc4XaBsHQj1\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n },\n {\n \"id\": \"ch_1890RQEG8ShdlEc4cZwY5Vlv\",\n \"object\": \"charge\",\n \"amount\": 1000,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890RREG8ShdlEc4trAls0Jl\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890RQEG8ShdlEc4Y1T3Dma3\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746720,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"1000 Widgets\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1890RQEG8ShdlEc4cZwY5Vlv/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890RQEG8ShdlEc4Y1T3Dma3\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n },\n {\n \"id\": \"ch_1890QWEG8ShdlEc4nE3rop0E\",\n \"object\": \"charge\",\n \"amount\": 1000,\n \"amount_refunded\": 500,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890QWEG8ShdlEc4Igbk67XW\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890QWEG8ShdlEc4RDzUW0dH\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746664,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"1000 Widgets\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"re_1890QWEG8ShdlEc4y1LuAI7J\",\n \"object\": \"refund\",\n \"amount\": 500,\n \"balance_transaction\": \"txn_1890QXEG8ShdlEc4nmbqAhG6\",\n \"charge\": \"ch_1890QWEG8ShdlEc4nE3rop0E\",\n \"created\": 1462746664,\n \"currency\": \"usd\",\n \"metadata\": {},\n \"reason\": null,\n \"receipt_number\": null,\n \"status\": \"succeeded\"\n }\n ],\n \"has_more\": false,\n \"total_count\": 1,\n \"url\": \"/v1/charges/ch_1890QWEG8ShdlEc4nE3rop0E/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890QWEG8ShdlEc4RDzUW0dH\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n },\n {\n \"id\": \"ch_1890QWEG8ShdlEc4c3YQ1r2X\",\n \"object\": \"charge\",\n \"amount\": 1000,\n \"amount_refunded\": 500,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890QWEG8ShdlEc4fTvTgmcj\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890QWEG8ShdlEc4EOvlZab8\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746664,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"1000 Widgets\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"re_1890QWEG8ShdlEc4Z0ykavyx\",\n \"object\": \"refund\",\n \"amount\": 500,\n \"balance_transaction\": \"txn_1890QWEG8ShdlEc4LZoEbHaf\",\n \"charge\": \"ch_1890QWEG8ShdlEc4c3YQ1r2X\",\n \"created\": 1462746664,\n \"currency\": \"usd\",\n \"metadata\": {},\n \"reason\": null,\n \"receipt_number\": null,\n \"status\": \"succeeded\"\n }\n ],\n \"has_more\": false,\n \"total_count\": 1,\n \"url\": \"/v1/charges/ch_1890QWEG8ShdlEc4c3YQ1r2X/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890QWEG8ShdlEc4EOvlZab8\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n },\n {\n \"id\": \"ch_1890QVEG8ShdlEc4IxaUpqSx\",\n \"object\": \"charge\",\n \"amount\": 1000,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890QVEG8ShdlEc4VLGieM87\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890QVEG8ShdlEc4qnBIihOg\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746663,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"Changed charge\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1890QVEG8ShdlEc4IxaUpqSx/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890QVEG8ShdlEc4qnBIihOg\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n },\n {\n \"id\": \"ch_1890QUEG8ShdlEc4PwzNrcTW\",\n \"object\": \"charge\",\n \"amount\": 1000,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890QUEG8ShdlEc4McJHWScN\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890QUEG8ShdlEc4ijIDqwK9\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746662,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"1000 Widgets\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1890QUEG8ShdlEc4PwzNrcTW/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890QUEG8ShdlEc4ijIDqwK9\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n },\n {\n \"id\": \"ch_1890QUEG8ShdlEc41EaHIFDE\",\n \"object\": \"charge\",\n \"amount\": 1000,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890QUEG8ShdlEc4A2i3g1Fw\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890QTEG8ShdlEc49RodoLKJ\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746662,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"1000 Widgets\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1890QUEG8ShdlEc41EaHIFDE/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890QTEG8ShdlEc49RodoLKJ\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n },\n {\n \"id\": \"ch_1890QSEG8ShdlEc41aJZ3NTI\",\n \"object\": \"charge\",\n \"amount\": 1000,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890QSEG8ShdlEc4VPSswvgq\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890QSEG8ShdlEc4mS5Hq0c1\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746660,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"1000 Widgets\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1890QSEG8ShdlEc41aJZ3NTI/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890QSEG8ShdlEc4mS5Hq0c1\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n },\n {\n \"id\": \"ch_1890QREG8ShdlEc4u3jFtGnw\",\n \"object\": \"charge\",\n \"amount\": 1000,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890QREG8ShdlEc4dxuoXMyf\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890QREG8ShdlEc44WeIWCU1\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746659,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"1000 Widgets\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1890QREG8ShdlEc4u3jFtGnw/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890QREG8ShdlEc44WeIWCU1\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n },\n {\n \"id\": \"ch_1881j8EG8ShdlEc4cFI86vaC\",\n \"object\": \"charge\",\n \"amount\": 100,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1881j8EG8ShdlEc4IyGM0C3x\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1881j1EG8ShdlEc4X20CnvPm\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": \"cus_8OpNtQFKErqGos\",\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 1,\n \"exp_year\": 2018,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Joe Test User\",\n \"tokenization_method\": null\n },\n \"created\": 1462513334,\n \"currency\": \"usd\",\n \"customer\": \"cus_8OpNtQFKErqGos\",\n \"description\": null,\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": \"in_1881j8EG8ShdlEc4bPtcp9T5\",\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1881j8EG8ShdlEc4cFI86vaC/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1881j1EG8ShdlEc4X20CnvPm\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": \"cus_8OpNtQFKErqGos\",\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 1,\n \"exp_year\": 2018,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Joe Test User\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n }\n ],\n \"has_more\": true,\n \"url\": \"/v1/charges\"\n}\n", + "headers": { + "Server": "nginx", + "Date": "Sun, 08 May 2016 22:32:02 GMT", + "Content-Type": "application/json", + "Content-Length": "25681", + "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_8Pq7HHACZgotx1", + "Stripe-Version": "2015-01-11", + "Strict-Transport-Security": "max-age=31556926; includeSubDomains" + }, + "status_code": 200, + "type": "ok" + } + } +] \ No newline at end of file diff --git a/fixture/vcr_cassettes/stripe_charge_list_w_keys.json b/fixture/vcr_cassettes/stripe_charge_list_w_keys.json new file mode 100644 index 00000000..3ecc4f78 --- /dev/null +++ b/fixture/vcr_cassettes/stripe_charge_list_w_keys.json @@ -0,0 +1,36 @@ +[ + { + "request": { + "body": "", + "headers": { + "Authorization": "Bearer sk_test_Gwo3dv3LVt9d51pEppopW08N", + "Content-Type": "application/x-www-form-urlencoded", + "User-Agent": "Stripe/v1 stripity-stripe/1.4.0" + }, + "method": "get", + "options": [], + "request_body": "", + "url": "https://api.stripe.com/v1/charges?limit=1" + }, + "response": { + "body": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"ch_1890RREG8ShdlEc4WQvP7evQ\",\n \"object\": \"charge\",\n \"amount\": 1000,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890RREG8ShdlEc4y4ncsK5h\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890RREG8ShdlEc4XaBsHQj1\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746721,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"1000 Widgets\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1890RREG8ShdlEc4WQvP7evQ/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890RREG8ShdlEc4XaBsHQj1\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n }\n ],\n \"has_more\": true,\n \"url\": \"/v1/charges\"\n}\n", + "headers": { + "Server": "nginx", + "Date": "Sun, 08 May 2016 22:32:02 GMT", + "Content-Type": "application/json", + "Content-Length": "2545", + "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_8Pq7lYXHjVCExY", + "Stripe-Version": "2015-01-11", + "Strict-Transport-Security": "max-age=31556926; includeSubDomains" + }, + "status_code": 200, + "type": "ok" + } + } +] \ No newline at end of file diff --git a/fixture/vcr_cassettes/stripe_charge_refund.json b/fixture/vcr_cassettes/stripe_charge_refund.json new file mode 100644 index 00000000..466e89d5 --- /dev/null +++ b/fixture/vcr_cassettes/stripe_charge_refund.json @@ -0,0 +1,70 @@ +[ + { + "request": { + "body": "amount=3000¤cy=USD&source[object]=card&source[number]=4111111111111111&source[exp_month]=10&source[exp_year]=2020&source[country]=US&source[name]=Ducky Test&source[cvc]=123&description=1000%20Widgets", + "headers": { + "Authorization": "Bearer sk_test_Gwo3dv3LVt9d51pEppopW08N", + "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/charges" + }, + "response": { + "body": "{\n \"id\": \"ch_1890RVEG8ShdlEc4UIqOvjpP\",\n \"object\": \"charge\",\n \"amount\": 3000,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890RWEG8ShdlEc4LfUSV8WI\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890RVEG8ShdlEc44JfqAeXI\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746725,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"1000 Widgets\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1890RVEG8ShdlEc4UIqOvjpP/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890RVEG8ShdlEc44JfqAeXI\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n}\n", + "headers": { + "Server": "nginx", + "Date": "Sun, 08 May 2016 22:32:06 GMT", + "Content-Type": "application/json", + "Content-Length": "2113", + "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_8Pq7SJKwVArN5T", + "Stripe-Version": "2015-01-11", + "Strict-Transport-Security": "max-age=31556926; includeSubDomains" + }, + "status_code": 200, + "type": "ok" + } + }, + { + "request": { + "body": "amount=500", + "headers": { + "Authorization": "Bearer sk_test_Gwo3dv3LVt9d51pEppopW08N", + "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/charges/ch_1890RVEG8ShdlEc4UIqOvjpP/refunds" + }, + "response": { + "body": "{\n \"id\": \"re_1890RWEG8ShdlEc42x3QmDB8\",\n \"object\": \"refund\",\n \"amount\": 500,\n \"balance_transaction\": \"txn_1890RWEG8ShdlEc4JRszwEVF\",\n \"charge\": \"ch_1890RVEG8ShdlEc4UIqOvjpP\",\n \"created\": 1462746726,\n \"currency\": \"usd\",\n \"metadata\": {},\n \"reason\": null,\n \"receipt_number\": null,\n \"status\": \"succeeded\"\n}\n", + "headers": { + "Server": "nginx", + "Date": "Sun, 08 May 2016 22:32:06 GMT", + "Content-Type": "application/json", + "Content-Length": "314", + "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_8Pq7JBJhpXWyHW", + "Stripe-Version": "2015-01-11", + "Strict-Transport-Security": "max-age=31556926; includeSubDomains" + }, + "status_code": 200, + "type": "ok" + } + } +] \ No newline at end of file diff --git a/fixture/vcr_cassettes/stripe_charge_refund_w_key.json b/fixture/vcr_cassettes/stripe_charge_refund_w_key.json new file mode 100644 index 00000000..b46c9998 --- /dev/null +++ b/fixture/vcr_cassettes/stripe_charge_refund_w_key.json @@ -0,0 +1,70 @@ +[ + { + "request": { + "body": "amount=5000¤cy=USD&source[object]=card&source[number]=4111111111111111&source[exp_month]=10&source[exp_year]=2020&source[country]=US&source[name]=Ducky Test&source[cvc]=123&description=1000%20Widgets", + "headers": { + "Authorization": "Bearer sk_test_Gwo3dv3LVt9d51pEppopW08N", + "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/charges" + }, + "response": { + "body": "{\n \"id\": \"ch_1890RWEG8ShdlEc4qhr6CYae\",\n \"object\": \"charge\",\n \"amount\": 5000,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890RWEG8ShdlEc4zS4A23d3\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890RWEG8ShdlEc4jdOauErQ\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746726,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"1000 Widgets\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1890RWEG8ShdlEc4qhr6CYae/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890RWEG8ShdlEc4jdOauErQ\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n}\n", + "headers": { + "Server": "nginx", + "Date": "Sun, 08 May 2016 22:32:06 GMT", + "Content-Type": "application/json", + "Content-Length": "2113", + "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_8Pq75Pz3l6fOGv", + "Stripe-Version": "2015-01-11", + "Strict-Transport-Security": "max-age=31556926; includeSubDomains" + }, + "status_code": 200, + "type": "ok" + } + }, + { + "request": { + "body": "amount=500", + "headers": { + "Authorization": "Bearer sk_test_Gwo3dv3LVt9d51pEppopW08N", + "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/charges/ch_1890RWEG8ShdlEc4qhr6CYae/refunds" + }, + "response": { + "body": "{\n \"id\": \"re_1890RWEG8ShdlEc4JQ680heD\",\n \"object\": \"refund\",\n \"amount\": 500,\n \"balance_transaction\": \"txn_1890RWEG8ShdlEc410IOPgqG\",\n \"charge\": \"ch_1890RWEG8ShdlEc4qhr6CYae\",\n \"created\": 1462746726,\n \"currency\": \"usd\",\n \"metadata\": {},\n \"reason\": null,\n \"receipt_number\": null,\n \"status\": \"succeeded\"\n}\n", + "headers": { + "Server": "nginx", + "Date": "Sun, 08 May 2016 22:32:07 GMT", + "Content-Type": "application/json", + "Content-Length": "314", + "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_8Pq7IjKhokPe3m", + "Stripe-Version": "2015-01-11", + "Strict-Transport-Security": "max-age=31556926; includeSubDomains" + }, + "status_code": 200, + "type": "ok" + } + } +] \ No newline at end of file diff --git a/fixture/vcr_cassettes/stripe_charge_update.json b/fixture/vcr_cassettes/stripe_charge_update.json new file mode 100644 index 00000000..edde1c48 --- /dev/null +++ b/fixture/vcr_cassettes/stripe_charge_update.json @@ -0,0 +1,70 @@ +[ + { + "request": { + "body": "amount=1000¤cy=USD&source[object]=card&source[number]=4111111111111111&source[exp_month]=10&source[exp_year]=2020&source[country]=US&source[name]=Ducky Test&source[cvc]=123&description=1000%20Widgets", + "headers": { + "Authorization": "Bearer sk_test_Gwo3dv3LVt9d51pEppopW08N", + "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/charges" + }, + "response": { + "body": "{\n \"id\": \"ch_1890RUEG8ShdlEc44U6qRXRr\",\n \"object\": \"charge\",\n \"amount\": 1000,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890RVEG8ShdlEc4vFJtqzVg\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890RUEG8ShdlEc4iZ8BPq8r\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746724,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"1000 Widgets\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1890RUEG8ShdlEc44U6qRXRr/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890RUEG8ShdlEc4iZ8BPq8r\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n}\n", + "headers": { + "Server": "nginx", + "Date": "Sun, 08 May 2016 22:32:05 GMT", + "Content-Type": "application/json", + "Content-Length": "2113", + "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_8Pq7Yw38GPtc5X", + "Stripe-Version": "2015-01-11", + "Strict-Transport-Security": "max-age=31556926; includeSubDomains" + }, + "status_code": 200, + "type": "ok" + } + }, + { + "request": { + "body": "description=Changed%20charge", + "headers": { + "Authorization": "Bearer sk_test_Gwo3dv3LVt9d51pEppopW08N", + "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/charges/ch_1890RUEG8ShdlEc44U6qRXRr" + }, + "response": { + "body": "{\n \"id\": \"ch_1890RUEG8ShdlEc44U6qRXRr\",\n \"object\": \"charge\",\n \"amount\": 1000,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890RVEG8ShdlEc4vFJtqzVg\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890RUEG8ShdlEc4iZ8BPq8r\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746724,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"Changed charge\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1890RUEG8ShdlEc44U6qRXRr/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890RUEG8ShdlEc4iZ8BPq8r\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n}\n", + "headers": { + "Server": "nginx", + "Date": "Sun, 08 May 2016 22:32:05 GMT", + "Content-Type": "application/json", + "Content-Length": "2115", + "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_8Pq70l4kaA7KPf", + "Stripe-Version": "2015-01-11", + "Strict-Transport-Security": "max-age=31556926; includeSubDomains" + }, + "status_code": 200, + "type": "ok" + } + } +] \ No newline at end of file diff --git a/fixture/vcr_cassettes/stripe_charge_update_w_key.json b/fixture/vcr_cassettes/stripe_charge_update_w_key.json new file mode 100644 index 00000000..1c8634ec --- /dev/null +++ b/fixture/vcr_cassettes/stripe_charge_update_w_key.json @@ -0,0 +1,70 @@ +[ + { + "request": { + "body": "amount=2000¤cy=USD&source[object]=card&source[number]=4111111111111111&source[exp_month]=10&source[exp_year]=2020&source[country]=US&source[name]=Ducky Test&source[cvc]=123&description=1000%20Widgets", + "headers": { + "Authorization": "Bearer sk_test_Gwo3dv3LVt9d51pEppopW08N", + "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/charges" + }, + "response": { + "body": "{\n \"id\": \"ch_1890SeEG8ShdlEc4ZldSi3f3\",\n \"object\": \"charge\",\n \"amount\": 2000,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890SeEG8ShdlEc4YWmCqe03\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890SeEG8ShdlEc4yMXMzx1b\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746796,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"1000 Widgets\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1890SeEG8ShdlEc4ZldSi3f3/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890SeEG8ShdlEc4yMXMzx1b\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n}\n", + "headers": { + "Server": "nginx", + "Date": "Sun, 08 May 2016 22:33:16 GMT", + "Content-Type": "application/json", + "Content-Length": "2113", + "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_8Pq8Fpa6DgvtbU", + "Stripe-Version": "2015-01-11", + "Strict-Transport-Security": "max-age=31556926; includeSubDomains" + }, + "status_code": 200, + "type": "ok" + } + }, + { + "request": { + "body": "description=Changed%20charge", + "headers": { + "Authorization": "Bearer sk_test_Gwo3dv3LVt9d51pEppopW08N", + "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/charges/ch_1890SeEG8ShdlEc4ZldSi3f3" + }, + "response": { + "body": "{\n \"id\": \"ch_1890SeEG8ShdlEc4ZldSi3f3\",\n \"object\": \"charge\",\n \"amount\": 2000,\n \"amount_refunded\": 0,\n \"application_fee\": null,\n \"balance_transaction\": \"txn_1890SeEG8ShdlEc4YWmCqe03\",\n \"captured\": true,\n \"card\": {\n \"id\": \"card_1890SeEG8ShdlEc4yMXMzx1b\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"created\": 1462746796,\n \"currency\": \"usd\",\n \"customer\": null,\n \"description\": \"Changed charge\",\n \"destination\": null,\n \"dispute\": null,\n \"failure_code\": null,\n \"failure_message\": null,\n \"fraud_details\": {},\n \"invoice\": null,\n \"livemode\": false,\n \"metadata\": {},\n \"order\": null,\n \"paid\": true,\n \"receipt_email\": null,\n \"receipt_number\": null,\n \"refunded\": false,\n \"refunds\": {\n \"object\": \"list\",\n \"data\": [],\n \"has_more\": false,\n \"total_count\": 0,\n \"url\": \"/v1/charges/ch_1890SeEG8ShdlEc4ZldSi3f3/refunds\"\n },\n \"shipping\": null,\n \"source\": {\n \"id\": \"card_1890SeEG8ShdlEc4yMXMzx1b\",\n \"object\": \"card\",\n \"address_city\": null,\n \"address_country\": null,\n \"address_line1\": null,\n \"address_line1_check\": null,\n \"address_line2\": null,\n \"address_state\": null,\n \"address_zip\": null,\n \"address_zip_check\": null,\n \"brand\": \"Visa\",\n \"country\": \"US\",\n \"customer\": null,\n \"cvc_check\": \"pass\",\n \"dynamic_last4\": null,\n \"exp_month\": 10,\n \"exp_year\": 2020,\n \"fingerprint\": \"paKrsfBLBArTb11w\",\n \"funding\": \"unknown\",\n \"last4\": \"1111\",\n \"metadata\": {},\n \"name\": \"Ducky Test\",\n \"tokenization_method\": null\n },\n \"source_transfer\": null,\n \"statement_descriptor\": null,\n \"status\": \"paid\"\n}\n", + "headers": { + "Server": "nginx", + "Date": "Sun, 08 May 2016 22:33:17 GMT", + "Content-Type": "application/json", + "Content-Length": "2115", + "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_8Pq834qBlyle87", + "Stripe-Version": "2015-01-11", + "Strict-Transport-Security": "max-age=31556926; includeSubDomains" + }, + "status_code": 200, + "type": "ok" + } + } +] \ No newline at end of file diff --git a/test/stripe/charge_test.exs b/test/stripe/charge_test.exs index b7a8ce3a..a110bdf4 100644 --- a/test/stripe/charge_test.exs +++ b/test/stripe/charge_test.exs @@ -1,7 +1,10 @@ defmodule Stripe.ChargeTest do use ExUnit.Case + use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney setup do + HTTPoison.start + params = [ source: [ object: "card", @@ -18,95 +21,121 @@ defmodule Stripe.ChargeTest do end test "Create with card works", %{params: params} do - case Stripe.Charges.create(1000,params) do - {:ok, res} -> assert res.id - {:error, err} -> flunk err + use_cassette "stripe_charge_create" do + case Stripe.Charges.create(1000,params) do + {:ok, res} -> assert res.id + {:error, err} -> flunk err + end end end test "Create with card, w/key works", %{params: params} do - case Stripe.Charges.create(1000,params, Stripe.config_or_env_key) do - {:ok, res} -> assert res.id - {:error, err} -> flunk err + use_cassette "stripe_charge_create_w_key" do + case Stripe.Charges.create(1000,params, Stripe.config_or_env_key) do + {:ok, res} -> assert res.id + {:error, err} -> flunk err + end end -end + end test "List works" do - case Stripe.Charges.list() do - {:ok, charges} -> assert length(charges) > 0 - {:error, err} -> flunk err + use_cassette "stripe_charge_list" do + case Stripe.Charges.list() do + {:ok, charges} -> assert length(charges) > 0 + {:error, err} -> flunk err + end end end test "List w/key works" do - case Stripe.Charges.list Stripe.config_or_env_key, 1 do - {:ok, charges} -> assert length(charges) > 0 - {:error, err} -> flunk err + use_cassette "stripe_charge_list_w_keys" do + case Stripe.Charges.list Stripe.config_or_env_key, 1 do + {:ok, charges} -> assert length(charges) > 0 + {:error, err} -> flunk err + end end -end + end + test "Get works" do - {:ok,[first | _]} = Stripe.Charges.list() - case Stripe.Charges.get(first.id) do - {:ok, charge} -> assert charge.id == first.id - {:error, err} -> flunk err + use_cassette "stripe_charge_get" do + {:ok,[first | _]} = Stripe.Charges.list() + case Stripe.Charges.get(first.id) do + {:ok, charge} -> assert charge.id == first.id + {:error, err} -> flunk err + end end end test "Get w/key works" do - {:ok,[first | _]} = Stripe.Charges.list Stripe.config_or_env_key, 1 - case Stripe.Charges.get(first.id, Stripe.config_or_env_key) do - {:ok, charge} -> assert charge.id == first.id - {:error, err} -> flunk err + use_cassette "stripe_charge_get_w_key" do + {:ok,[first | _]} = Stripe.Charges.list Stripe.config_or_env_key, 1 + case Stripe.Charges.get(first.id, Stripe.config_or_env_key) do + {:ok, charge} -> assert charge.id == first.id + {:error, err} -> flunk err + end end end test "Capture works", %{params: params} do - params = Keyword.put_new params, :capture, false - {:ok, charge} = Stripe.Charges.create(1000,params) - case Stripe.Charges.capture(charge.id) do - {:ok, captured} -> assert captured.id == charge.id - {:error, err} -> flunk err + use_cassette "stripe_charge_capture" do + params = Keyword.put_new params, :capture, false + {:ok, charge} = Stripe.Charges.create(1000,params) + case Stripe.Charges.capture(charge.id) do + {:ok, captured} -> assert captured.id == charge.id + {:error, err} -> flunk err + end end end test "Capture w/key works", %{params: params} do - params = Keyword.put_new params, :capture, false - {:ok, charge} = Stripe.Charges.create(1000,params, Stripe.config_or_env_key) - case Stripe.Charges.capture(charge.id, Stripe.config_or_env_key) do - {:ok, captured} -> assert captured.id == charge.id - {:error, err} -> flunk err + use_cassette "stripe_charge_capture_w_key" do + params = Keyword.put_new params, :capture, false + {:ok, charge} = Stripe.Charges.create(1000,params, Stripe.config_or_env_key) + case Stripe.Charges.capture(charge.id, Stripe.config_or_env_key) do + {:ok, captured} -> assert captured.id == charge.id + {:error, err} -> flunk err + end end -end + end + test "Change(Update) works", %{params: params} do - {:ok, charge} = Stripe.Charges.create(1000,params) - params = [description: "Changed charge"] - case Stripe.Charges.change(charge.id, params) do - {:ok, changed} -> assert changed.description == "Changed charge" - {:error, err} -> flunk err + use_cassette "stripe_charge_update" do + {:ok, charge} = Stripe.Charges.create(1000,params) + params = [description: "Changed charge"] + case Stripe.Charges.change(charge.id, params) do + {:ok, changed} -> assert changed.description == "Changed charge" + {:error, err} -> flunk err + end end -end + end test "Change(Update) w/key works", %{params: params} do - {:ok, charge} = Stripe.Charges.create(1000,params, Stripe.config_or_env_key) - params = [description: "Changed charge"] - case Stripe.Charges.change(charge.id, params, Stripe.config_or_env_key) do - {:ok, changed} -> assert changed.description == "Changed charge" - {:error, err} -> flunk err + use_cassette "stripe_charge_update_w_key" do + {:ok, charge} = Stripe.Charges.create(2000,params, Stripe.config_or_env_key) + params = [description: "Changed charge"] + case Stripe.Charges.change(charge.id, params, Stripe.config_or_env_key) do + {:ok, changed} -> assert changed.description == "Changed charge" + {:error, err} -> flunk err + end end end test "Refund works", %{params: params} do - {:ok, charge} = Stripe.Charges.create(1000,params) - case Stripe.Charges.refund_partial(charge.id,500) do - {:ok, refunded} -> assert refunded.amount == 500 - {:error, err} -> flunk err + use_cassette "stripe_charge_refund" do + {:ok, charge} = Stripe.Charges.create(3000,params) + case Stripe.Charges.refund_partial(charge.id,500) do + {:ok, refunded} -> assert refunded.amount == 500 + {:error, err} -> flunk err + end end end test "Refund w/key works", %{params: params} do - {:ok, charge} = Stripe.Charges.create(1000,params, Stripe.config_or_env_key) - case Stripe.Charges.refund_partial(charge.id,500, Stripe.config_or_env_key) do - {:ok, refunded} -> assert refunded.amount == 500 - {:error, err} -> flunk err + use_cassette "stripe_charge_refund_w_key" do + {:ok, charge} = Stripe.Charges.create(5000,params, Stripe.config_or_env_key) + case Stripe.Charges.refund_partial(charge.id,500, Stripe.config_or_env_key) do + {:ok, refunded} -> assert refunded.amount == 500 + {:error, err} -> flunk err + end end end end