Replaces stubs for existing customer test case

This commit is contained in:
filipefurtad0
2024-01-31 18:57:56 +00:00
parent 94168a3586
commit 57f55d7585
4 changed files with 1094 additions and 8 deletions

View File

@@ -0,0 +1,128 @@
---
http_interactions:
- request:
method: post
uri: https://api.stripe.com/v1/payment_methods
body:
encoding: UTF-8
string: type=card&card[number]=4242424242424242&card[exp_month]=8&card[exp_year]=2025&card[cvc]=314
headers:
User-Agent:
- Stripe/v1 RubyBindings/10.6.0
Authorization:
- Bearer <HIDDEN-STRIPE_SECRET_TEST_API_KEY>
Content-Type:
- application/x-www-form-urlencoded
X-Stripe-Client-Telemetry:
- '{"last_request_metrics":{"request_id":"req_nVxOB6GyIQjq2r","request_duration_ms":846}}'
Stripe-Version:
- '2023-10-16'
X-Stripe-Client-User-Agent:
- '{"bindings_version":"10.6.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux
version 6.5.0-15-generic (buildd@bos03-amd64-040) (x86_64-linux-gnu-gcc-12
(Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38)
#15~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 12 18:54:30 UTC 2","hostname":"ff-LAT"}'
Accept-Encoding:
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
Accept:
- "*/*"
response:
status:
code: 200
message: OK
headers:
Server:
- nginx
Date:
- Wed, 31 Jan 2024 18:56:27 GMT
Content-Type:
- application/json
Content-Length:
- '930'
Connection:
- keep-alive
Access-Control-Allow-Credentials:
- 'true'
Access-Control-Allow-Methods:
- GET,HEAD,PUT,PATCH,POST,DELETE
Access-Control-Allow-Origin:
- "*"
Access-Control-Expose-Headers:
- Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required,
X-Stripe-Privileged-Session-Required
Access-Control-Max-Age:
- '300'
Cache-Control:
- no-cache, no-store
Content-Security-Policy:
- report-uri https://q.stripe.com/csp-report?p=v1%2Fpayment_methods; block-all-mixed-content;
default-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'none';
img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'
Idempotency-Key:
- b8b37c57-b454-4fb7-b611-cb1df87378a5
Original-Request:
- req_gPgo73OOv0lXWh
Request-Id:
- req_gPgo73OOv0lXWh
Stripe-Should-Retry:
- 'false'
Stripe-Version:
- '2023-10-16'
Vary:
- Origin
X-Stripe-Routing-Context-Priority-Tier:
- api-testmode
Strict-Transport-Security:
- max-age=63072000; includeSubDomains; preload
body:
encoding: UTF-8
string: |-
{
"id": "pm_1OeixTKuuB1fWySnH9EJcJkx",
"object": "payment_method",
"billing_details": {
"address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": null,
"name": null,
"phone": null
},
"card": {
"brand": "visa",
"checks": {
"address_line1_check": null,
"address_postal_code_check": null,
"cvc_check": "unchecked"
},
"country": "US",
"exp_month": 8,
"exp_year": 2025,
"fingerprint": "6E6tgVjx6U65iHFV",
"funding": "credit",
"generated_from": null,
"last4": "4242",
"networks": {
"available": [
"visa"
],
"preferred": null
},
"three_d_secure_usage": {
"supported": true
},
"wallet": null
},
"created": 1706727387,
"customer": null,
"livemode": false,
"metadata": {},
"type": "card"
}
recorded_at: Wed, 31 Jan 2024 18:56:27 GMT
recorded_with: VCR 6.2.0

View File

@@ -0,0 +1,366 @@
---
http_interactions:
- request:
method: post
uri: https://api.stripe.com/v1/payment_methods
body:
encoding: UTF-8
string: type=card&card[number]=4242424242424242&card[exp_month]=8&card[exp_year]=2025&card[cvc]=314
headers:
User-Agent:
- Stripe/v1 RubyBindings/10.6.0
Authorization:
- Bearer <HIDDEN-STRIPE_SECRET_TEST_API_KEY>
Content-Type:
- application/x-www-form-urlencoded
X-Stripe-Client-Telemetry:
- '{"last_request_metrics":{"request_id":"req_6yqdUNCO7VZA9L","request_duration_ms":416}}'
Stripe-Version:
- '2023-10-16'
X-Stripe-Client-User-Agent:
- '{"bindings_version":"10.6.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux
version 6.5.0-15-generic (buildd@bos03-amd64-040) (x86_64-linux-gnu-gcc-12
(Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38)
#15~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 12 18:54:30 UTC 2","hostname":"ff-LAT"}'
Accept-Encoding:
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
Accept:
- "*/*"
response:
status:
code: 200
message: OK
headers:
Server:
- nginx
Date:
- Wed, 31 Jan 2024 18:56:25 GMT
Content-Type:
- application/json
Content-Length:
- '930'
Connection:
- keep-alive
Access-Control-Allow-Credentials:
- 'true'
Access-Control-Allow-Methods:
- GET,HEAD,PUT,PATCH,POST,DELETE
Access-Control-Allow-Origin:
- "*"
Access-Control-Expose-Headers:
- Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required,
X-Stripe-Privileged-Session-Required
Access-Control-Max-Age:
- '300'
Cache-Control:
- no-cache, no-store
Content-Security-Policy:
- report-uri https://q.stripe.com/csp-report?p=v1%2Fpayment_methods; block-all-mixed-content;
default-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'none';
img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'
Idempotency-Key:
- ea44d346-500d-4dec-85bd-98960f9bd4ad
Original-Request:
- req_FMxnXHQ6h6QPF3
Request-Id:
- req_FMxnXHQ6h6QPF3
Stripe-Should-Retry:
- 'false'
Stripe-Version:
- '2023-10-16'
Vary:
- Origin
X-Stripe-Routing-Context-Priority-Tier:
- api-testmode
Strict-Transport-Security:
- max-age=63072000; includeSubDomains; preload
body:
encoding: UTF-8
string: |-
{
"id": "pm_1OeixRKuuB1fWySn94l0sALn",
"object": "payment_method",
"billing_details": {
"address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": null,
"name": null,
"phone": null
},
"card": {
"brand": "visa",
"checks": {
"address_line1_check": null,
"address_postal_code_check": null,
"cvc_check": "unchecked"
},
"country": "US",
"exp_month": 8,
"exp_year": 2025,
"fingerprint": "6E6tgVjx6U65iHFV",
"funding": "credit",
"generated_from": null,
"last4": "4242",
"networks": {
"available": [
"visa"
],
"preferred": null
},
"three_d_secure_usage": {
"supported": true
},
"wallet": null
},
"created": 1706727385,
"customer": null,
"livemode": false,
"metadata": {},
"type": "card"
}
recorded_at: Wed, 31 Jan 2024 18:56:25 GMT
- request:
method: post
uri: https://api.stripe.com/v1/customers
body:
encoding: UTF-8
string: name=Apple+Customer&email=applecustomer%40example.com
headers:
User-Agent:
- Stripe/v1 RubyBindings/10.6.0
Authorization:
- Bearer <HIDDEN-STRIPE_SECRET_TEST_API_KEY>
Content-Type:
- application/x-www-form-urlencoded
X-Stripe-Client-Telemetry:
- '{"last_request_metrics":{"request_id":"req_FMxnXHQ6h6QPF3","request_duration_ms":497}}'
Stripe-Version:
- '2023-10-16'
X-Stripe-Client-User-Agent:
- '{"bindings_version":"10.6.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux
version 6.5.0-15-generic (buildd@bos03-amd64-040) (x86_64-linux-gnu-gcc-12
(Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38)
#15~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 12 18:54:30 UTC 2","hostname":"ff-LAT"}'
Accept-Encoding:
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
Accept:
- "*/*"
response:
status:
code: 200
message: OK
headers:
Server:
- nginx
Date:
- Wed, 31 Jan 2024 18:56:26 GMT
Content-Type:
- application/json
Content-Length:
- '649'
Connection:
- keep-alive
Access-Control-Allow-Credentials:
- 'true'
Access-Control-Allow-Methods:
- GET,HEAD,PUT,PATCH,POST,DELETE
Access-Control-Allow-Origin:
- "*"
Access-Control-Expose-Headers:
- Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required,
X-Stripe-Privileged-Session-Required
Access-Control-Max-Age:
- '300'
Cache-Control:
- no-cache, no-store
Content-Security-Policy:
- report-uri https://q.stripe.com/csp-report?p=v1%2Fcustomers; block-all-mixed-content;
default-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'none';
img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'
Idempotency-Key:
- 3bdd78ef-b970-45fe-a3f6-763eb5d1f08c
Original-Request:
- req_awPDup0O3nlPAn
Request-Id:
- req_awPDup0O3nlPAn
Stripe-Should-Retry:
- 'false'
Stripe-Version:
- '2023-10-16'
Vary:
- Origin
X-Stripe-Routing-Context-Priority-Tier:
- api-testmode
Strict-Transport-Security:
- max-age=63072000; includeSubDomains; preload
body:
encoding: UTF-8
string: |-
{
"id": "cus_PTgK9kQm5CLg1d",
"object": "customer",
"address": null,
"balance": 0,
"created": 1706727385,
"currency": null,
"default_source": null,
"delinquent": false,
"description": null,
"discount": null,
"email": "applecustomer@example.com",
"invoice_prefix": "B254E3AC",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": null,
"footer": null,
"rendering_options": null
},
"livemode": false,
"metadata": {},
"name": "Apple Customer",
"next_invoice_sequence": 1,
"phone": null,
"preferred_locales": [],
"shipping": null,
"tax_exempt": "none",
"test_clock": null
}
recorded_at: Wed, 31 Jan 2024 18:56:26 GMT
- request:
method: post
uri: https://api.stripe.com/v1/payment_methods/pm_1OeixRKuuB1fWySn94l0sALn/attach
body:
encoding: UTF-8
string: customer=cus_PTgK9kQm5CLg1d
headers:
User-Agent:
- Stripe/v1 RubyBindings/10.6.0
Authorization:
- Bearer <HIDDEN-STRIPE_SECRET_TEST_API_KEY>
Content-Type:
- application/x-www-form-urlencoded
X-Stripe-Client-Telemetry:
- '{"last_request_metrics":{"request_id":"req_awPDup0O3nlPAn","request_duration_ms":415}}'
Stripe-Version:
- '2023-10-16'
X-Stripe-Client-User-Agent:
- '{"bindings_version":"10.6.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux
version 6.5.0-15-generic (buildd@bos03-amd64-040) (x86_64-linux-gnu-gcc-12
(Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38)
#15~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 12 18:54:30 UTC 2","hostname":"ff-LAT"}'
Accept-Encoding:
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
Accept:
- "*/*"
response:
status:
code: 200
message: OK
headers:
Server:
- nginx
Date:
- Wed, 31 Jan 2024 18:56:26 GMT
Content-Type:
- application/json
Content-Length:
- '1095'
Connection:
- keep-alive
Access-Control-Allow-Credentials:
- 'true'
Access-Control-Allow-Methods:
- GET,HEAD,PUT,PATCH,POST,DELETE
Access-Control-Allow-Origin:
- "*"
Access-Control-Expose-Headers:
- Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required,
X-Stripe-Privileged-Session-Required
Access-Control-Max-Age:
- '300'
Cache-Control:
- no-cache, no-store
Content-Security-Policy:
- report-uri https://q.stripe.com/csp-report?p=v1%2Fpayment_methods%2F%3Apayment_method%2Fattach;
block-all-mixed-content; default-src 'none'; base-uri 'none'; form-action
'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample';
style-src 'self'
Idempotency-Key:
- eceff5bf-9a18-4484-a26b-b0866231b892
Original-Request:
- req_nVxOB6GyIQjq2r
Request-Id:
- req_nVxOB6GyIQjq2r
Stripe-Should-Retry:
- 'false'
Stripe-Version:
- '2023-10-16'
Vary:
- Origin
X-Stripe-Routing-Context-Priority-Tier:
- api-testmode
Strict-Transport-Security:
- max-age=63072000; includeSubDomains; preload
body:
encoding: UTF-8
string: |-
{
"id": "pm_1OeixRKuuB1fWySn94l0sALn",
"object": "payment_method",
"billing_details": {
"address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": null,
"name": null,
"phone": null
},
"card": {
"brand": "visa",
"checks": {
"address_line1_check": null,
"address_postal_code_check": null,
"cvc_check": "pass"
},
"country": "US",
"display_brand": {
"label": "Visa",
"logo_url": "https://b.stripecdn.com/cards-metadata/logos/card-visa.svg",
"type": "visa"
},
"exp_month": 8,
"exp_year": 2025,
"fingerprint": "6E6tgVjx6U65iHFV",
"funding": "credit",
"generated_from": null,
"last4": "4242",
"networks": {
"available": [
"visa"
],
"preferred": null
},
"three_d_secure_usage": {
"supported": true
},
"wallet": null
},
"created": 1706727385,
"customer": "cus_PTgK9kQm5CLg1d",
"livemode": false,
"metadata": {},
"type": "card"
}
recorded_at: Wed, 31 Jan 2024 18:56:27 GMT
recorded_with: VCR 6.2.0

View File

@@ -0,0 +1,539 @@
---
http_interactions:
- request:
method: post
uri: https://api.stripe.com/v1/payment_methods
body:
encoding: UTF-8
string: type=card&card[number]=4242424242424242&card[exp_month]=8&card[exp_year]=2025&card[cvc]=314
headers:
User-Agent:
- Stripe/v1 RubyBindings/10.6.0
Authorization:
- Bearer <HIDDEN-STRIPE_SECRET_TEST_API_KEY>
Content-Type:
- application/x-www-form-urlencoded
Stripe-Version:
- '2023-10-16'
X-Stripe-Client-User-Agent:
- '{"bindings_version":"10.6.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux
version 6.5.0-15-generic (buildd@bos03-amd64-040) (x86_64-linux-gnu-gcc-12
(Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38)
#15~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 12 18:54:30 UTC 2","hostname":"ff-LAT"}'
Accept-Encoding:
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
Accept:
- "*/*"
response:
status:
code: 200
message: OK
headers:
Server:
- nginx
Date:
- Wed, 31 Jan 2024 18:56:22 GMT
Content-Type:
- application/json
Content-Length:
- '930'
Connection:
- keep-alive
Access-Control-Allow-Credentials:
- 'true'
Access-Control-Allow-Methods:
- GET,HEAD,PUT,PATCH,POST,DELETE
Access-Control-Allow-Origin:
- "*"
Access-Control-Expose-Headers:
- Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required,
X-Stripe-Privileged-Session-Required
Access-Control-Max-Age:
- '300'
Cache-Control:
- no-cache, no-store
Content-Security-Policy:
- report-uri https://q.stripe.com/csp-report?p=v1%2Fpayment_methods; block-all-mixed-content;
default-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'none';
img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'
Idempotency-Key:
- dcab8f42-8922-4488-9763-8bf0f5a36d70
Original-Request:
- req_N1Y7qkaYx0SmUL
Request-Id:
- req_N1Y7qkaYx0SmUL
Stripe-Should-Retry:
- 'false'
Stripe-Version:
- '2023-10-16'
Vary:
- Origin
X-Stripe-Routing-Context-Priority-Tier:
- api-testmode
Strict-Transport-Security:
- max-age=63072000; includeSubDomains; preload
body:
encoding: UTF-8
string: |-
{
"id": "pm_1OeixOKuuB1fWySn4ofvl5oW",
"object": "payment_method",
"billing_details": {
"address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": null,
"name": null,
"phone": null
},
"card": {
"brand": "visa",
"checks": {
"address_line1_check": null,
"address_postal_code_check": null,
"cvc_check": "unchecked"
},
"country": "US",
"exp_month": 8,
"exp_year": 2025,
"fingerprint": "6E6tgVjx6U65iHFV",
"funding": "credit",
"generated_from": null,
"last4": "4242",
"networks": {
"available": [
"visa"
],
"preferred": null
},
"three_d_secure_usage": {
"supported": true
},
"wallet": null
},
"created": 1706727382,
"customer": null,
"livemode": false,
"metadata": {},
"type": "card"
}
recorded_at: Wed, 31 Jan 2024 18:56:22 GMT
- request:
method: post
uri: https://api.stripe.com/v1/customers
body:
encoding: UTF-8
string: name=Apple+Customer&email=applecustomer%40example.com
headers:
User-Agent:
- Stripe/v1 RubyBindings/10.6.0
Authorization:
- Bearer <HIDDEN-STRIPE_SECRET_TEST_API_KEY>
Content-Type:
- application/x-www-form-urlencoded
X-Stripe-Client-Telemetry:
- '{"last_request_metrics":{"request_id":"req_N1Y7qkaYx0SmUL","request_duration_ms":744}}'
Stripe-Version:
- '2023-10-16'
X-Stripe-Client-User-Agent:
- '{"bindings_version":"10.6.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux
version 6.5.0-15-generic (buildd@bos03-amd64-040) (x86_64-linux-gnu-gcc-12
(Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38)
#15~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 12 18:54:30 UTC 2","hostname":"ff-LAT"}'
Accept-Encoding:
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
Accept:
- "*/*"
response:
status:
code: 200
message: OK
headers:
Server:
- nginx
Date:
- Wed, 31 Jan 2024 18:56:23 GMT
Content-Type:
- application/json
Content-Length:
- '649'
Connection:
- keep-alive
Access-Control-Allow-Credentials:
- 'true'
Access-Control-Allow-Methods:
- GET,HEAD,PUT,PATCH,POST,DELETE
Access-Control-Allow-Origin:
- "*"
Access-Control-Expose-Headers:
- Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required,
X-Stripe-Privileged-Session-Required
Access-Control-Max-Age:
- '300'
Cache-Control:
- no-cache, no-store
Content-Security-Policy:
- report-uri https://q.stripe.com/csp-report?p=v1%2Fcustomers; block-all-mixed-content;
default-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'none';
img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'
Idempotency-Key:
- d3933cb5-b52d-4688-ae2c-b916fd0eeb15
Original-Request:
- req_LqZz8FiH8mJbDT
Request-Id:
- req_LqZz8FiH8mJbDT
Stripe-Should-Retry:
- 'false'
Stripe-Version:
- '2023-10-16'
Vary:
- Origin
X-Stripe-Routing-Context-Priority-Tier:
- api-testmode
Strict-Transport-Security:
- max-age=63072000; includeSubDomains; preload
body:
encoding: UTF-8
string: |-
{
"id": "cus_PTgK7hMYYzU7Rl",
"object": "customer",
"address": null,
"balance": 0,
"created": 1706727383,
"currency": null,
"default_source": null,
"delinquent": false,
"description": null,
"discount": null,
"email": "applecustomer@example.com",
"invoice_prefix": "70534FFF",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": null,
"footer": null,
"rendering_options": null
},
"livemode": false,
"metadata": {},
"name": "Apple Customer",
"next_invoice_sequence": 1,
"phone": null,
"preferred_locales": [],
"shipping": null,
"tax_exempt": "none",
"test_clock": null
}
recorded_at: Wed, 31 Jan 2024 18:56:23 GMT
- request:
method: post
uri: https://api.stripe.com/v1/payment_methods/pm_1OeixOKuuB1fWySn4ofvl5oW/attach
body:
encoding: UTF-8
string: customer=cus_PTgK7hMYYzU7Rl
headers:
User-Agent:
- Stripe/v1 RubyBindings/10.6.0
Authorization:
- Bearer <HIDDEN-STRIPE_SECRET_TEST_API_KEY>
Content-Type:
- application/x-www-form-urlencoded
X-Stripe-Client-Telemetry:
- '{"last_request_metrics":{"request_id":"req_LqZz8FiH8mJbDT","request_duration_ms":621}}'
Stripe-Version:
- '2023-10-16'
X-Stripe-Client-User-Agent:
- '{"bindings_version":"10.6.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux
version 6.5.0-15-generic (buildd@bos03-amd64-040) (x86_64-linux-gnu-gcc-12
(Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38)
#15~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 12 18:54:30 UTC 2","hostname":"ff-LAT"}'
Accept-Encoding:
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
Accept:
- "*/*"
response:
status:
code: 200
message: OK
headers:
Server:
- nginx
Date:
- Wed, 31 Jan 2024 18:56:24 GMT
Content-Type:
- application/json
Content-Length:
- '941'
Connection:
- keep-alive
Access-Control-Allow-Credentials:
- 'true'
Access-Control-Allow-Methods:
- GET,HEAD,PUT,PATCH,POST,DELETE
Access-Control-Allow-Origin:
- "*"
Access-Control-Expose-Headers:
- Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required,
X-Stripe-Privileged-Session-Required
Access-Control-Max-Age:
- '300'
Cache-Control:
- no-cache, no-store
Content-Security-Policy:
- report-uri https://q.stripe.com/csp-report?p=v1%2Fpayment_methods%2F%3Apayment_method%2Fattach;
block-all-mixed-content; default-src 'none'; base-uri 'none'; form-action
'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample';
style-src 'self'
Idempotency-Key:
- 9ed7c6c5-4135-473c-8932-87dfe1e046fe
Original-Request:
- req_zyskeoxPUygBlg
Request-Id:
- req_zyskeoxPUygBlg
Stripe-Should-Retry:
- 'false'
Stripe-Version:
- '2023-10-16'
Vary:
- Origin
X-Stripe-Routing-Context-Priority-Tier:
- api-testmode
Strict-Transport-Security:
- max-age=63072000; includeSubDomains; preload
body:
encoding: UTF-8
string: |-
{
"id": "pm_1OeixOKuuB1fWySn4ofvl5oW",
"object": "payment_method",
"billing_details": {
"address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": null,
"name": null,
"phone": null
},
"card": {
"brand": "visa",
"checks": {
"address_line1_check": null,
"address_postal_code_check": null,
"cvc_check": "pass"
},
"country": "US",
"exp_month": 8,
"exp_year": 2025,
"fingerprint": "6E6tgVjx6U65iHFV",
"funding": "credit",
"generated_from": null,
"last4": "4242",
"networks": {
"available": [
"visa"
],
"preferred": null
},
"three_d_secure_usage": {
"supported": true
},
"wallet": null
},
"created": 1706727382,
"customer": "cus_PTgK7hMYYzU7Rl",
"livemode": false,
"metadata": {},
"type": "card"
}
recorded_at: Wed, 31 Jan 2024 18:56:24 GMT
- request:
method: get
uri: https://api.stripe.com/v1/customers/cus_PTgK7hMYYzU7Rl
body:
encoding: US-ASCII
string: ''
headers:
User-Agent:
- Stripe/v1 RubyBindings/10.6.0
Authorization:
- Bearer <HIDDEN-STRIPE_SECRET_TEST_API_KEY>
Content-Type:
- application/x-www-form-urlencoded
X-Stripe-Client-Telemetry:
- '{"last_request_metrics":{"request_id":"req_zyskeoxPUygBlg","request_duration_ms":728}}'
Stripe-Version:
- '2023-10-16'
X-Stripe-Client-User-Agent:
- '{"bindings_version":"10.6.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux
version 6.5.0-15-generic (buildd@bos03-amd64-040) (x86_64-linux-gnu-gcc-12
(Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38)
#15~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 12 18:54:30 UTC 2","hostname":"ff-LAT"}'
Accept-Encoding:
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
Accept:
- "*/*"
response:
status:
code: 200
message: OK
headers:
Server:
- nginx
Date:
- Wed, 31 Jan 2024 18:56:24 GMT
Content-Type:
- application/json
Content-Length:
- '649'
Connection:
- keep-alive
Access-Control-Allow-Credentials:
- 'true'
Access-Control-Allow-Methods:
- GET,HEAD,PUT,PATCH,POST,DELETE
Access-Control-Allow-Origin:
- "*"
Access-Control-Expose-Headers:
- Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required,
X-Stripe-Privileged-Session-Required
Access-Control-Max-Age:
- '300'
Cache-Control:
- no-cache, no-store
Content-Security-Policy:
- report-uri https://q.stripe.com/csp-report?p=v1%2Fcustomers%2F%3Acustomer;
block-all-mixed-content; default-src 'none'; base-uri 'none'; form-action
'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample';
style-src 'self'
Request-Id:
- req_JiUCvLOyub90XZ
Stripe-Version:
- '2023-10-16'
Vary:
- Origin
X-Stripe-Routing-Context-Priority-Tier:
- api-testmode
Strict-Transport-Security:
- max-age=63072000; includeSubDomains; preload
body:
encoding: UTF-8
string: |-
{
"id": "cus_PTgK7hMYYzU7Rl",
"object": "customer",
"address": null,
"balance": 0,
"created": 1706727383,
"currency": null,
"default_source": null,
"delinquent": false,
"description": null,
"discount": null,
"email": "applecustomer@example.com",
"invoice_prefix": "70534FFF",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": null,
"footer": null,
"rendering_options": null
},
"livemode": false,
"metadata": {},
"name": "Apple Customer",
"next_invoice_sequence": 1,
"phone": null,
"preferred_locales": [],
"shipping": null,
"tax_exempt": "none",
"test_clock": null
}
recorded_at: Wed, 31 Jan 2024 18:56:24 GMT
- request:
method: delete
uri: https://api.stripe.com/v1/customers/cus_PTgK7hMYYzU7Rl
body:
encoding: US-ASCII
string: ''
headers:
User-Agent:
- Stripe/v1 RubyBindings/10.6.0
Authorization:
- Bearer <HIDDEN-STRIPE_SECRET_TEST_API_KEY>
Content-Type:
- application/x-www-form-urlencoded
X-Stripe-Client-Telemetry:
- '{"last_request_metrics":{"request_id":"req_JiUCvLOyub90XZ","request_duration_ms":339}}'
Stripe-Version:
- '2023-10-16'
X-Stripe-Client-User-Agent:
- '{"bindings_version":"10.6.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux
version 6.5.0-15-generic (buildd@bos03-amd64-040) (x86_64-linux-gnu-gcc-12
(Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38)
#15~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 12 18:54:30 UTC 2","hostname":"ff-LAT"}'
Accept-Encoding:
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
Accept:
- "*/*"
response:
status:
code: 200
message: OK
headers:
Server:
- nginx
Date:
- Wed, 31 Jan 2024 18:56:25 GMT
Content-Type:
- application/json
Content-Length:
- '75'
Connection:
- keep-alive
Access-Control-Allow-Credentials:
- 'true'
Access-Control-Allow-Methods:
- GET,HEAD,PUT,PATCH,POST,DELETE
Access-Control-Allow-Origin:
- "*"
Access-Control-Expose-Headers:
- Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required,
X-Stripe-Privileged-Session-Required
Access-Control-Max-Age:
- '300'
Cache-Control:
- no-cache, no-store
Content-Security-Policy:
- report-uri https://q.stripe.com/csp-report?p=v1%2Fcustomers%2F%3Acustomer;
block-all-mixed-content; default-src 'none'; base-uri 'none'; form-action
'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample';
style-src 'self'
Request-Id:
- req_6yqdUNCO7VZA9L
Stripe-Version:
- '2023-10-16'
Vary:
- Origin
X-Stripe-Routing-Context-Priority-Tier:
- api-testmode
Strict-Transport-Security:
- max-age=63072000; includeSubDomains; preload
body:
encoding: UTF-8
string: |-
{
"id": "cus_PTgK7hMYYzU7Rl",
"object": "customer",
"deleted": true
}
recorded_at: Wed, 31 Jan 2024 18:56:25 GMT
recorded_with: VCR 6.2.0

View File

@@ -4,20 +4,73 @@ require 'spec_helper'
require 'stripe/credit_card_remover'
describe Stripe::CreditCardRemover do
let(:credit_card) { double('credit_card', gateway_customer_profile_id: 1) }
let!(:secret) { ENV.fetch('STRIPE_SECRET_TEST_API_KEY', nil) }
let(:credit_card) { create(:credit_card, gateway_payment_profile_id: pm_card.id, user:) }
let!(:user) { create(:user, email: "apple.customer@example.com") }
let!(:enterprise) { create(:enterprise) }
describe "#remove", :vcr, :stripe_version do
before { Stripe.api_key = secret }
let(:stripe_account_id) { ENV.fetch('STRIPE_ACCOUNT', nil) }
let(:stripe_account) {
create(:stripe_account, enterprise:, stripe_user_id: stripe_account_id)
}
let(:credit_card) { create(:credit_card, gateway_payment_profile_id: pm_card.id, user:) }
let(:pm_card) {
Stripe::PaymentMethod.create(
{
type: 'card',
card: {
number: '4242424242424242',
exp_month: 8,
exp_year: Time.zone.now.year.next,
cvc: '314',
},
},
)
}
let(:connected_account) do
Stripe::Account.create({
type: 'standard',
country: 'AU',
email: 'apple.producer@example.com'
})
end
let(:cloner) { Stripe::CreditCardCloner.new(credit_card, connected_account.id) }
context 'Stripe customer exists' do
let(:payment_method_id) { pm_card.id }
let(:customer_id) { customer.id }
let(:customer) do
Stripe::Customer.create({
name: 'Apple Customer',
email: 'applecustomer@example.com',
})
end
before do
Stripe::PaymentMethod.attach(
payment_method_id,
{ customer: customer_id },
)
credit_card.update_attribute :gateway_customer_profile_id, customer_id
end
context 'and is not deleted' do
it 'deletes the credit card clone and the customer' do
customer = double('customer', deleted?: false)
allow(Stripe::Customer).to receive(:retrieve).and_return(customer)
response = Stripe::CreditCardRemover.new(credit_card).call
expect_any_instance_of(Stripe::CreditCardCloneDestroyer).to receive(:destroy_clones).with(
credit_card
)
expect(customer).to receive(:delete)
Stripe::CreditCardRemover.new(credit_card).call
expect(response.deleted).to eq(true)
end
end