Skip to content

Commit

Permalink
ChargeTest with request vcr mock (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
pragmaticivan committed May 8, 2016
1 parent bce96ca commit f1651dd
Show file tree
Hide file tree
Showing 13 changed files with 785 additions and 52 deletions.
70 changes: 70 additions & 0 deletions fixture/vcr_cassettes/stripe_charge_capture.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
[
{
"request": {
"body": "amount=1000&currency=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"
}
}
]
70 changes: 70 additions & 0 deletions fixture/vcr_cassettes/stripe_charge_capture_w_key.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
[
{
"request": {
"body": "amount=1000&currency=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"
}
}
]
36 changes: 36 additions & 0 deletions fixture/vcr_cassettes/stripe_charge_create.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[
{
"request": {
"body": "amount=1000&currency=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"
}
}
]
Loading

0 comments on commit f1651dd

Please sign in to comment.