diff --git a/Gemfile.lock b/Gemfile.lock index fc4250cd8a..53a086a95f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -98,11 +98,12 @@ GEM activejob (7.0.8) activesupport (= 7.0.8) globalid (>= 0.3.6) - activemerchant (1.123.0) + activemerchant (1.133.0) activesupport (>= 4.2) builder (>= 2.1.2, < 4.0.0) i18n (>= 0.6.9) nokogiri (~> 1.4) + rexml (~> 3.2.5) activemodel (7.0.8) activesupport (= 7.0.8) activerecord (7.0.8) diff --git a/app/models/spree/gateway/stripe_sca.rb b/app/models/spree/gateway/stripe_sca.rb index b4a3ea95b4..78e658ab9c 100644 --- a/app/models/spree/gateway/stripe_sca.rb +++ b/app/models/spree/gateway/stripe_sca.rb @@ -4,7 +4,6 @@ require 'stripe/profile_storer' require 'stripe/credit_card_cloner' require 'stripe/authorize_response_patcher' require 'stripe/payment_intent_validator' -require 'active_merchant/billing/gateways/stripe_payment_intents_decorator' require 'active_merchant/billing/gateways/stripe' module Spree @@ -44,7 +43,7 @@ module Spree StripeAccount.find_by(enterprise_id: preferred_enterprise_id)&.stripe_user_id end - # NOTE: the name of this method is determined by Spree::Payment::Processing + # NOTE: this method is required by Spree::Payment::Processing def purchase(money, creditcard, gateway_options) begin payment_intent_id = fetch_payment_intent(creditcard, gateway_options) @@ -64,7 +63,7 @@ module Spree provider.capture(money, payment_intent_id, options) end - # NOTE: the name of this method is determined by Spree::Payment::Processing + # NOTE: this method is required by Spree::Payment::Processing def charge_offline(money, creditcard, gateway_options) customer, payment_method = Stripe::CreditCardCloner.new(creditcard, stripe_account_id).find_or_clone @@ -75,7 +74,7 @@ module Spree failed_activemerchant_billing_response(e.message) end - # NOTE: the name of this method is determined by Spree::Payment::Processing + # NOTE: this method is required by Spree::Payment::Processing def authorize(money, creditcard, gateway_options) authorize_response = provider.authorize(*options_for_authorize(money, creditcard, gateway_options)) @@ -84,26 +83,27 @@ module Spree failed_activemerchant_billing_response(e.message) end - # NOTE: the name of this method is determined by Spree::Payment::Processing - def void(response_code, _creditcard, gateway_options) - payment_intent_id = response_code - payment_intent_response = Stripe::PaymentIntent.retrieve(payment_intent_id, - stripe_account: stripe_account_id) + # NOTE: this method is required by Spree::Payment::Processing + def void(payment_intent_id, _creditcard, gateway_options) + payment_intent_response = Stripe::PaymentIntent.retrieve( + payment_intent_id, stripe_account: stripe_account_id + ) gateway_options[:stripe_account] = stripe_account_id # If a payment has been confirmed it can't be voided by Stripe, and must be refunded instead if voidable?(payment_intent_response) - provider.void(response_code, gateway_options) + provider.void(payment_intent_id, gateway_options) else - provider.refund(refundable_amount(payment_intent_response), response_code, - gateway_options) + provider.refund( + payment_intent_response.amount_received, payment_intent_id, gateway_options + ) end end - # NOTE: the name of this method is determined by Spree::Payment::Processing - def credit(money, _creditcard, response_code, gateway_options) + # NOTE: this method is required by Spree::Payment::Processing + def credit(money, _creditcard, payment_intent_id, gateway_options) gateway_options[:stripe_account] = stripe_account_id - provider.refund(money, response_code, gateway_options) + provider.refund(money, payment_intent_id, gateway_options) end def create_profile(payment) @@ -119,11 +119,6 @@ module Spree VOIDABLE_STATES.include? payment_intent_response.status end - def refundable_amount(payment_intent_response) - payment_intent_response.amount_received - - payment_intent_response.charges.data.map(&:amount_refunded).sum - end - # In this gateway, what we call 'secret_key' is the 'login' def options options = super diff --git a/lib/active_merchant/billing/gateways/stripe_payment_intents_decorator.rb b/lib/active_merchant/billing/gateways/stripe_payment_intents_decorator.rb deleted file mode 100644 index 711589f0cc..0000000000 --- a/lib/active_merchant/billing/gateways/stripe_payment_intents_decorator.rb +++ /dev/null @@ -1,89 +0,0 @@ -# frozen_string_literal: true - -ActiveMerchant::Billing::StripePaymentIntentsGateway.class_eval do - CREATE_INTENT_ATTRIBUTES = - %i[description statement_descriptor receipt_email save_payment_method].freeze - - def create_intent(money, payment_method, options = {}) - post = {} - add_amount(post, money, options, true) - add_capture_method(post, options) - add_confirmation_method(post, options) - add_customer(post, options) - add_payment_method_token(post, payment_method, options) - add_metadata(post, options) - add_return_url(post, options) - add_connected_account(post, options) - add_shipping_address(post, options) - setup_future_usage(post, options) - - CREATE_INTENT_ATTRIBUTES.each do |attribute| - add_whitelisted_attribute(post, options, attribute) - end - - commit(:post, 'payment_intents', post, options) - end - - def capture(money, intent_id, options = {}) - post = {} - post[:amount_to_capture] = money - add_connected_account(post, options) - commit(:post, "payment_intents/#{intent_id}/capture", post, options) - end - - def refund(money, intent_id, options = {}) - intent = commit(:get, "payment_intents/#{intent_id}", nil, options) - charge_id = intent.params.dig('charges', 'data')[0]['id'] - super(money, charge_id, options) - end - - # Note: Not all payment methods are currently supported by the - # {Payment Methods API}[https://stripe.com/docs/payments/payment-methods] - # Current implementation will create - # a PaymentMethod object if the method is a token or credit card - # All other types will default to legacy Stripe store - def store(payment_method, options = {}) - params = {} - post = {} - - # If customer option is provided, create a payment method and attach to customer id - # Otherwise, create a customer, then attach - # if payment_method.is_a?(StripePaymentToken) || - # payment_method.is_a?(ActiveMerchant::Billing::CreditCard) - add_payment_method_token(params, payment_method, options) - if options[:customer] - customer_id = options[:customer] - else - post[:validate] = options[:validate] unless options[:validate].nil? - post[:description] = options[:description] if options[:description] - post[:email] = options[:email] if options[:email] - customer = commit(:post, 'customers', post, options) - customer_id = customer.params['id'] - - # return the stripe response if expected customer id is not present - return customer if customer_id.nil? - end - commit(:post, - "payment_methods/#{params[:payment_method]}/attach", - { customer: customer_id }, options) - # else - # super(payment, options) - # end - end - - private - - def add_connected_account(post, options = {}) - return unless transfer_data = options[:transfer_data] - - post[:transfer_data] = {} - if transfer_data[:destination] - post[:transfer_data][:destination] = transfer_data[:destination] - end - post[:transfer_data][:amount] = transfer_data[:amount] if transfer_data[:amount] - post[:on_behalf_of] = options[:on_behalf_of] if options[:on_behalf_of] - post[:transfer_group] = options[:transfer_group] if options[:transfer_group] - post[:application_fee_amount] = options[:application_fee] if options[:application_fee] - post - end -end diff --git a/lib/stripe/profile_storer.rb b/lib/stripe/profile_storer.rb index 688bb4f9e8..ba3cc7b0aa 100644 --- a/lib/stripe/profile_storer.rb +++ b/lib/stripe/profile_storer.rb @@ -12,7 +12,9 @@ module Stripe end def create_customer_from_token - token = @payment.source.gateway_payment_profile_id + token = ActiveMerchant::Billing::StripeGateway::StripePaymentToken.new( + { 'id' => @payment.source.gateway_payment_profile_id } + ) response = @provider.store(token, options) if response.success? diff --git a/spec/fixtures/vcr_cassettes/Stripe-v10.9.0/Spree_Gateway_StripeSCA/_credit/refunds_the_payment.yml b/spec/fixtures/vcr_cassettes/Stripe-v10.9.0/Spree_Gateway_StripeSCA/_credit/refunds_the_payment.yml new file mode 100644 index 0000000000..fb348eac47 --- /dev/null +++ b/spec/fixtures/vcr_cassettes/Stripe-v10.9.0/Spree_Gateway_StripeSCA/_credit/refunds_the_payment.yml @@ -0,0 +1,836 @@ +--- +http_interactions: +- request: + method: post + uri: https://api.stripe.com/v1/accounts + body: + encoding: UTF-8 + string: type=standard&country=AU&email=carrot.producer%40example.com + headers: + User-Agent: + - Stripe/v1 RubyBindings/10.9.0 + Authorization: + - Bearer + Content-Type: + - application/x-www-form-urlencoded + X-Stripe-Client-Telemetry: + - '{"last_request_metrics":{"request_id":"req_7Xt2mBUL2tQGa6","request_duration_ms":398}}' + Stripe-Version: + - '2023-10-16' + X-Stripe-Client-User-Agent: + - '{"bindings_version":"10.9.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 5.15.0-92-generic (buildd@lcy02-amd64-002) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) + 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #102~20.04.1-Ubuntu SMP Mon + Jan 15 13:09:14 UTC 2024","hostname":"gaetan-Dell-G15"}' + 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: + - Mon, 19 Feb 2024 00:00:57 GMT + Content-Type: + - application/json + Content-Length: + - '3046' + 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%2Faccounts; 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: + - 5a55b396-5fde-45b7-9f37-84850fa5a0e0 + Original-Request: + - req_RtwrvZNzWbPbqy + Request-Id: + - req_RtwrvZNzWbPbqy + 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": "acct_1OlKHzQNFa3smszT", + "object": "account", + "business_profile": { + "annual_revenue": null, + "estimated_worker_count": null, + "mcc": null, + "name": null, + "product_description": null, + "support_address": null, + "support_email": null, + "support_phone": null, + "support_url": null, + "url": null + }, + "business_type": null, + "capabilities": {}, + "charges_enabled": false, + "controller": { + "is_controller": true, + "type": "application" + }, + "country": "AU", + "created": 1708300856, + "default_currency": "aud", + "details_submitted": false, + "email": "carrot.producer@example.com", + "external_accounts": { + "object": "list", + "data": [], + "has_more": false, + "total_count": 0, + "url": "/v1/accounts/acct_1OlKHzQNFa3smszT/external_accounts" + }, + "future_requirements": { + "alternatives": [], + "current_deadline": null, + "currently_due": [], + "disabled_reason": null, + "errors": [], + "eventually_due": [], + "past_due": [], + "pending_verification": [] + }, + "metadata": {}, + "payouts_enabled": false, + "requirements": { + "alternatives": [], + "current_deadline": null, + "currently_due": [ + "business_profile.product_description", + "business_profile.support_phone", + "business_profile.url", + "external_account", + "tos_acceptance.date", + "tos_acceptance.ip" + ], + "disabled_reason": "requirements.past_due", + "errors": [], + "eventually_due": [ + "business_profile.product_description", + "business_profile.support_phone", + "business_profile.url", + "external_account", + "tos_acceptance.date", + "tos_acceptance.ip" + ], + "past_due": [ + "external_account", + "tos_acceptance.date", + "tos_acceptance.ip" + ], + "pending_verification": [] + }, + "settings": { + "bacs_debit_payments": { + "display_name": null, + "service_user_number": null + }, + "branding": { + "icon": null, + "logo": null, + "primary_color": null, + "secondary_color": null + }, + "card_issuing": { + "tos_acceptance": { + "date": null, + "ip": null + } + }, + "card_payments": { + "decline_on": { + "avs_failure": false, + "cvc_failure": false + }, + "statement_descriptor_prefix": null, + "statement_descriptor_prefix_kana": null, + "statement_descriptor_prefix_kanji": null + }, + "dashboard": { + "display_name": null, + "timezone": "Etc/UTC" + }, + "invoices": { + "default_account_tax_ids": null + }, + "payments": { + "statement_descriptor": null, + "statement_descriptor_kana": null, + "statement_descriptor_kanji": null + }, + "payouts": { + "debit_negative_balances": true, + "schedule": { + "delay_days": 2, + "interval": "daily" + }, + "statement_descriptor": null + }, + "sepa_debit_payments": {} + }, + "tos_acceptance": { + "date": null, + "ip": null, + "user_agent": null + }, + "type": "standard" + } + recorded_at: Mon, 19 Feb 2024 00:00:57 GMT +- request: + method: post + uri: https://api.stripe.com/v1/payment_intents + body: + encoding: UTF-8 + string: amount=1000¤cy=aud&payment_method=pm_card_mastercard&payment_method_types[0]=card&capture_method=automatic&confirm=true + headers: + User-Agent: + - Stripe/v1 RubyBindings/10.9.0 + Authorization: + - Bearer + Content-Type: + - application/x-www-form-urlencoded + X-Stripe-Client-Telemetry: + - '{"last_request_metrics":{"request_id":"req_RtwrvZNzWbPbqy","request_duration_ms":1983}}' + Stripe-Version: + - '2023-10-16' + X-Stripe-Client-User-Agent: + - '{"bindings_version":"10.9.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 5.15.0-92-generic (buildd@lcy02-amd64-002) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) + 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #102~20.04.1-Ubuntu SMP Mon + Jan 15 13:09:14 UTC 2024","hostname":"gaetan-Dell-G15"}' + Stripe-Account: + - acct_1OlKHzQNFa3smszT + 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: + - Mon, 19 Feb 2024 00:00:59 GMT + Content-Type: + - application/json + Content-Length: + - '1396' + 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_intents; 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: + - e33bfb2f-4230-4e6f-860f-4b3c1ddcd20a + Original-Request: + - req_82EHYveYLsBnJi + Request-Id: + - req_82EHYveYLsBnJi + Stripe-Account: + - acct_1OlKHzQNFa3smszT + 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": "pi_3OlKI1QNFa3smszT1eEui4Zp", + "object": "payment_intent", + "amount": 1000, + "amount_capturable": 0, + "amount_details": { + "tip": {} + }, + "amount_received": 1000, + "application": "", + "application_fee_amount": null, + "automatic_payment_methods": null, + "canceled_at": null, + "cancellation_reason": null, + "capture_method": "automatic", + "client_secret": "pi_3OlKI1QNFa3smszT1eEui4Zp_secret_X1t4oelBlgyqlYql0VMNVM2hi", + "confirmation_method": "automatic", + "created": 1708300857, + "currency": "aud", + "customer": null, + "description": null, + "invoice": null, + "last_payment_error": null, + "latest_charge": "ch_3OlKI1QNFa3smszT1rtKexTu", + "livemode": false, + "metadata": {}, + "next_action": null, + "on_behalf_of": null, + "payment_method": "pm_1OlKI1QNFa3smszTik1VHwK4", + "payment_method_configuration_details": null, + "payment_method_options": { + "card": { + "installments": null, + "mandate_options": null, + "network": null, + "request_three_d_secure": "automatic" + } + }, + "payment_method_types": [ + "card" + ], + "processing": null, + "receipt_email": null, + "review": null, + "setup_future_usage": null, + "shipping": null, + "source": null, + "statement_descriptor": null, + "statement_descriptor_suffix": null, + "status": "succeeded", + "transfer_data": null, + "transfer_group": null + } + recorded_at: Mon, 19 Feb 2024 00:00:59 GMT +- request: + method: get + uri: https://api.stripe.com/v1/payment_intents/pi_3OlKI1QNFa3smszT1eEui4Zp + body: + encoding: US-ASCII + string: '' + headers: + Authorization: + - Basic c2tfdGVzdF94RmdKUU9sWHBNQUZzb3p0endGQlRGaFAwMEhHN0J1Q0ptOg== + User-Agent: + - Stripe/v1 ActiveMerchantBindings/1.133.0 + Stripe-Version: + - '2020-08-27' + X-Stripe-Client-User-Agent: + - '{"bindings_version":"1.133.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","publisher":"active_merchant"}' + X-Stripe-Client-User-Metadata: + - '{"ip":null}' + Stripe-Account: + - acct_1OlKHzQNFa3smszT + Connection: + - close + 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: + - Mon, 19 Feb 2024 00:00:59 GMT + Content-Type: + - application/json + Content-Length: + - '5160' + Connection: + - close + 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_intents%2F%3Aintent; + 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_AtaDJgdpcQHQky + Stripe-Account: + - acct_1OlKHzQNFa3smszT + Stripe-Version: + - '2020-08-27' + Vary: + - Origin + X-Stripe-Routing-Context-Priority-Tier: + - api-testmode + Strict-Transport-Security: + - max-age=63072000; includeSubDomains; preload + body: + encoding: UTF-8 + string: |- + { + "id": "pi_3OlKI1QNFa3smszT1eEui4Zp", + "object": "payment_intent", + "amount": 1000, + "amount_capturable": 0, + "amount_details": { + "tip": {} + }, + "amount_received": 1000, + "application": "", + "application_fee_amount": null, + "automatic_payment_methods": null, + "canceled_at": null, + "cancellation_reason": null, + "capture_method": "automatic", + "charges": { + "object": "list", + "data": [ + { + "id": "ch_3OlKI1QNFa3smszT1rtKexTu", + "object": "charge", + "amount": 1000, + "amount_captured": 1000, + "amount_refunded": 0, + "application": "", + "application_fee": null, + "application_fee_amount": null, + "balance_transaction": "txn_3OlKI1QNFa3smszT1bZdXxBs", + "billing_details": { + "address": { + "city": null, + "country": null, + "line1": null, + "line2": null, + "postal_code": null, + "state": null + }, + "email": null, + "name": null, + "phone": null + }, + "calculated_statement_descriptor": "OFNOFNOFN", + "captured": true, + "created": 1708300858, + "currency": "aud", + "customer": null, + "description": null, + "destination": null, + "dispute": null, + "disputed": false, + "failure_balance_transaction": null, + "failure_code": null, + "failure_message": null, + "fraud_details": {}, + "invoice": null, + "livemode": false, + "metadata": {}, + "on_behalf_of": null, + "order": null, + "outcome": { + "network_status": "approved_by_network", + "reason": null, + "risk_level": "normal", + "risk_score": 43, + "seller_message": "Payment complete.", + "type": "authorized" + }, + "paid": true, + "payment_intent": "pi_3OlKI1QNFa3smszT1eEui4Zp", + "payment_method": "pm_1OlKI1QNFa3smszTik1VHwK4", + "payment_method_details": { + "card": { + "amount_authorized": 1000, + "brand": "mastercard", + "checks": { + "address_line1_check": null, + "address_postal_code_check": null, + "cvc_check": "pass" + }, + "country": "US", + "exp_month": 2, + "exp_year": 2025, + "extended_authorization": { + "status": "disabled" + }, + "fingerprint": "BL35fEFVcTTS5wpE", + "funding": "credit", + "incremental_authorization": { + "status": "unavailable" + }, + "installments": null, + "last4": "4444", + "mandate": null, + "multicapture": { + "status": "unavailable" + }, + "network": "mastercard", + "network_token": { + "used": false + }, + "overcapture": { + "maximum_amount_capturable": 1000, + "status": "unavailable" + }, + "three_d_secure": null, + "wallet": null + }, + "type": "card" + }, + "radar_options": {}, + "receipt_email": null, + "receipt_number": null, + "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xT2xLSHpRTkZhM3Ntc3pUKLu0yq4GMga6ue6o0Zw6LBZ-Lrb1L42SMIwiICUaTs-FYiznOZxn0WqA0wQ4GpcthxEecTEEJdnwRXF1", + "refunded": false, + "refunds": { + "object": "list", + "data": [], + "has_more": false, + "total_count": 0, + "url": "/v1/charges/ch_3OlKI1QNFa3smszT1rtKexTu/refunds" + }, + "review": null, + "shipping": null, + "source": null, + "source_transfer": null, + "statement_descriptor": null, + "statement_descriptor_suffix": null, + "status": "succeeded", + "transfer_data": null, + "transfer_group": null + } + ], + "has_more": false, + "total_count": 1, + "url": "/v1/charges?payment_intent=pi_3OlKI1QNFa3smszT1eEui4Zp" + }, + "client_secret": "pi_3OlKI1QNFa3smszT1eEui4Zp_secret_X1t4oelBlgyqlYql0VMNVM2hi", + "confirmation_method": "automatic", + "created": 1708300857, + "currency": "aud", + "customer": null, + "description": null, + "invoice": null, + "last_payment_error": null, + "latest_charge": "ch_3OlKI1QNFa3smszT1rtKexTu", + "livemode": false, + "metadata": {}, + "next_action": null, + "on_behalf_of": null, + "payment_method": "pm_1OlKI1QNFa3smszTik1VHwK4", + "payment_method_configuration_details": null, + "payment_method_options": { + "card": { + "installments": null, + "mandate_options": null, + "network": null, + "request_three_d_secure": "automatic" + } + }, + "payment_method_types": [ + "card" + ], + "processing": null, + "receipt_email": null, + "review": null, + "setup_future_usage": null, + "shipping": null, + "source": null, + "statement_descriptor": null, + "statement_descriptor_suffix": null, + "status": "succeeded", + "transfer_data": null, + "transfer_group": null + } + recorded_at: Mon, 19 Feb 2024 00:00:59 GMT +- request: + method: post + uri: https://api.stripe.com/v1/charges/ch_3OlKI1QNFa3smszT1rtKexTu/refunds + body: + encoding: UTF-8 + string: amount=1000&expand[0]=charge + headers: + Content-Type: + - application/x-www-form-urlencoded + Authorization: + - Basic c2tfdGVzdF94RmdKUU9sWHBNQUZzb3p0endGQlRGaFAwMEhHN0J1Q0ptOg== + User-Agent: + - Stripe/v1 ActiveMerchantBindings/1.133.0 + Stripe-Version: + - '2020-08-27' + X-Stripe-Client-User-Agent: + - '{"bindings_version":"1.133.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","publisher":"active_merchant"}' + X-Stripe-Client-User-Metadata: + - '{"ip":null}' + Stripe-Account: + - acct_1OlKHzQNFa3smszT + Connection: + - close + 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: + - Mon, 19 Feb 2024 00:01:01 GMT + Content-Type: + - application/json + Content-Length: + - '4536' + Connection: + - close + 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%2Fcharges%2F%3Acharge%2Frefunds; + 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: + - dc175b93-7af6-4ee5-87c4-7b4af723936a + Original-Request: + - req_zJckdZIVbiGT06 + Request-Id: + - req_zJckdZIVbiGT06 + Stripe-Account: + - acct_1OlKHzQNFa3smszT + Stripe-Should-Retry: + - 'false' + Stripe-Version: + - '2020-08-27' + Vary: + - Origin + X-Stripe-Routing-Context-Priority-Tier: + - api-testmode + Strict-Transport-Security: + - max-age=63072000; includeSubDomains; preload + body: + encoding: UTF-8 + string: |- + { + "id": "re_3OlKI1QNFa3smszT1aPqOnxP", + "object": "refund", + "amount": 1000, + "balance_transaction": "txn_3OlKI1QNFa3smszT1TnZo9j4", + "charge": { + "id": "ch_3OlKI1QNFa3smszT1rtKexTu", + "object": "charge", + "amount": 1000, + "amount_captured": 1000, + "amount_refunded": 1000, + "application": "", + "application_fee": null, + "application_fee_amount": null, + "balance_transaction": "txn_3OlKI1QNFa3smszT1bZdXxBs", + "billing_details": { + "address": { + "city": null, + "country": null, + "line1": null, + "line2": null, + "postal_code": null, + "state": null + }, + "email": null, + "name": null, + "phone": null + }, + "calculated_statement_descriptor": "OFNOFNOFN", + "captured": true, + "created": 1708300858, + "currency": "aud", + "customer": null, + "description": null, + "destination": null, + "dispute": null, + "disputed": false, + "failure_balance_transaction": null, + "failure_code": null, + "failure_message": null, + "fraud_details": {}, + "invoice": null, + "livemode": false, + "metadata": {}, + "on_behalf_of": null, + "order": null, + "outcome": { + "network_status": "approved_by_network", + "reason": null, + "risk_level": "normal", + "risk_score": 43, + "seller_message": "Payment complete.", + "type": "authorized" + }, + "paid": true, + "payment_intent": "pi_3OlKI1QNFa3smszT1eEui4Zp", + "payment_method": "pm_1OlKI1QNFa3smszTik1VHwK4", + "payment_method_details": { + "card": { + "amount_authorized": 1000, + "brand": "mastercard", + "checks": { + "address_line1_check": null, + "address_postal_code_check": null, + "cvc_check": "pass" + }, + "country": "US", + "exp_month": 2, + "exp_year": 2025, + "extended_authorization": { + "status": "disabled" + }, + "fingerprint": "BL35fEFVcTTS5wpE", + "funding": "credit", + "incremental_authorization": { + "status": "unavailable" + }, + "installments": null, + "last4": "4444", + "mandate": null, + "multicapture": { + "status": "unavailable" + }, + "network": "mastercard", + "network_token": { + "used": false + }, + "overcapture": { + "maximum_amount_capturable": 1000, + "status": "unavailable" + }, + "three_d_secure": null, + "wallet": null + }, + "type": "card" + }, + "radar_options": {}, + "receipt_email": null, + "receipt_number": null, + "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xT2xLSHpRTkZhM3Ntc3pUKLy0yq4GMgYE6ofv7Rg6LBYZKo7wsATsEsQeBImV_qP1fQeL93SY95EhOpNtA8I0Cwm9XKYcYytGPyV8", + "refunded": true, + "refunds": { + "object": "list", + "data": [ + { + "id": "re_3OlKI1QNFa3smszT1aPqOnxP", + "object": "refund", + "amount": 1000, + "balance_transaction": "txn_3OlKI1QNFa3smszT1TnZo9j4", + "charge": "ch_3OlKI1QNFa3smszT1rtKexTu", + "created": 1708300860, + "currency": "aud", + "destination_details": { + "card": { + "reference_status": "pending", + "reference_type": "acquirer_reference_number", + "type": "refund" + }, + "type": "card" + }, + "metadata": {}, + "payment_intent": "pi_3OlKI1QNFa3smszT1eEui4Zp", + "reason": null, + "receipt_number": null, + "source_transfer_reversal": null, + "status": "succeeded", + "transfer_reversal": null + } + ], + "has_more": false, + "total_count": 1, + "url": "/v1/charges/ch_3OlKI1QNFa3smszT1rtKexTu/refunds" + }, + "review": null, + "shipping": null, + "source": null, + "source_transfer": null, + "statement_descriptor": null, + "statement_descriptor_suffix": null, + "status": "succeeded", + "transfer_data": null, + "transfer_group": null + }, + "created": 1708300860, + "currency": "aud", + "destination_details": { + "card": { + "reference_status": "pending", + "reference_type": "acquirer_reference_number", + "type": "refund" + }, + "type": "card" + }, + "metadata": {}, + "payment_intent": "pi_3OlKI1QNFa3smszT1eEui4Zp", + "reason": null, + "receipt_number": null, + "source_transfer_reversal": null, + "status": "succeeded", + "transfer_reversal": null + } + recorded_at: Mon, 19 Feb 2024 00:01:01 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/fixtures/vcr_cassettes/Stripe-v10.9.0/Spree_Gateway_StripeSCA/_error_message/when_payment_intent_state_is_not_in_requires_capture_state/does_not_succeed_if_payment_intent_state_is_not_requires_capture.yml b/spec/fixtures/vcr_cassettes/Stripe-v10.9.0/Spree_Gateway_StripeSCA/_error_message/when_payment_intent_state_is_not_in_requires_capture_state/does_not_succeed_if_payment_intent_state_is_not_requires_capture.yml index 5073c404dc..0aaa88dca0 100644 --- a/spec/fixtures/vcr_cassettes/Stripe-v10.9.0/Spree_Gateway_StripeSCA/_error_message/when_payment_intent_state_is_not_in_requires_capture_state/does_not_succeed_if_payment_intent_state_is_not_requires_capture.yml +++ b/spec/fixtures/vcr_cassettes/Stripe-v10.9.0/Spree_Gateway_StripeSCA/_error_message/when_payment_intent_state_is_not_in_requires_capture_state/does_not_succeed_if_payment_intent_state_is_not_requires_capture.yml @@ -1,27 +1,27 @@ --- http_interactions: - request: - method: post - uri: https://api.stripe.com/v1/payment_methods + method: get + uri: https://api.stripe.com/v1/payment_methods/pm_card_mastercard body: - encoding: UTF-8 - string: type=card&card[number]=4242424242424242&card[exp_month]=12&card[exp_year]=2025&card[cvc]=314 + encoding: US-ASCII + string: '' headers: User-Agent: - - Stripe/v1 RubyBindings/10.9.0 + - Stripe/v1 RubyBindings/10.2.0 Authorization: - - Bearer + - Bearer Content-Type: - application/x-www-form-urlencoded X-Stripe-Client-Telemetry: - - '{"last_request_metrics":{"request_id":"req_0uMthnY2adDsVr","request_duration_ms":955}}' + - '{"last_request_metrics":{"request_id":"req_3zPIl85xE98iJP","request_duration_ms":295}}' Stripe-Version: - '2023-10-16' X-Stripe-Client-User-Agent: - - '{"bindings_version":"10.9.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux - version 6.1.0-17-amd64 (debian-kernel@lists.debian.org) (gcc-12 (Debian 12.2.0-14) - 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT_DYNAMIC Debian - 6.1.69-1 (2023-12-30)","hostname":"blackbox"}' + - '{"bindings_version":"10.2.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 5.15.0-92-generic (buildd@lcy02-amd64-002) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) + 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #102~20.04.1-Ubuntu SMP Mon + Jan 15 13:09:14 UTC 2024","hostname":"gaetan-Dell-G15"}' Accept-Encoding: - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 Accept: @@ -34,11 +34,11 @@ http_interactions: Server: - nginx Date: - - Sun, 18 Feb 2024 23:01:48 GMT + - Mon, 12 Feb 2024 03:46:46 GMT Content-Type: - application/json Content-Length: - - '960' + - '942' Connection: - keep-alive Access-Control-Allow-Credentials: @@ -55,21 +55,18 @@ http_interactions: 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: - - 16efe530-35f3-4b4d-b07e-d8d8b1862ced - Original-Request: - - req_s7XlUZYvwV7DRk + - report-uri https://q.stripe.com/csp-report?p=v1%2Fpayment_methods%2F%3Apayment_method; + 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_s7XlUZYvwV7DRk - Stripe-Should-Retry: - - 'false' + - req_cTgKnTotXU2m08 Stripe-Version: - '2023-10-16' Vary: - Origin + X-Stripe-Non-Api-Overhead-Duration-Ms: + - '177.00000000000003' X-Stripe-Routing-Context-Priority-Tier: - api-testmode Strict-Transport-Security: @@ -78,7 +75,7 @@ http_interactions: encoding: UTF-8 string: |- { - "id": "pm_1OlJMmKuuB1fWySnHNgcZaCT", + "id": "pm_1OiqThGkyVbTBiYe79xZ1M6F", "object": "payment_method", "billing_details": { "address": { @@ -94,23 +91,22 @@ http_interactions: "phone": null }, "card": { - "brand": "visa", + "brand": "mastercard", "checks": { "address_line1_check": null, "address_postal_code_check": null, "cvc_check": "unchecked" }, "country": "US", - "display_brand": "visa", - "exp_month": 12, + "exp_month": 2, "exp_year": 2025, - "fingerprint": "6E6tgVjx6U65iHFV", + "fingerprint": "1Zr75a6zBSZLu0Zp", "funding": "credit", "generated_from": null, - "last4": "4242", + "last4": "4444", "networks": { "available": [ - "visa" + "mastercard" ], "preferred": null }, @@ -119,35 +115,35 @@ http_interactions: }, "wallet": null }, - "created": 1708297308, + "created": 1707709605, "customer": null, "livemode": false, "metadata": {}, "type": "card" } - recorded_at: Sun, 18 Feb 2024 23:01:49 GMT + recorded_at: Mon, 12 Feb 2024 03:46:46 GMT - request: method: post uri: https://api.stripe.com/v1/payment_intents body: encoding: UTF-8 - string: amount=1000¤cy=aud&payment_method=pm_1OlJMmKuuB1fWySnHNgcZaCT&payment_method_types[0]=card&capture_method=manual + string: amount=1000¤cy=aud&payment_method=pm_1OiqThGkyVbTBiYe79xZ1M6F&payment_method_types[0]=card&capture_method=manual headers: User-Agent: - - Stripe/v1 RubyBindings/10.9.0 + - Stripe/v1 RubyBindings/10.2.0 Authorization: - - Bearer + - Bearer Content-Type: - application/x-www-form-urlencoded X-Stripe-Client-Telemetry: - - '{"last_request_metrics":{"request_id":"req_s7XlUZYvwV7DRk","request_duration_ms":609}}' + - '{"last_request_metrics":{"request_id":"req_cTgKnTotXU2m08","request_duration_ms":414}}' Stripe-Version: - '2023-10-16' X-Stripe-Client-User-Agent: - - '{"bindings_version":"10.9.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux - version 6.1.0-17-amd64 (debian-kernel@lists.debian.org) (gcc-12 (Debian 12.2.0-14) - 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT_DYNAMIC Debian - 6.1.69-1 (2023-12-30)","hostname":"blackbox"}' + - '{"bindings_version":"10.2.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 5.15.0-92-generic (buildd@lcy02-amd64-002) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) + 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #102~20.04.1-Ubuntu SMP Mon + Jan 15 13:09:14 UTC 2024","hostname":"gaetan-Dell-G15"}' Accept-Encoding: - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 Accept: @@ -160,7 +156,7 @@ http_interactions: Server: - nginx Date: - - Sun, 18 Feb 2024 23:01:49 GMT + - Mon, 12 Feb 2024 03:46:46 GMT Content-Type: - application/json Content-Length: @@ -185,17 +181,19 @@ http_interactions: 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: - - b94f241f-9070-4cde-a9ba-ca5f5fa4c266 + - cbee6ab9-167f-4f87-bf9b-e756850cf038 Original-Request: - - req_C5dAJYEOBGfyxt + - req_1DypHzrDYgsR9w Request-Id: - - req_C5dAJYEOBGfyxt + - req_1DypHzrDYgsR9w Stripe-Should-Retry: - 'false' Stripe-Version: - '2023-10-16' Vary: - Origin + X-Stripe-Non-Api-Overhead-Duration-Ms: + - '184.0' X-Stripe-Routing-Context-Priority-Tier: - api-testmode Strict-Transport-Security: @@ -204,7 +202,7 @@ http_interactions: encoding: UTF-8 string: |- { - "id": "pi_3OlJMnKuuB1fWySn0OktZ9W6", + "id": "pi_3OiqTiGkyVbTBiYe1e33LyXE", "object": "payment_intent", "amount": 1000, "amount_capturable": 0, @@ -218,9 +216,9 @@ http_interactions: "canceled_at": null, "cancellation_reason": null, "capture_method": "manual", - "client_secret": "pi_3OlJMnKuuB1fWySn0OktZ9W6_secret_3fSpa587arHfeA8BNEORln5Me", + "client_secret": "pi_3OiqTiGkyVbTBiYe1e33LyXE_secret_Xv2XJAG5i7druXN4lekU5771E", "confirmation_method": "automatic", - "created": 1708297309, + "created": 1707709606, "currency": "aud", "customer": null, "description": null, @@ -231,7 +229,7 @@ http_interactions: "metadata": {}, "next_action": null, "on_behalf_of": null, - "payment_method": "pm_1OlJMmKuuB1fWySnHNgcZaCT", + "payment_method": "pm_1OiqThGkyVbTBiYe79xZ1M6F", "payment_method_configuration_details": null, "payment_method_options": { "card": { @@ -256,29 +254,29 @@ http_interactions: "transfer_data": null, "transfer_group": null } - recorded_at: Sun, 18 Feb 2024 23:01:49 GMT + recorded_at: Mon, 12 Feb 2024 03:46:46 GMT - request: method: get - uri: https://api.stripe.com/v1/payment_intents/pi_3OlJMnKuuB1fWySn0OktZ9W6 + uri: https://api.stripe.com/v1/payment_intents/pi_3OiqTiGkyVbTBiYe1e33LyXE body: encoding: US-ASCII string: '' headers: User-Agent: - - Stripe/v1 RubyBindings/10.9.0 + - Stripe/v1 RubyBindings/10.2.0 Authorization: - - Bearer + - Bearer Content-Type: - application/x-www-form-urlencoded X-Stripe-Client-Telemetry: - - '{"last_request_metrics":{"request_id":"req_C5dAJYEOBGfyxt","request_duration_ms":403}}' + - '{"last_request_metrics":{"request_id":"req_1DypHzrDYgsR9w","request_duration_ms":387}}' Stripe-Version: - '2023-10-16' X-Stripe-Client-User-Agent: - - '{"bindings_version":"10.9.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux - version 6.1.0-17-amd64 (debian-kernel@lists.debian.org) (gcc-12 (Debian 12.2.0-14) - 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT_DYNAMIC Debian - 6.1.69-1 (2023-12-30)","hostname":"blackbox"}' + - '{"bindings_version":"10.2.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 5.15.0-92-generic (buildd@lcy02-amd64-002) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) + 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #102~20.04.1-Ubuntu SMP Mon + Jan 15 13:09:14 UTC 2024","hostname":"gaetan-Dell-G15"}' Accept-Encoding: - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 Accept: @@ -291,7 +289,7 @@ http_interactions: Server: - nginx Date: - - Sun, 18 Feb 2024 23:01:49 GMT + - Mon, 12 Feb 2024 03:46:46 GMT Content-Type: - application/json Content-Length: @@ -317,11 +315,13 @@ http_interactions: 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self' Request-Id: - - req_x4tAh20i3zA59E + - req_41RUDZ0JcBgpJK Stripe-Version: - '2023-10-16' Vary: - Origin + X-Stripe-Non-Api-Overhead-Duration-Ms: + - '57.99999999999999' X-Stripe-Routing-Context-Priority-Tier: - api-testmode Strict-Transport-Security: @@ -330,7 +330,7 @@ http_interactions: encoding: UTF-8 string: |- { - "id": "pi_3OlJMnKuuB1fWySn0OktZ9W6", + "id": "pi_3OiqTiGkyVbTBiYe1e33LyXE", "object": "payment_intent", "amount": 1000, "amount_capturable": 0, @@ -344,9 +344,9 @@ http_interactions: "canceled_at": null, "cancellation_reason": null, "capture_method": "manual", - "client_secret": "pi_3OlJMnKuuB1fWySn0OktZ9W6_secret_3fSpa587arHfeA8BNEORln5Me", + "client_secret": "pi_3OiqTiGkyVbTBiYe1e33LyXE_secret_Xv2XJAG5i7druXN4lekU5771E", "confirmation_method": "automatic", - "created": 1708297309, + "created": 1707709606, "currency": "aud", "customer": null, "description": null, @@ -357,7 +357,7 @@ http_interactions: "metadata": {}, "next_action": null, "on_behalf_of": null, - "payment_method": "pm_1OlJMmKuuB1fWySnHNgcZaCT", + "payment_method": "pm_1OiqThGkyVbTBiYe79xZ1M6F", "payment_method_configuration_details": null, "payment_method_options": { "card": { @@ -382,5 +382,5 @@ http_interactions: "transfer_data": null, "transfer_group": null } - recorded_at: Sun, 18 Feb 2024 23:01:49 GMT + recorded_at: Mon, 12 Feb 2024 03:46:46 GMT recorded_with: VCR 6.2.0 diff --git a/spec/fixtures/vcr_cassettes/Stripe-v10.9.0/Spree_Gateway_StripeSCA/_purchase/completes_the_purchase.yml b/spec/fixtures/vcr_cassettes/Stripe-v10.9.0/Spree_Gateway_StripeSCA/_purchase/completes_the_purchase.yml index 197a6890f9..9cb825d16d 100644 --- a/spec/fixtures/vcr_cassettes/Stripe-v10.9.0/Spree_Gateway_StripeSCA/_purchase/completes_the_purchase.yml +++ b/spec/fixtures/vcr_cassettes/Stripe-v10.9.0/Spree_Gateway_StripeSCA/_purchase/completes_the_purchase.yml @@ -1,27 +1,25 @@ --- http_interactions: - request: - method: post - uri: https://api.stripe.com/v1/payment_methods + method: get + uri: https://api.stripe.com/v1/payment_methods/pm_card_mastercard body: - encoding: UTF-8 - string: type=card&card[number]=4242424242424242&card[exp_month]=12&card[exp_year]=2025&card[cvc]=314 + encoding: US-ASCII + string: '' headers: User-Agent: - - Stripe/v1 RubyBindings/10.9.0 + - Stripe/v1 RubyBindings/10.2.0 Authorization: - - Bearer + - Bearer Content-Type: - application/x-www-form-urlencoded - X-Stripe-Client-Telemetry: - - '{"last_request_metrics":{"request_id":"req_51om1IRAHFZCV6","request_duration_ms":496}}' Stripe-Version: - '2023-10-16' X-Stripe-Client-User-Agent: - - '{"bindings_version":"10.9.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux - version 6.1.0-17-amd64 (debian-kernel@lists.debian.org) (gcc-12 (Debian 12.2.0-14) - 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT_DYNAMIC Debian - 6.1.69-1 (2023-12-30)","hostname":"blackbox"}' + - '{"bindings_version":"10.2.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 5.15.0-92-generic (buildd@lcy02-amd64-002) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) + 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #102~20.04.1-Ubuntu SMP Mon + Jan 15 13:09:14 UTC 2024","hostname":"gaetan-Dell-G15"}' Accept-Encoding: - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 Accept: @@ -34,11 +32,11 @@ http_interactions: Server: - nginx Date: - - Sun, 18 Feb 2024 23:01:39 GMT + - Mon, 12 Feb 2024 03:46:31 GMT Content-Type: - application/json Content-Length: - - '960' + - '942' Connection: - keep-alive Access-Control-Allow-Credentials: @@ -55,21 +53,18 @@ http_interactions: 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: - - 1544bce0-8504-40ae-85e6-99567c05a81f - Original-Request: - - req_ZZHpIWmt0Tb9QC + - report-uri https://q.stripe.com/csp-report?p=v1%2Fpayment_methods%2F%3Apayment_method; + 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_ZZHpIWmt0Tb9QC - Stripe-Should-Retry: - - 'false' + - req_hFFx1UFSv39xhy Stripe-Version: - '2023-10-16' Vary: - Origin + X-Stripe-Non-Api-Overhead-Duration-Ms: + - '138.0' X-Stripe-Routing-Context-Priority-Tier: - api-testmode Strict-Transport-Security: @@ -78,7 +73,7 @@ http_interactions: encoding: UTF-8 string: |- { - "id": "pm_1OlJMdKuuB1fWySnSN7kwt4O", + "id": "pm_1OiqTSGkyVbTBiYegXlSZpe8", "object": "payment_method", "billing_details": { "address": { @@ -94,23 +89,22 @@ http_interactions: "phone": null }, "card": { - "brand": "visa", + "brand": "mastercard", "checks": { "address_line1_check": null, "address_postal_code_check": null, "cvc_check": "unchecked" }, "country": "US", - "display_brand": "visa", - "exp_month": 12, + "exp_month": 2, "exp_year": 2025, - "fingerprint": "6E6tgVjx6U65iHFV", + "fingerprint": "1Zr75a6zBSZLu0Zp", "funding": "credit", "generated_from": null, - "last4": "4242", + "last4": "4444", "networks": { "available": [ - "visa" + "mastercard" ], "preferred": null }, @@ -119,35 +113,35 @@ http_interactions: }, "wallet": null }, - "created": 1708297299, + "created": 1707709590, "customer": null, "livemode": false, "metadata": {}, "type": "card" } - recorded_at: Sun, 18 Feb 2024 23:01:39 GMT + recorded_at: Mon, 12 Feb 2024 03:46:31 GMT - request: method: post uri: https://api.stripe.com/v1/payment_intents body: encoding: UTF-8 - string: amount=1000¤cy=aud&payment_method=pm_1OlJMdKuuB1fWySnSN7kwt4O&payment_method_types[0]=card&capture_method=manual + string: amount=1000¤cy=aud&payment_method=pm_1OiqTSGkyVbTBiYegXlSZpe8&payment_method_types[0]=card&capture_method=manual headers: User-Agent: - - Stripe/v1 RubyBindings/10.9.0 + - Stripe/v1 RubyBindings/10.2.0 Authorization: - - Bearer + - Bearer Content-Type: - application/x-www-form-urlencoded X-Stripe-Client-Telemetry: - - '{"last_request_metrics":{"request_id":"req_ZZHpIWmt0Tb9QC","request_duration_ms":571}}' + - '{"last_request_metrics":{"request_id":"req_hFFx1UFSv39xhy","request_duration_ms":531}}' Stripe-Version: - '2023-10-16' X-Stripe-Client-User-Agent: - - '{"bindings_version":"10.9.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux - version 6.1.0-17-amd64 (debian-kernel@lists.debian.org) (gcc-12 (Debian 12.2.0-14) - 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT_DYNAMIC Debian - 6.1.69-1 (2023-12-30)","hostname":"blackbox"}' + - '{"bindings_version":"10.2.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 5.15.0-92-generic (buildd@lcy02-amd64-002) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) + 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #102~20.04.1-Ubuntu SMP Mon + Jan 15 13:09:14 UTC 2024","hostname":"gaetan-Dell-G15"}' Accept-Encoding: - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 Accept: @@ -160,7 +154,7 @@ http_interactions: Server: - nginx Date: - - Sun, 18 Feb 2024 23:01:40 GMT + - Mon, 12 Feb 2024 03:46:31 GMT Content-Type: - application/json Content-Length: @@ -185,17 +179,19 @@ http_interactions: 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: - - 948c081d-dd9b-42fe-8904-c66806ba6ced + - 00d5f1c9-b2ef-4a0c-b3ca-91336529c64a Original-Request: - - req_gWoQz3c7XBT7zK + - req_6LkNIZildZ9rlK Request-Id: - - req_gWoQz3c7XBT7zK + - req_6LkNIZildZ9rlK Stripe-Should-Retry: - 'false' Stripe-Version: - '2023-10-16' Vary: - Origin + X-Stripe-Non-Api-Overhead-Duration-Ms: + - '178.0' X-Stripe-Routing-Context-Priority-Tier: - api-testmode Strict-Transport-Security: @@ -204,7 +200,7 @@ http_interactions: encoding: UTF-8 string: |- { - "id": "pi_3OlJMdKuuB1fWySn1mC3Z7lL", + "id": "pi_3OiqTTGkyVbTBiYe0oEyxvMp", "object": "payment_intent", "amount": 1000, "amount_capturable": 0, @@ -218,9 +214,9 @@ http_interactions: "canceled_at": null, "cancellation_reason": null, "capture_method": "manual", - "client_secret": "pi_3OlJMdKuuB1fWySn1mC3Z7lL_secret_A5cHGtk5DKIuxGVjMQtq0RMlA", + "client_secret": "pi_3OiqTTGkyVbTBiYe0oEyxvMp_secret_fEWUt67pPAN7ia8aNL7R1ePM9", "confirmation_method": "automatic", - "created": 1708297299, + "created": 1707709591, "currency": "aud", "customer": null, "description": null, @@ -231,7 +227,7 @@ http_interactions: "metadata": {}, "next_action": null, "on_behalf_of": null, - "payment_method": "pm_1OlJMdKuuB1fWySnSN7kwt4O", + "payment_method": "pm_1OiqTSGkyVbTBiYegXlSZpe8", "payment_method_configuration_details": null, "payment_method_options": { "card": { @@ -256,29 +252,29 @@ http_interactions: "transfer_data": null, "transfer_group": null } - recorded_at: Sun, 18 Feb 2024 23:01:40 GMT + recorded_at: Mon, 12 Feb 2024 03:46:31 GMT - request: method: post - uri: https://api.stripe.com/v1/payment_intents/pi_3OlJMdKuuB1fWySn1mC3Z7lL/confirm + uri: https://api.stripe.com/v1/payment_intents/pi_3OiqTTGkyVbTBiYe0oEyxvMp/confirm body: encoding: US-ASCII string: '' headers: User-Agent: - - Stripe/v1 RubyBindings/10.9.0 + - Stripe/v1 RubyBindings/10.2.0 Authorization: - - Bearer + - Bearer Content-Type: - application/x-www-form-urlencoded X-Stripe-Client-Telemetry: - - '{"last_request_metrics":{"request_id":"req_gWoQz3c7XBT7zK","request_duration_ms":580}}' + - '{"last_request_metrics":{"request_id":"req_6LkNIZildZ9rlK","request_duration_ms":484}}' Stripe-Version: - '2023-10-16' X-Stripe-Client-User-Agent: - - '{"bindings_version":"10.9.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux - version 6.1.0-17-amd64 (debian-kernel@lists.debian.org) (gcc-12 (Debian 12.2.0-14) - 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT_DYNAMIC Debian - 6.1.69-1 (2023-12-30)","hostname":"blackbox"}' + - '{"bindings_version":"10.2.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 5.15.0-92-generic (buildd@lcy02-amd64-002) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) + 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #102~20.04.1-Ubuntu SMP Mon + Jan 15 13:09:14 UTC 2024","hostname":"gaetan-Dell-G15"}' Accept-Encoding: - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 Accept: @@ -291,7 +287,7 @@ http_interactions: Server: - nginx Date: - - Sun, 18 Feb 2024 23:01:41 GMT + - Mon, 12 Feb 2024 03:46:32 GMT Content-Type: - application/json Content-Length: @@ -317,17 +313,19 @@ http_interactions: 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self' Idempotency-Key: - - 870a6954-88b1-467c-8fa9-277015f3722e + - cad3cbd3-85ec-45d6-af7e-db634c5396be Original-Request: - - req_afZee7GuNtasTS + - req_c0YFD1rixOGBNW Request-Id: - - req_afZee7GuNtasTS + - req_c0YFD1rixOGBNW Stripe-Should-Retry: - 'false' Stripe-Version: - '2023-10-16' Vary: - Origin + X-Stripe-Non-Api-Overhead-Duration-Ms: + - '713.0' X-Stripe-Routing-Context-Priority-Tier: - api-testmode Strict-Transport-Security: @@ -336,7 +334,7 @@ http_interactions: encoding: UTF-8 string: |- { - "id": "pi_3OlJMdKuuB1fWySn1mC3Z7lL", + "id": "pi_3OiqTTGkyVbTBiYe0oEyxvMp", "object": "payment_intent", "amount": 1000, "amount_capturable": 1000, @@ -350,20 +348,20 @@ http_interactions: "canceled_at": null, "cancellation_reason": null, "capture_method": "manual", - "client_secret": "pi_3OlJMdKuuB1fWySn1mC3Z7lL_secret_A5cHGtk5DKIuxGVjMQtq0RMlA", + "client_secret": "pi_3OiqTTGkyVbTBiYe0oEyxvMp_secret_fEWUt67pPAN7ia8aNL7R1ePM9", "confirmation_method": "automatic", - "created": 1708297299, + "created": 1707709591, "currency": "aud", "customer": null, "description": null, "invoice": null, "last_payment_error": null, - "latest_charge": "ch_3OlJMdKuuB1fWySn1Si9UkuX", + "latest_charge": "ch_3OiqTTGkyVbTBiYe0jeLlsRt", "livemode": false, "metadata": {}, "next_action": null, "on_behalf_of": null, - "payment_method": "pm_1OlJMdKuuB1fWySnSN7kwt4O", + "payment_method": "pm_1OiqTSGkyVbTBiYegXlSZpe8", "payment_method_configuration_details": null, "payment_method_options": { "card": { @@ -388,29 +386,29 @@ http_interactions: "transfer_data": null, "transfer_group": null } - recorded_at: Sun, 18 Feb 2024 23:01:41 GMT + recorded_at: Mon, 12 Feb 2024 03:46:32 GMT - request: method: get - uri: https://api.stripe.com/v1/payment_intents/pi_3OlJMdKuuB1fWySn1mC3Z7lL + uri: https://api.stripe.com/v1/payment_intents/pi_3OiqTTGkyVbTBiYe0oEyxvMp body: encoding: US-ASCII string: '' headers: User-Agent: - - Stripe/v1 RubyBindings/10.9.0 + - Stripe/v1 RubyBindings/10.2.0 Authorization: - - Bearer + - Bearer Content-Type: - application/x-www-form-urlencoded X-Stripe-Client-Telemetry: - - '{"last_request_metrics":{"request_id":"req_afZee7GuNtasTS","request_duration_ms":1147}}' + - '{"last_request_metrics":{"request_id":"req_c0YFD1rixOGBNW","request_duration_ms":921}}' Stripe-Version: - '2023-10-16' X-Stripe-Client-User-Agent: - - '{"bindings_version":"10.9.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux - version 6.1.0-17-amd64 (debian-kernel@lists.debian.org) (gcc-12 (Debian 12.2.0-14) - 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT_DYNAMIC Debian - 6.1.69-1 (2023-12-30)","hostname":"blackbox"}' + - '{"bindings_version":"10.2.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 5.15.0-92-generic (buildd@lcy02-amd64-002) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) + 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #102~20.04.1-Ubuntu SMP Mon + Jan 15 13:09:14 UTC 2024","hostname":"gaetan-Dell-G15"}' Accept-Encoding: - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 Accept: @@ -423,7 +421,7 @@ http_interactions: Server: - nginx Date: - - Sun, 18 Feb 2024 23:01:43 GMT + - Mon, 12 Feb 2024 03:46:34 GMT Content-Type: - application/json Content-Length: @@ -449,11 +447,13 @@ http_interactions: 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self' Request-Id: - - req_nvxMljuYGpNN36 + - req_SnM5lbQViqtjbG Stripe-Version: - '2023-10-16' Vary: - Origin + X-Stripe-Non-Api-Overhead-Duration-Ms: + - '70.0' X-Stripe-Routing-Context-Priority-Tier: - api-testmode Strict-Transport-Security: @@ -462,7 +462,7 @@ http_interactions: encoding: UTF-8 string: |- { - "id": "pi_3OlJMdKuuB1fWySn1mC3Z7lL", + "id": "pi_3OiqTTGkyVbTBiYe0oEyxvMp", "object": "payment_intent", "amount": 1000, "amount_capturable": 1000, @@ -476,20 +476,20 @@ http_interactions: "canceled_at": null, "cancellation_reason": null, "capture_method": "manual", - "client_secret": "pi_3OlJMdKuuB1fWySn1mC3Z7lL_secret_A5cHGtk5DKIuxGVjMQtq0RMlA", + "client_secret": "pi_3OiqTTGkyVbTBiYe0oEyxvMp_secret_fEWUt67pPAN7ia8aNL7R1ePM9", "confirmation_method": "automatic", - "created": 1708297299, + "created": 1707709591, "currency": "aud", "customer": null, "description": null, "invoice": null, "last_payment_error": null, - "latest_charge": "ch_3OlJMdKuuB1fWySn1Si9UkuX", + "latest_charge": "ch_3OiqTTGkyVbTBiYe0jeLlsRt", "livemode": false, "metadata": {}, "next_action": null, "on_behalf_of": null, - "payment_method": "pm_1OlJMdKuuB1fWySnSN7kwt4O", + "payment_method": "pm_1OiqTSGkyVbTBiYegXlSZpe8", "payment_method_configuration_details": null, "payment_method_options": { "card": { @@ -514,10 +514,10 @@ http_interactions: "transfer_data": null, "transfer_group": null } - recorded_at: Sun, 18 Feb 2024 23:01:43 GMT + recorded_at: Mon, 12 Feb 2024 03:46:34 GMT - request: method: post - uri: https://api.stripe.com/v1/payment_intents/pi_3OlJMdKuuB1fWySn1mC3Z7lL/capture + uri: https://api.stripe.com/v1/payment_intents/pi_3OiqTTGkyVbTBiYe0oEyxvMp/capture body: encoding: UTF-8 string: amount_to_capture=1000 @@ -525,13 +525,13 @@ http_interactions: Content-Type: - application/x-www-form-urlencoded Authorization: - - Basic c2tfdGVzdF94RmdKUU9sWHBNQUZzb3p0endGQlRGaFAwMEhHN0J1Q0ptOg== + - Basic c2tfdGVzdF9HRlFXMnU4c2xsbmxBTzYxN2FUODFRdko6 User-Agent: - - Stripe/v1 ActiveMerchantBindings/1.123.0 + - Stripe/v1 ActiveMerchantBindings/1.133.0 Stripe-Version: - - '2019-05-16' + - '2020-08-27' X-Stripe-Client-User-Agent: - - '{"bindings_version":"1.123.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","publisher":"active_merchant"}' + - '{"bindings_version":"1.133.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","publisher":"active_merchant"}' X-Stripe-Client-User-Metadata: - '{"ip":null}' Connection: @@ -548,11 +548,11 @@ http_interactions: Server: - nginx Date: - - Sun, 18 Feb 2024 23:01:44 GMT + - Mon, 12 Feb 2024 03:46:35 GMT Content-Type: - application/json Content-Length: - - '5152' + - '5138' Connection: - close Access-Control-Allow-Credentials: @@ -574,17 +574,19 @@ http_interactions: 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self' Idempotency-Key: - - 517a8ae3-9501-48d9-9225-51eb365643bb + - 180b5f53-661c-4d2b-acb6-24bde086c561 Original-Request: - - req_OIwCtiBaYsGTF8 + - req_1hdxqRBMl4cNHD Request-Id: - - req_OIwCtiBaYsGTF8 + - req_1hdxqRBMl4cNHD Stripe-Should-Retry: - 'false' Stripe-Version: - - '2019-05-16' + - '2020-08-27' Vary: - Origin + X-Stripe-Non-Api-Overhead-Duration-Ms: + - '778.0' X-Stripe-Routing-Context-Priority-Tier: - api-testmode Strict-Transport-Security: @@ -593,7 +595,7 @@ http_interactions: encoding: UTF-8 string: |- { - "id": "pi_3OlJMdKuuB1fWySn1mC3Z7lL", + "id": "pi_3OiqTTGkyVbTBiYe0oEyxvMp", "object": "payment_intent", "amount": 1000, "amount_capturable": 0, @@ -611,16 +613,15 @@ http_interactions: "object": "list", "data": [ { - "id": "ch_3OlJMdKuuB1fWySn1Si9UkuX", + "id": "ch_3OiqTTGkyVbTBiYe0jeLlsRt", "object": "charge", "amount": 1000, "amount_captured": 1000, "amount_refunded": 0, - "amount_updates": [], "application": null, "application_fee": null, "application_fee_amount": null, - "balance_transaction": "txn_3OlJMdKuuB1fWySn1EtKks3E", + "balance_transaction": "txn_3OiqTTGkyVbTBiYe068H10eP", "billing_details": { "address": { "city": null, @@ -634,9 +635,9 @@ http_interactions: "name": null, "phone": null }, - "calculated_statement_descriptor": "OFNOFNOFN", + "calculated_statement_descriptor": "OPENFOODNETWORK", "captured": true, - "created": 1708297300, + "created": 1707709592, "currency": "aud", "customer": null, "description": null, @@ -656,41 +657,41 @@ http_interactions: "network_status": "approved_by_network", "reason": null, "risk_level": "normal", - "risk_score": 50, + "risk_score": 2, "seller_message": "Payment complete.", "type": "authorized" }, "paid": true, - "payment_intent": "pi_3OlJMdKuuB1fWySn1mC3Z7lL", - "payment_method": "pm_1OlJMdKuuB1fWySnSN7kwt4O", + "payment_intent": "pi_3OiqTTGkyVbTBiYe0oEyxvMp", + "payment_method": "pm_1OiqTSGkyVbTBiYegXlSZpe8", "payment_method_details": { "card": { "amount_authorized": 1000, - "brand": "visa", - "capture_before": 1708902100, + "brand": "mastercard", + "capture_before": 1708314392, "checks": { "address_line1_check": null, "address_postal_code_check": null, "cvc_check": "pass" }, "country": "US", - "exp_month": 12, + "exp_month": 2, "exp_year": 2025, "extended_authorization": { "status": "disabled" }, - "fingerprint": "6E6tgVjx6U65iHFV", + "fingerprint": "1Zr75a6zBSZLu0Zp", "funding": "credit", "incremental_authorization": { "status": "unavailable" }, "installments": null, - "last4": "4242", + "last4": "4444", "mandate": null, "multicapture": { "status": "unavailable" }, - "network": "visa", + "network": "mastercard", "network_token": { "used": false }, @@ -706,14 +707,14 @@ http_interactions: "radar_options": {}, "receipt_email": null, "receipt_number": null, - "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xRmlxRXNLdXVCMWZXeVNuKNiYyq4GMgaRL-XiUw86LBZE508pdjPqCQjn3Qti4m-zS9ApaX9PdD7COJl9LEw4dcNQKFdVD-7D8l3g", + "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xQVBRcmVHa3lWYlRCaVllKJuppq4GMgZqhtW4UmU6LBb6C-hm4GQkFY_GabTkAfy0cZ1SwjrcaIGPt4NbAQObuJfLF2dsVRziJCiV", "refunded": false, "refunds": { "object": "list", "data": [], "has_more": false, "total_count": 0, - "url": "/v1/charges/ch_3OlJMdKuuB1fWySn1Si9UkuX/refunds" + "url": "/v1/charges/ch_3OiqTTGkyVbTBiYe0jeLlsRt/refunds" }, "review": null, "shipping": null, @@ -728,22 +729,22 @@ http_interactions: ], "has_more": false, "total_count": 1, - "url": "/v1/charges?payment_intent=pi_3OlJMdKuuB1fWySn1mC3Z7lL" + "url": "/v1/charges?payment_intent=pi_3OiqTTGkyVbTBiYe0oEyxvMp" }, - "client_secret": "pi_3OlJMdKuuB1fWySn1mC3Z7lL_secret_A5cHGtk5DKIuxGVjMQtq0RMlA", + "client_secret": "pi_3OiqTTGkyVbTBiYe0oEyxvMp_secret_fEWUt67pPAN7ia8aNL7R1ePM9", "confirmation_method": "automatic", - "created": 1708297299, + "created": 1707709591, "currency": "aud", "customer": null, "description": null, "invoice": null, "last_payment_error": null, - "latest_charge": "ch_3OlJMdKuuB1fWySn1Si9UkuX", + "latest_charge": "ch_3OiqTTGkyVbTBiYe0jeLlsRt", "livemode": false, "metadata": {}, "next_action": null, "on_behalf_of": null, - "payment_method": "pm_1OlJMdKuuB1fWySnSN7kwt4O", + "payment_method": "pm_1OiqTSGkyVbTBiYegXlSZpe8", "payment_method_configuration_details": null, "payment_method_options": { "card": { @@ -768,5 +769,5 @@ http_interactions: "transfer_data": null, "transfer_group": null } - recorded_at: Sun, 18 Feb 2024 23:01:44 GMT + recorded_at: Mon, 12 Feb 2024 03:46:35 GMT recorded_with: VCR 6.2.0 diff --git a/spec/fixtures/vcr_cassettes/Stripe-v10.9.0/Spree_Gateway_StripeSCA/_purchase/provides_an_error_message_to_help_developer_debug.yml b/spec/fixtures/vcr_cassettes/Stripe-v10.9.0/Spree_Gateway_StripeSCA/_purchase/provides_an_error_message_to_help_developer_debug.yml index c5a0be7f7d..4353de244d 100644 --- a/spec/fixtures/vcr_cassettes/Stripe-v10.9.0/Spree_Gateway_StripeSCA/_purchase/provides_an_error_message_to_help_developer_debug.yml +++ b/spec/fixtures/vcr_cassettes/Stripe-v10.9.0/Spree_Gateway_StripeSCA/_purchase/provides_an_error_message_to_help_developer_debug.yml @@ -1,27 +1,27 @@ --- http_interactions: - request: - method: post - uri: https://api.stripe.com/v1/payment_methods + method: get + uri: https://api.stripe.com/v1/payment_methods/pm_card_mastercard body: - encoding: UTF-8 - string: type=card&card[number]=4242424242424242&card[exp_month]=12&card[exp_year]=2025&card[cvc]=314 + encoding: US-ASCII + string: '' headers: User-Agent: - - Stripe/v1 RubyBindings/10.9.0 + - Stripe/v1 RubyBindings/10.2.0 Authorization: - - Bearer + - Bearer Content-Type: - application/x-www-form-urlencoded X-Stripe-Client-Telemetry: - - '{"last_request_metrics":{"request_id":"req_nvxMljuYGpNN36","request_duration_ms":417}}' + - '{"last_request_metrics":{"request_id":"req_SnM5lbQViqtjbG","request_duration_ms":358}}' Stripe-Version: - '2023-10-16' X-Stripe-Client-User-Agent: - - '{"bindings_version":"10.9.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux - version 6.1.0-17-amd64 (debian-kernel@lists.debian.org) (gcc-12 (Debian 12.2.0-14) - 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT_DYNAMIC Debian - 6.1.69-1 (2023-12-30)","hostname":"blackbox"}' + - '{"bindings_version":"10.2.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 5.15.0-92-generic (buildd@lcy02-amd64-002) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) + 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #102~20.04.1-Ubuntu SMP Mon + Jan 15 13:09:14 UTC 2024","hostname":"gaetan-Dell-G15"}' Accept-Encoding: - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 Accept: @@ -34,11 +34,11 @@ http_interactions: Server: - nginx Date: - - Sun, 18 Feb 2024 23:01:45 GMT + - Mon, 12 Feb 2024 03:46:35 GMT Content-Type: - application/json Content-Length: - - '960' + - '942' Connection: - keep-alive Access-Control-Allow-Credentials: @@ -55,21 +55,18 @@ http_interactions: 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: - - '0840ae80-e34d-4ca4-9b24-4872ef60a47b' - Original-Request: - - req_JdKtYmo8F5PGGZ + - report-uri https://q.stripe.com/csp-report?p=v1%2Fpayment_methods%2F%3Apayment_method; + 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_JdKtYmo8F5PGGZ - Stripe-Should-Retry: - - 'false' + - req_Wr1CrKPOYhGknI Stripe-Version: - '2023-10-16' Vary: - Origin + X-Stripe-Non-Api-Overhead-Duration-Ms: + - '144.00000000000003' X-Stripe-Routing-Context-Priority-Tier: - api-testmode Strict-Transport-Security: @@ -78,7 +75,7 @@ http_interactions: encoding: UTF-8 string: |- { - "id": "pm_1OlJMiKuuB1fWySn9UkunsGB", + "id": "pm_1OiqTXGkyVbTBiYeyvRuXFKv", "object": "payment_method", "billing_details": { "address": { @@ -94,23 +91,22 @@ http_interactions: "phone": null }, "card": { - "brand": "visa", + "brand": "mastercard", "checks": { "address_line1_check": null, "address_postal_code_check": null, "cvc_check": "unchecked" }, "country": "US", - "display_brand": "visa", - "exp_month": 12, + "exp_month": 2, "exp_year": 2025, - "fingerprint": "6E6tgVjx6U65iHFV", + "fingerprint": "1Zr75a6zBSZLu0Zp", "funding": "credit", "generated_from": null, - "last4": "4242", + "last4": "4444", "networks": { "available": [ - "visa" + "mastercard" ], "preferred": null }, @@ -119,35 +115,35 @@ http_interactions: }, "wallet": null }, - "created": 1708297305, + "created": 1707709595, "customer": null, "livemode": false, "metadata": {}, "type": "card" } - recorded_at: Sun, 18 Feb 2024 23:01:45 GMT + recorded_at: Mon, 12 Feb 2024 03:46:35 GMT - request: method: post uri: https://api.stripe.com/v1/payment_intents body: encoding: UTF-8 - string: amount=1000¤cy=aud&payment_method=pm_1OlJMiKuuB1fWySn9UkunsGB&payment_method_types[0]=card&capture_method=manual + string: amount=1000¤cy=aud&payment_method=pm_1OiqTXGkyVbTBiYeyvRuXFKv&payment_method_types[0]=card&capture_method=manual headers: User-Agent: - - Stripe/v1 RubyBindings/10.9.0 + - Stripe/v1 RubyBindings/10.2.0 Authorization: - - Bearer + - Bearer Content-Type: - application/x-www-form-urlencoded X-Stripe-Client-Telemetry: - - '{"last_request_metrics":{"request_id":"req_JdKtYmo8F5PGGZ","request_duration_ms":479}}' + - '{"last_request_metrics":{"request_id":"req_Wr1CrKPOYhGknI","request_duration_ms":354}}' Stripe-Version: - '2023-10-16' X-Stripe-Client-User-Agent: - - '{"bindings_version":"10.9.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux - version 6.1.0-17-amd64 (debian-kernel@lists.debian.org) (gcc-12 (Debian 12.2.0-14) - 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT_DYNAMIC Debian - 6.1.69-1 (2023-12-30)","hostname":"blackbox"}' + - '{"bindings_version":"10.2.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 5.15.0-92-generic (buildd@lcy02-amd64-002) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) + 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #102~20.04.1-Ubuntu SMP Mon + Jan 15 13:09:14 UTC 2024","hostname":"gaetan-Dell-G15"}' Accept-Encoding: - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 Accept: @@ -160,7 +156,7 @@ http_interactions: Server: - nginx Date: - - Sun, 18 Feb 2024 23:01:45 GMT + - Mon, 12 Feb 2024 03:46:35 GMT Content-Type: - application/json Content-Length: @@ -185,17 +181,19 @@ http_interactions: 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: - - b330b83b-e5d0-4df4-805f-b403a0cceac0 + - 451b60a5-f932-46c0-b101-5c67e1a9e6f2 Original-Request: - - req_pUQ6XBsrwBJj7c + - req_mOJcscgCtaoJZB Request-Id: - - req_pUQ6XBsrwBJj7c + - req_mOJcscgCtaoJZB Stripe-Should-Retry: - 'false' Stripe-Version: - '2023-10-16' Vary: - Origin + X-Stripe-Non-Api-Overhead-Duration-Ms: + - '197.0' X-Stripe-Routing-Context-Priority-Tier: - api-testmode Strict-Transport-Security: @@ -204,7 +202,7 @@ http_interactions: encoding: UTF-8 string: |- { - "id": "pi_3OlJMjKuuB1fWySn0hkOQ7rg", + "id": "pi_3OiqTXGkyVbTBiYe1KcfbvwC", "object": "payment_intent", "amount": 1000, "amount_capturable": 0, @@ -218,9 +216,9 @@ http_interactions: "canceled_at": null, "cancellation_reason": null, "capture_method": "manual", - "client_secret": "pi_3OlJMjKuuB1fWySn0hkOQ7rg_secret_jAW17UAwyZyLVD3FVMy2wf3Bh", + "client_secret": "pi_3OiqTXGkyVbTBiYe1KcfbvwC_secret_f7lFpbpOxCMEtBmvrK72gzHU5", "confirmation_method": "automatic", - "created": 1708297305, + "created": 1707709595, "currency": "aud", "customer": null, "description": null, @@ -231,7 +229,7 @@ http_interactions: "metadata": {}, "next_action": null, "on_behalf_of": null, - "payment_method": "pm_1OlJMiKuuB1fWySn9UkunsGB", + "payment_method": "pm_1OiqTXGkyVbTBiYeyvRuXFKv", "payment_method_configuration_details": null, "payment_method_options": { "card": { @@ -256,29 +254,29 @@ http_interactions: "transfer_data": null, "transfer_group": null } - recorded_at: Sun, 18 Feb 2024 23:01:45 GMT + recorded_at: Mon, 12 Feb 2024 03:46:36 GMT - request: method: post - uri: https://api.stripe.com/v1/payment_intents/pi_3OlJMjKuuB1fWySn0hkOQ7rg/confirm + uri: https://api.stripe.com/v1/payment_intents/pi_3OiqTXGkyVbTBiYe1KcfbvwC/confirm body: encoding: US-ASCII string: '' headers: User-Agent: - - Stripe/v1 RubyBindings/10.9.0 + - Stripe/v1 RubyBindings/10.2.0 Authorization: - - Bearer + - Bearer Content-Type: - application/x-www-form-urlencoded X-Stripe-Client-Telemetry: - - '{"last_request_metrics":{"request_id":"req_pUQ6XBsrwBJj7c","request_duration_ms":508}}' + - '{"last_request_metrics":{"request_id":"req_mOJcscgCtaoJZB","request_duration_ms":432}}' Stripe-Version: - '2023-10-16' X-Stripe-Client-User-Agent: - - '{"bindings_version":"10.9.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux - version 6.1.0-17-amd64 (debian-kernel@lists.debian.org) (gcc-12 (Debian 12.2.0-14) - 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT_DYNAMIC Debian - 6.1.69-1 (2023-12-30)","hostname":"blackbox"}' + - '{"bindings_version":"10.2.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 5.15.0-92-generic (buildd@lcy02-amd64-002) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) + 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #102~20.04.1-Ubuntu SMP Mon + Jan 15 13:09:14 UTC 2024","hostname":"gaetan-Dell-G15"}' Accept-Encoding: - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 Accept: @@ -291,7 +289,7 @@ http_interactions: Server: - nginx Date: - - Sun, 18 Feb 2024 23:01:46 GMT + - Mon, 12 Feb 2024 03:46:36 GMT Content-Type: - application/json Content-Length: @@ -317,17 +315,19 @@ http_interactions: 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self' Idempotency-Key: - - 97d0bf60-c1e6-4615-ad6c-edb10db55a49 + - e2c61e6c-52f3-428c-b539-6897feb57bd4 Original-Request: - - req_0uMthnY2adDsVr + - req_RQ4tnyZMxaTrfg Request-Id: - - req_0uMthnY2adDsVr + - req_RQ4tnyZMxaTrfg Stripe-Should-Retry: - 'false' Stripe-Version: - '2023-10-16' Vary: - Origin + X-Stripe-Non-Api-Overhead-Duration-Ms: + - '705.0' X-Stripe-Routing-Context-Priority-Tier: - api-testmode Strict-Transport-Security: @@ -336,7 +336,7 @@ http_interactions: encoding: UTF-8 string: |- { - "id": "pi_3OlJMjKuuB1fWySn0hkOQ7rg", + "id": "pi_3OiqTXGkyVbTBiYe1KcfbvwC", "object": "payment_intent", "amount": 1000, "amount_capturable": 1000, @@ -350,20 +350,20 @@ http_interactions: "canceled_at": null, "cancellation_reason": null, "capture_method": "manual", - "client_secret": "pi_3OlJMjKuuB1fWySn0hkOQ7rg_secret_jAW17UAwyZyLVD3FVMy2wf3Bh", + "client_secret": "pi_3OiqTXGkyVbTBiYe1KcfbvwC_secret_f7lFpbpOxCMEtBmvrK72gzHU5", "confirmation_method": "automatic", - "created": 1708297305, + "created": 1707709595, "currency": "aud", "customer": null, "description": null, "invoice": null, "last_payment_error": null, - "latest_charge": "ch_3OlJMjKuuB1fWySn0DrvIzRN", + "latest_charge": "ch_3OiqTXGkyVbTBiYe10IKjyYG", "livemode": false, "metadata": {}, "next_action": null, "on_behalf_of": null, - "payment_method": "pm_1OlJMiKuuB1fWySn9UkunsGB", + "payment_method": "pm_1OiqTXGkyVbTBiYeyvRuXFKv", "payment_method_configuration_details": null, "payment_method_options": { "card": { @@ -388,5 +388,5 @@ http_interactions: "transfer_data": null, "transfer_group": null } - recorded_at: Sun, 18 Feb 2024 23:01:46 GMT + recorded_at: Mon, 12 Feb 2024 03:46:36 GMT recorded_with: VCR 6.2.0 diff --git a/spec/fixtures/vcr_cassettes/Stripe-v10.9.0/Spree_Gateway_StripeSCA/_void/with_a_confirmed_payment/refunds_the_payment.yml b/spec/fixtures/vcr_cassettes/Stripe-v10.9.0/Spree_Gateway_StripeSCA/_void/with_a_confirmed_payment/refunds_the_payment.yml new file mode 100644 index 0000000000..5e735a01e1 --- /dev/null +++ b/spec/fixtures/vcr_cassettes/Stripe-v10.9.0/Spree_Gateway_StripeSCA/_void/with_a_confirmed_payment/refunds_the_payment.yml @@ -0,0 +1,1087 @@ +--- +http_interactions: +- request: + method: post + uri: https://api.stripe.com/v1/accounts + body: + encoding: UTF-8 + string: type=standard&country=AU&email=carrot.producer%40example.com + headers: + User-Agent: + - Stripe/v1 RubyBindings/10.9.0 + Authorization: + - Bearer + Content-Type: + - application/x-www-form-urlencoded + X-Stripe-Client-Telemetry: + - '{"last_request_metrics":{"request_id":"req_RQ4tnyZMxaTrfg","request_duration_ms":0}}' + Stripe-Version: + - '2023-10-16' + X-Stripe-Client-User-Agent: + - '{"bindings_version":"10.9.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 5.15.0-92-generic (buildd@lcy02-amd64-002) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) + 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #102~20.04.1-Ubuntu SMP Mon + Jan 15 13:09:14 UTC 2024","hostname":"gaetan-Dell-G15"}' + 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: + - Mon, 19 Feb 2024 00:00:45 GMT + Content-Type: + - application/json + Content-Length: + - '3046' + 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%2Faccounts; 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: + - ec06ceda-0e0e-47a1-9d8b-93966afcf72b + Original-Request: + - req_qyPQcwlNSpsRVT + Request-Id: + - req_qyPQcwlNSpsRVT + 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": "acct_1OlKHn4IGbVfXq1N", + "object": "account", + "business_profile": { + "annual_revenue": null, + "estimated_worker_count": null, + "mcc": null, + "name": null, + "product_description": null, + "support_address": null, + "support_email": null, + "support_phone": null, + "support_url": null, + "url": null + }, + "business_type": null, + "capabilities": {}, + "charges_enabled": false, + "controller": { + "is_controller": true, + "type": "application" + }, + "country": "AU", + "created": 1708300844, + "default_currency": "aud", + "details_submitted": false, + "email": "carrot.producer@example.com", + "external_accounts": { + "object": "list", + "data": [], + "has_more": false, + "total_count": 0, + "url": "/v1/accounts/acct_1OlKHn4IGbVfXq1N/external_accounts" + }, + "future_requirements": { + "alternatives": [], + "current_deadline": null, + "currently_due": [], + "disabled_reason": null, + "errors": [], + "eventually_due": [], + "past_due": [], + "pending_verification": [] + }, + "metadata": {}, + "payouts_enabled": false, + "requirements": { + "alternatives": [], + "current_deadline": null, + "currently_due": [ + "business_profile.product_description", + "business_profile.support_phone", + "business_profile.url", + "external_account", + "tos_acceptance.date", + "tos_acceptance.ip" + ], + "disabled_reason": "requirements.past_due", + "errors": [], + "eventually_due": [ + "business_profile.product_description", + "business_profile.support_phone", + "business_profile.url", + "external_account", + "tos_acceptance.date", + "tos_acceptance.ip" + ], + "past_due": [ + "external_account", + "tos_acceptance.date", + "tos_acceptance.ip" + ], + "pending_verification": [] + }, + "settings": { + "bacs_debit_payments": { + "display_name": null, + "service_user_number": null + }, + "branding": { + "icon": null, + "logo": null, + "primary_color": null, + "secondary_color": null + }, + "card_issuing": { + "tos_acceptance": { + "date": null, + "ip": null + } + }, + "card_payments": { + "decline_on": { + "avs_failure": false, + "cvc_failure": false + }, + "statement_descriptor_prefix": null, + "statement_descriptor_prefix_kana": null, + "statement_descriptor_prefix_kanji": null + }, + "dashboard": { + "display_name": null, + "timezone": "Etc/UTC" + }, + "invoices": { + "default_account_tax_ids": null + }, + "payments": { + "statement_descriptor": null, + "statement_descriptor_kana": null, + "statement_descriptor_kanji": null + }, + "payouts": { + "debit_negative_balances": true, + "schedule": { + "delay_days": 2, + "interval": "daily" + }, + "statement_descriptor": null + }, + "sepa_debit_payments": {} + }, + "tos_acceptance": { + "date": null, + "ip": null, + "user_agent": null + }, + "type": "standard" + } + recorded_at: Mon, 19 Feb 2024 00:00:45 GMT +- request: + method: get + uri: https://api.stripe.com/v1/payment_methods/pm_card_mastercard + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Stripe/v1 RubyBindings/10.9.0 + Authorization: + - Bearer + Content-Type: + - application/x-www-form-urlencoded + X-Stripe-Client-Telemetry: + - '{"last_request_metrics":{"request_id":"req_qyPQcwlNSpsRVT","request_duration_ms":2338}}' + Stripe-Version: + - '2023-10-16' + X-Stripe-Client-User-Agent: + - '{"bindings_version":"10.9.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 5.15.0-92-generic (buildd@lcy02-amd64-002) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) + 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #102~20.04.1-Ubuntu SMP Mon + Jan 15 13:09:14 UTC 2024","hostname":"gaetan-Dell-G15"}' + 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: + - Mon, 19 Feb 2024 00:00:46 GMT + Content-Type: + - application/json + Content-Length: + - '977' + 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; + 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_wKuzmpov6ASaSb + 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_1OlKHqKuuB1fWySnFEoTKGaZ", + "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": "mastercard", + "checks": { + "address_line1_check": null, + "address_postal_code_check": null, + "cvc_check": "unchecked" + }, + "country": "US", + "display_brand": "mastercard", + "exp_month": 2, + "exp_year": 2025, + "fingerprint": "BL35fEFVcTTS5wpE", + "funding": "credit", + "generated_from": null, + "last4": "4444", + "networks": { + "available": [ + "mastercard" + ], + "preferred": null + }, + "three_d_secure_usage": { + "supported": true + }, + "wallet": null + }, + "created": 1708300846, + "customer": null, + "livemode": false, + "metadata": {}, + "type": "card" + } + recorded_at: Mon, 19 Feb 2024 00:00:46 GMT +- request: + method: post + uri: https://api.stripe.com/v1/payment_intents + body: + encoding: UTF-8 + string: amount=1000¤cy=aud&payment_method=pm_card_mastercard&payment_method_types[0]=card&capture_method=automatic&confirm=true + headers: + User-Agent: + - Stripe/v1 RubyBindings/10.9.0 + Authorization: + - Bearer + Content-Type: + - application/x-www-form-urlencoded + X-Stripe-Client-Telemetry: + - '{"last_request_metrics":{"request_id":"req_wKuzmpov6ASaSb","request_duration_ms":454}}' + Stripe-Version: + - '2023-10-16' + X-Stripe-Client-User-Agent: + - '{"bindings_version":"10.9.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 5.15.0-92-generic (buildd@lcy02-amd64-002) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) + 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #102~20.04.1-Ubuntu SMP Mon + Jan 15 13:09:14 UTC 2024","hostname":"gaetan-Dell-G15"}' + Stripe-Account: + - acct_1OlKHn4IGbVfXq1N + 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: + - Mon, 19 Feb 2024 00:00:47 GMT + Content-Type: + - application/json + Content-Length: + - '1396' + 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_intents; 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: + - f9133ee4-438b-4d9e-b53a-e8dd67fc4bf5 + Original-Request: + - req_cUxnfdapoSVAW5 + Request-Id: + - req_cUxnfdapoSVAW5 + Stripe-Account: + - acct_1OlKHn4IGbVfXq1N + 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": "pi_3OlKHq4IGbVfXq1N1cjQgX3f", + "object": "payment_intent", + "amount": 1000, + "amount_capturable": 0, + "amount_details": { + "tip": {} + }, + "amount_received": 1000, + "application": "", + "application_fee_amount": null, + "automatic_payment_methods": null, + "canceled_at": null, + "cancellation_reason": null, + "capture_method": "automatic", + "client_secret": "pi_3OlKHq4IGbVfXq1N1cjQgX3f_secret_WIUGbKrXc8pCrw0cGyIF7WIFz", + "confirmation_method": "automatic", + "created": 1708300846, + "currency": "aud", + "customer": null, + "description": null, + "invoice": null, + "last_payment_error": null, + "latest_charge": "ch_3OlKHq4IGbVfXq1N1Ont3YNO", + "livemode": false, + "metadata": {}, + "next_action": null, + "on_behalf_of": null, + "payment_method": "pm_1OlKHq4IGbVfXq1NRLlk6sO0", + "payment_method_configuration_details": null, + "payment_method_options": { + "card": { + "installments": null, + "mandate_options": null, + "network": null, + "request_three_d_secure": "automatic" + } + }, + "payment_method_types": [ + "card" + ], + "processing": null, + "receipt_email": null, + "review": null, + "setup_future_usage": null, + "shipping": null, + "source": null, + "statement_descriptor": null, + "statement_descriptor_suffix": null, + "status": "succeeded", + "transfer_data": null, + "transfer_group": null + } + recorded_at: Mon, 19 Feb 2024 00:00:48 GMT +- request: + method: get + uri: https://api.stripe.com/v1/payment_intents/pi_3OlKHq4IGbVfXq1N1cjQgX3f + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Stripe/v1 RubyBindings/10.9.0 + Authorization: + - Bearer + Content-Type: + - application/x-www-form-urlencoded + X-Stripe-Client-Telemetry: + - '{"last_request_metrics":{"request_id":"req_cUxnfdapoSVAW5","request_duration_ms":1551}}' + Stripe-Version: + - '2023-10-16' + X-Stripe-Client-User-Agent: + - '{"bindings_version":"10.9.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 5.15.0-92-generic (buildd@lcy02-amd64-002) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) + 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #102~20.04.1-Ubuntu SMP Mon + Jan 15 13:09:14 UTC 2024","hostname":"gaetan-Dell-G15"}' + Stripe-Account: + - acct_1OlKHn4IGbVfXq1N + 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: + - Mon, 19 Feb 2024 00:00:48 GMT + Content-Type: + - application/json + Content-Length: + - '1396' + 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_intents%2F%3Aintent; + 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_31hlpB6NcLOMmV + Stripe-Account: + - acct_1OlKHn4IGbVfXq1N + 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": "pi_3OlKHq4IGbVfXq1N1cjQgX3f", + "object": "payment_intent", + "amount": 1000, + "amount_capturable": 0, + "amount_details": { + "tip": {} + }, + "amount_received": 1000, + "application": "", + "application_fee_amount": null, + "automatic_payment_methods": null, + "canceled_at": null, + "cancellation_reason": null, + "capture_method": "automatic", + "client_secret": "pi_3OlKHq4IGbVfXq1N1cjQgX3f_secret_WIUGbKrXc8pCrw0cGyIF7WIFz", + "confirmation_method": "automatic", + "created": 1708300846, + "currency": "aud", + "customer": null, + "description": null, + "invoice": null, + "last_payment_error": null, + "latest_charge": "ch_3OlKHq4IGbVfXq1N1Ont3YNO", + "livemode": false, + "metadata": {}, + "next_action": null, + "on_behalf_of": null, + "payment_method": "pm_1OlKHq4IGbVfXq1NRLlk6sO0", + "payment_method_configuration_details": null, + "payment_method_options": { + "card": { + "installments": null, + "mandate_options": null, + "network": null, + "request_three_d_secure": "automatic" + } + }, + "payment_method_types": [ + "card" + ], + "processing": null, + "receipt_email": null, + "review": null, + "setup_future_usage": null, + "shipping": null, + "source": null, + "statement_descriptor": null, + "statement_descriptor_suffix": null, + "status": "succeeded", + "transfer_data": null, + "transfer_group": null + } + recorded_at: Mon, 19 Feb 2024 00:00:48 GMT +- request: + method: get + uri: https://api.stripe.com/v1/payment_intents/pi_3OlKHq4IGbVfXq1N1cjQgX3f + body: + encoding: US-ASCII + string: '' + headers: + Authorization: + - Basic c2tfdGVzdF94RmdKUU9sWHBNQUZzb3p0endGQlRGaFAwMEhHN0J1Q0ptOg== + User-Agent: + - Stripe/v1 ActiveMerchantBindings/1.133.0 + Stripe-Version: + - '2020-08-27' + X-Stripe-Client-User-Agent: + - '{"bindings_version":"1.133.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","publisher":"active_merchant"}' + X-Stripe-Client-User-Metadata: + - '{"ip":null}' + Stripe-Account: + - acct_1OlKHn4IGbVfXq1N + Connection: + - close + 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: + - Mon, 19 Feb 2024 00:00:49 GMT + Content-Type: + - application/json + Content-Length: + - '5160' + Connection: + - close + 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_intents%2F%3Aintent; + 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_UJEcCq7OOtnIwI + Stripe-Account: + - acct_1OlKHn4IGbVfXq1N + Stripe-Version: + - '2020-08-27' + Vary: + - Origin + X-Stripe-Routing-Context-Priority-Tier: + - api-testmode + Strict-Transport-Security: + - max-age=63072000; includeSubDomains; preload + body: + encoding: UTF-8 + string: |- + { + "id": "pi_3OlKHq4IGbVfXq1N1cjQgX3f", + "object": "payment_intent", + "amount": 1000, + "amount_capturable": 0, + "amount_details": { + "tip": {} + }, + "amount_received": 1000, + "application": "", + "application_fee_amount": null, + "automatic_payment_methods": null, + "canceled_at": null, + "cancellation_reason": null, + "capture_method": "automatic", + "charges": { + "object": "list", + "data": [ + { + "id": "ch_3OlKHq4IGbVfXq1N1Ont3YNO", + "object": "charge", + "amount": 1000, + "amount_captured": 1000, + "amount_refunded": 0, + "application": "", + "application_fee": null, + "application_fee_amount": null, + "balance_transaction": "txn_3OlKHq4IGbVfXq1N1GJjELA4", + "billing_details": { + "address": { + "city": null, + "country": null, + "line1": null, + "line2": null, + "postal_code": null, + "state": null + }, + "email": null, + "name": null, + "phone": null + }, + "calculated_statement_descriptor": "OFNOFNOFN", + "captured": true, + "created": 1708300847, + "currency": "aud", + "customer": null, + "description": null, + "destination": null, + "dispute": null, + "disputed": false, + "failure_balance_transaction": null, + "failure_code": null, + "failure_message": null, + "fraud_details": {}, + "invoice": null, + "livemode": false, + "metadata": {}, + "on_behalf_of": null, + "order": null, + "outcome": { + "network_status": "approved_by_network", + "reason": null, + "risk_level": "normal", + "risk_score": 10, + "seller_message": "Payment complete.", + "type": "authorized" + }, + "paid": true, + "payment_intent": "pi_3OlKHq4IGbVfXq1N1cjQgX3f", + "payment_method": "pm_1OlKHq4IGbVfXq1NRLlk6sO0", + "payment_method_details": { + "card": { + "amount_authorized": 1000, + "brand": "mastercard", + "checks": { + "address_line1_check": null, + "address_postal_code_check": null, + "cvc_check": "pass" + }, + "country": "US", + "exp_month": 2, + "exp_year": 2025, + "extended_authorization": { + "status": "disabled" + }, + "fingerprint": "BL35fEFVcTTS5wpE", + "funding": "credit", + "incremental_authorization": { + "status": "unavailable" + }, + "installments": null, + "last4": "4444", + "mandate": null, + "multicapture": { + "status": "unavailable" + }, + "network": "mastercard", + "network_token": { + "used": false + }, + "overcapture": { + "maximum_amount_capturable": 1000, + "status": "unavailable" + }, + "three_d_secure": null, + "wallet": null + }, + "type": "card" + }, + "radar_options": {}, + "receipt_email": null, + "receipt_number": null, + "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xT2xLSG40SUdiVmZYcTFOKLG0yq4GMgZkKJasuBY6LBZfGji61KmlJs6E8u7Qoqlx0-uqmlTk4lhiXau-RR1qcP8gkT3JC77tPwzT", + "refunded": false, + "refunds": { + "object": "list", + "data": [], + "has_more": false, + "total_count": 0, + "url": "/v1/charges/ch_3OlKHq4IGbVfXq1N1Ont3YNO/refunds" + }, + "review": null, + "shipping": null, + "source": null, + "source_transfer": null, + "statement_descriptor": null, + "statement_descriptor_suffix": null, + "status": "succeeded", + "transfer_data": null, + "transfer_group": null + } + ], + "has_more": false, + "total_count": 1, + "url": "/v1/charges?payment_intent=pi_3OlKHq4IGbVfXq1N1cjQgX3f" + }, + "client_secret": "pi_3OlKHq4IGbVfXq1N1cjQgX3f_secret_WIUGbKrXc8pCrw0cGyIF7WIFz", + "confirmation_method": "automatic", + "created": 1708300846, + "currency": "aud", + "customer": null, + "description": null, + "invoice": null, + "last_payment_error": null, + "latest_charge": "ch_3OlKHq4IGbVfXq1N1Ont3YNO", + "livemode": false, + "metadata": {}, + "next_action": null, + "on_behalf_of": null, + "payment_method": "pm_1OlKHq4IGbVfXq1NRLlk6sO0", + "payment_method_configuration_details": null, + "payment_method_options": { + "card": { + "installments": null, + "mandate_options": null, + "network": null, + "request_three_d_secure": "automatic" + } + }, + "payment_method_types": [ + "card" + ], + "processing": null, + "receipt_email": null, + "review": null, + "setup_future_usage": null, + "shipping": null, + "source": null, + "statement_descriptor": null, + "statement_descriptor_suffix": null, + "status": "succeeded", + "transfer_data": null, + "transfer_group": null + } + recorded_at: Mon, 19 Feb 2024 00:00:49 GMT +- request: + method: post + uri: https://api.stripe.com/v1/charges/ch_3OlKHq4IGbVfXq1N1Ont3YNO/refunds + body: + encoding: UTF-8 + string: amount=1000&expand[0]=charge + headers: + Content-Type: + - application/x-www-form-urlencoded + Authorization: + - Basic c2tfdGVzdF94RmdKUU9sWHBNQUZzb3p0endGQlRGaFAwMEhHN0J1Q0ptOg== + User-Agent: + - Stripe/v1 ActiveMerchantBindings/1.133.0 + Stripe-Version: + - '2020-08-27' + X-Stripe-Client-User-Agent: + - '{"bindings_version":"1.133.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","publisher":"active_merchant"}' + X-Stripe-Client-User-Metadata: + - '{"ip":null}' + Stripe-Account: + - acct_1OlKHn4IGbVfXq1N + Connection: + - close + 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: + - Mon, 19 Feb 2024 00:00:50 GMT + Content-Type: + - application/json + Content-Length: + - '4536' + Connection: + - close + 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%2Fcharges%2F%3Acharge%2Frefunds; + 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: + - ac332f6f-19be-4c8b-8db1-a3c3e4207494 + Original-Request: + - req_t6Cm1fychRStDp + Request-Id: + - req_t6Cm1fychRStDp + Stripe-Account: + - acct_1OlKHn4IGbVfXq1N + Stripe-Should-Retry: + - 'false' + Stripe-Version: + - '2020-08-27' + Vary: + - Origin + X-Stripe-Routing-Context-Priority-Tier: + - api-testmode + Strict-Transport-Security: + - max-age=63072000; includeSubDomains; preload + body: + encoding: UTF-8 + string: |- + { + "id": "re_3OlKHq4IGbVfXq1N1jpyDy0m", + "object": "refund", + "amount": 1000, + "balance_transaction": "txn_3OlKHq4IGbVfXq1N1WU3drjk", + "charge": { + "id": "ch_3OlKHq4IGbVfXq1N1Ont3YNO", + "object": "charge", + "amount": 1000, + "amount_captured": 1000, + "amount_refunded": 1000, + "application": "", + "application_fee": null, + "application_fee_amount": null, + "balance_transaction": "txn_3OlKHq4IGbVfXq1N1GJjELA4", + "billing_details": { + "address": { + "city": null, + "country": null, + "line1": null, + "line2": null, + "postal_code": null, + "state": null + }, + "email": null, + "name": null, + "phone": null + }, + "calculated_statement_descriptor": "OFNOFNOFN", + "captured": true, + "created": 1708300847, + "currency": "aud", + "customer": null, + "description": null, + "destination": null, + "dispute": null, + "disputed": false, + "failure_balance_transaction": null, + "failure_code": null, + "failure_message": null, + "fraud_details": {}, + "invoice": null, + "livemode": false, + "metadata": {}, + "on_behalf_of": null, + "order": null, + "outcome": { + "network_status": "approved_by_network", + "reason": null, + "risk_level": "normal", + "risk_score": 10, + "seller_message": "Payment complete.", + "type": "authorized" + }, + "paid": true, + "payment_intent": "pi_3OlKHq4IGbVfXq1N1cjQgX3f", + "payment_method": "pm_1OlKHq4IGbVfXq1NRLlk6sO0", + "payment_method_details": { + "card": { + "amount_authorized": 1000, + "brand": "mastercard", + "checks": { + "address_line1_check": null, + "address_postal_code_check": null, + "cvc_check": "pass" + }, + "country": "US", + "exp_month": 2, + "exp_year": 2025, + "extended_authorization": { + "status": "disabled" + }, + "fingerprint": "BL35fEFVcTTS5wpE", + "funding": "credit", + "incremental_authorization": { + "status": "unavailable" + }, + "installments": null, + "last4": "4444", + "mandate": null, + "multicapture": { + "status": "unavailable" + }, + "network": "mastercard", + "network_token": { + "used": false + }, + "overcapture": { + "maximum_amount_capturable": 1000, + "status": "unavailable" + }, + "three_d_secure": null, + "wallet": null + }, + "type": "card" + }, + "radar_options": {}, + "receipt_email": null, + "receipt_number": null, + "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xT2xLSG40SUdiVmZYcTFOKLK0yq4GMgZC-6RblWI6LBZNj4qC9TZHwzFVNsqfPi9Wu03ml2yo1-Y0x6RquIwndy0haWmRkS_LZ4lS", + "refunded": true, + "refunds": { + "object": "list", + "data": [ + { + "id": "re_3OlKHq4IGbVfXq1N1jpyDy0m", + "object": "refund", + "amount": 1000, + "balance_transaction": "txn_3OlKHq4IGbVfXq1N1WU3drjk", + "charge": "ch_3OlKHq4IGbVfXq1N1Ont3YNO", + "created": 1708300849, + "currency": "aud", + "destination_details": { + "card": { + "reference_status": "pending", + "reference_type": "acquirer_reference_number", + "type": "refund" + }, + "type": "card" + }, + "metadata": {}, + "payment_intent": "pi_3OlKHq4IGbVfXq1N1cjQgX3f", + "reason": null, + "receipt_number": null, + "source_transfer_reversal": null, + "status": "succeeded", + "transfer_reversal": null + } + ], + "has_more": false, + "total_count": 1, + "url": "/v1/charges/ch_3OlKHq4IGbVfXq1N1Ont3YNO/refunds" + }, + "review": null, + "shipping": null, + "source": null, + "source_transfer": null, + "statement_descriptor": null, + "statement_descriptor_suffix": null, + "status": "succeeded", + "transfer_data": null, + "transfer_group": null + }, + "created": 1708300849, + "currency": "aud", + "destination_details": { + "card": { + "reference_status": "pending", + "reference_type": "acquirer_reference_number", + "type": "refund" + }, + "type": "card" + }, + "metadata": {}, + "payment_intent": "pi_3OlKHq4IGbVfXq1N1cjQgX3f", + "reason": null, + "receipt_number": null, + "source_transfer_reversal": null, + "status": "succeeded", + "transfer_reversal": null + } + recorded_at: Mon, 19 Feb 2024 00:00:50 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/fixtures/vcr_cassettes/Stripe-v10.9.0/Spree_Gateway_StripeSCA/_void/with_a_voidable_payment/void_the_payment.yml b/spec/fixtures/vcr_cassettes/Stripe-v10.9.0/Spree_Gateway_StripeSCA/_void/with_a_voidable_payment/void_the_payment.yml new file mode 100644 index 0000000000..929077ca53 --- /dev/null +++ b/spec/fixtures/vcr_cassettes/Stripe-v10.9.0/Spree_Gateway_StripeSCA/_void/with_a_voidable_payment/void_the_payment.yml @@ -0,0 +1,738 @@ +--- +http_interactions: +- request: + method: post + uri: https://api.stripe.com/v1/accounts + body: + encoding: UTF-8 + string: type=standard&country=AU&email=carrot.producer%40example.com + headers: + User-Agent: + - Stripe/v1 RubyBindings/10.9.0 + Authorization: + - Bearer + Content-Type: + - application/x-www-form-urlencoded + X-Stripe-Client-Telemetry: + - '{"last_request_metrics":{"request_id":"req_31hlpB6NcLOMmV","request_duration_ms":498}}' + Stripe-Version: + - '2023-10-16' + X-Stripe-Client-User-Agent: + - '{"bindings_version":"10.9.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 5.15.0-92-generic (buildd@lcy02-amd64-002) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) + 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #102~20.04.1-Ubuntu SMP Mon + Jan 15 13:09:14 UTC 2024","hostname":"gaetan-Dell-G15"}' + 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: + - Mon, 19 Feb 2024 00:00:52 GMT + Content-Type: + - application/json + Content-Length: + - '3046' + 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%2Faccounts; 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: + - 838c393f-89e8-440a-ac55-e772d28bcbc9 + Original-Request: + - req_xgoTbIOtuDEIze + Request-Id: + - req_xgoTbIOtuDEIze + 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": "acct_1OlKHuQQavT2yUiZ", + "object": "account", + "business_profile": { + "annual_revenue": null, + "estimated_worker_count": null, + "mcc": null, + "name": null, + "product_description": null, + "support_address": null, + "support_email": null, + "support_phone": null, + "support_url": null, + "url": null + }, + "business_type": null, + "capabilities": {}, + "charges_enabled": false, + "controller": { + "is_controller": true, + "type": "application" + }, + "country": "AU", + "created": 1708300851, + "default_currency": "aud", + "details_submitted": false, + "email": "carrot.producer@example.com", + "external_accounts": { + "object": "list", + "data": [], + "has_more": false, + "total_count": 0, + "url": "/v1/accounts/acct_1OlKHuQQavT2yUiZ/external_accounts" + }, + "future_requirements": { + "alternatives": [], + "current_deadline": null, + "currently_due": [], + "disabled_reason": null, + "errors": [], + "eventually_due": [], + "past_due": [], + "pending_verification": [] + }, + "metadata": {}, + "payouts_enabled": false, + "requirements": { + "alternatives": [], + "current_deadline": null, + "currently_due": [ + "business_profile.product_description", + "business_profile.support_phone", + "business_profile.url", + "external_account", + "tos_acceptance.date", + "tos_acceptance.ip" + ], + "disabled_reason": "requirements.past_due", + "errors": [], + "eventually_due": [ + "business_profile.product_description", + "business_profile.support_phone", + "business_profile.url", + "external_account", + "tos_acceptance.date", + "tos_acceptance.ip" + ], + "past_due": [ + "external_account", + "tos_acceptance.date", + "tos_acceptance.ip" + ], + "pending_verification": [] + }, + "settings": { + "bacs_debit_payments": { + "display_name": null, + "service_user_number": null + }, + "branding": { + "icon": null, + "logo": null, + "primary_color": null, + "secondary_color": null + }, + "card_issuing": { + "tos_acceptance": { + "date": null, + "ip": null + } + }, + "card_payments": { + "decline_on": { + "avs_failure": false, + "cvc_failure": false + }, + "statement_descriptor_prefix": null, + "statement_descriptor_prefix_kana": null, + "statement_descriptor_prefix_kanji": null + }, + "dashboard": { + "display_name": null, + "timezone": "Etc/UTC" + }, + "invoices": { + "default_account_tax_ids": null + }, + "payments": { + "statement_descriptor": null, + "statement_descriptor_kana": null, + "statement_descriptor_kanji": null + }, + "payouts": { + "debit_negative_balances": true, + "schedule": { + "delay_days": 2, + "interval": "daily" + }, + "statement_descriptor": null + }, + "sepa_debit_payments": {} + }, + "tos_acceptance": { + "date": null, + "ip": null, + "user_agent": null + }, + "type": "standard" + } + recorded_at: Mon, 19 Feb 2024 00:00:52 GMT +- request: + method: get + uri: https://api.stripe.com/v1/payment_methods/pm_card_mastercard + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Stripe/v1 RubyBindings/10.9.0 + Authorization: + - Bearer + Content-Type: + - application/x-www-form-urlencoded + X-Stripe-Client-Telemetry: + - '{"last_request_metrics":{"request_id":"req_xgoTbIOtuDEIze","request_duration_ms":1934}}' + Stripe-Version: + - '2023-10-16' + X-Stripe-Client-User-Agent: + - '{"bindings_version":"10.9.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 5.15.0-92-generic (buildd@lcy02-amd64-002) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) + 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #102~20.04.1-Ubuntu SMP Mon + Jan 15 13:09:14 UTC 2024","hostname":"gaetan-Dell-G15"}' + 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: + - Mon, 19 Feb 2024 00:00:53 GMT + Content-Type: + - application/json + Content-Length: + - '977' + 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; + 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_SHpcnpm4a7AUEZ + 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_1OlKHxKuuB1fWySn3c29EEi6", + "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": "mastercard", + "checks": { + "address_line1_check": null, + "address_postal_code_check": null, + "cvc_check": "unchecked" + }, + "country": "US", + "display_brand": "mastercard", + "exp_month": 2, + "exp_year": 2025, + "fingerprint": "BL35fEFVcTTS5wpE", + "funding": "credit", + "generated_from": null, + "last4": "4444", + "networks": { + "available": [ + "mastercard" + ], + "preferred": null + }, + "three_d_secure_usage": { + "supported": true + }, + "wallet": null + }, + "created": 1708300853, + "customer": null, + "livemode": false, + "metadata": {}, + "type": "card" + } + recorded_at: Mon, 19 Feb 2024 00:00:53 GMT +- request: + method: post + uri: https://api.stripe.com/v1/payment_intents + body: + encoding: UTF-8 + string: amount=1000¤cy=aud&payment_method=pm_card_mastercard&payment_method_types[0]=card&capture_method=manual + headers: + User-Agent: + - Stripe/v1 RubyBindings/10.9.0 + Authorization: + - Bearer + Content-Type: + - application/x-www-form-urlencoded + X-Stripe-Client-Telemetry: + - '{"last_request_metrics":{"request_id":"req_SHpcnpm4a7AUEZ","request_duration_ms":470}}' + Stripe-Version: + - '2023-10-16' + X-Stripe-Client-User-Agent: + - '{"bindings_version":"10.9.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 5.15.0-92-generic (buildd@lcy02-amd64-002) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) + 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #102~20.04.1-Ubuntu SMP Mon + Jan 15 13:09:14 UTC 2024","hostname":"gaetan-Dell-G15"}' + Stripe-Account: + - acct_1OlKHuQQavT2yUiZ + 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: + - Mon, 19 Feb 2024 00:00:54 GMT + Content-Type: + - application/json + Content-Length: + - '1377' + 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_intents; 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: + - c6ca5d5c-bcc3-4585-ba74-43319c9d47ef + Original-Request: + - req_bh5LlLDM9k2WFC + Request-Id: + - req_bh5LlLDM9k2WFC + Stripe-Account: + - acct_1OlKHuQQavT2yUiZ + 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": "pi_3OlKHyQQavT2yUiZ1U0lESdv", + "object": "payment_intent", + "amount": 1000, + "amount_capturable": 0, + "amount_details": { + "tip": {} + }, + "amount_received": 0, + "application": "", + "application_fee_amount": null, + "automatic_payment_methods": null, + "canceled_at": null, + "cancellation_reason": null, + "capture_method": "manual", + "client_secret": "pi_3OlKHyQQavT2yUiZ1U0lESdv_secret_rpTnb2WYG0pVnybfmdKD0wp3k", + "confirmation_method": "automatic", + "created": 1708300854, + "currency": "aud", + "customer": null, + "description": null, + "invoice": null, + "last_payment_error": null, + "latest_charge": null, + "livemode": false, + "metadata": {}, + "next_action": null, + "on_behalf_of": null, + "payment_method": "pm_1OlKHxQQavT2yUiZRHGPw6fU", + "payment_method_configuration_details": null, + "payment_method_options": { + "card": { + "installments": null, + "mandate_options": null, + "network": null, + "request_three_d_secure": "automatic" + } + }, + "payment_method_types": [ + "card" + ], + "processing": null, + "receipt_email": null, + "review": null, + "setup_future_usage": null, + "shipping": null, + "source": null, + "statement_descriptor": null, + "statement_descriptor_suffix": null, + "status": "requires_confirmation", + "transfer_data": null, + "transfer_group": null + } + recorded_at: Mon, 19 Feb 2024 00:00:54 GMT +- request: + method: get + uri: https://api.stripe.com/v1/payment_intents/pi_3OlKHyQQavT2yUiZ1U0lESdv + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Stripe/v1 RubyBindings/10.9.0 + Authorization: + - Bearer + Content-Type: + - application/x-www-form-urlencoded + X-Stripe-Client-Telemetry: + - '{"last_request_metrics":{"request_id":"req_bh5LlLDM9k2WFC","request_duration_ms":627}}' + Stripe-Version: + - '2023-10-16' + X-Stripe-Client-User-Agent: + - '{"bindings_version":"10.9.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 5.15.0-92-generic (buildd@lcy02-amd64-002) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) + 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #102~20.04.1-Ubuntu SMP Mon + Jan 15 13:09:14 UTC 2024","hostname":"gaetan-Dell-G15"}' + Stripe-Account: + - acct_1OlKHuQQavT2yUiZ + 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: + - Mon, 19 Feb 2024 00:00:54 GMT + Content-Type: + - application/json + Content-Length: + - '1377' + 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_intents%2F%3Aintent; + 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_7Xt2mBUL2tQGa6 + Stripe-Account: + - acct_1OlKHuQQavT2yUiZ + 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": "pi_3OlKHyQQavT2yUiZ1U0lESdv", + "object": "payment_intent", + "amount": 1000, + "amount_capturable": 0, + "amount_details": { + "tip": {} + }, + "amount_received": 0, + "application": "", + "application_fee_amount": null, + "automatic_payment_methods": null, + "canceled_at": null, + "cancellation_reason": null, + "capture_method": "manual", + "client_secret": "pi_3OlKHyQQavT2yUiZ1U0lESdv_secret_rpTnb2WYG0pVnybfmdKD0wp3k", + "confirmation_method": "automatic", + "created": 1708300854, + "currency": "aud", + "customer": null, + "description": null, + "invoice": null, + "last_payment_error": null, + "latest_charge": null, + "livemode": false, + "metadata": {}, + "next_action": null, + "on_behalf_of": null, + "payment_method": "pm_1OlKHxQQavT2yUiZRHGPw6fU", + "payment_method_configuration_details": null, + "payment_method_options": { + "card": { + "installments": null, + "mandate_options": null, + "network": null, + "request_three_d_secure": "automatic" + } + }, + "payment_method_types": [ + "card" + ], + "processing": null, + "receipt_email": null, + "review": null, + "setup_future_usage": null, + "shipping": null, + "source": null, + "statement_descriptor": null, + "statement_descriptor_suffix": null, + "status": "requires_confirmation", + "transfer_data": null, + "transfer_group": null + } + recorded_at: Mon, 19 Feb 2024 00:00:54 GMT +- request: + method: post + uri: https://api.stripe.com/v1/payment_intents/pi_3OlKHyQQavT2yUiZ1U0lESdv/cancel + body: + encoding: US-ASCII + string: '' + headers: + Content-Type: + - application/x-www-form-urlencoded + Authorization: + - Basic c2tfdGVzdF94RmdKUU9sWHBNQUZzb3p0endGQlRGaFAwMEhHN0J1Q0ptOg== + User-Agent: + - Stripe/v1 ActiveMerchantBindings/1.133.0 + Stripe-Version: + - '2020-08-27' + X-Stripe-Client-User-Agent: + - '{"bindings_version":"1.133.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","publisher":"active_merchant"}' + X-Stripe-Client-User-Metadata: + - '{"ip":null}' + Stripe-Account: + - acct_1OlKHuQQavT2yUiZ + Connection: + - close + 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: + - Mon, 19 Feb 2024 00:00:55 GMT + Content-Type: + - application/json + Content-Length: + - '1541' + Connection: + - close + 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_intents%2F%3Aintent%2Fcancel; + 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: + - 778bc74d-5e4f-41d8-b14f-c52d3b177da9 + Original-Request: + - req_c8b1fdbZWRDi0l + Request-Id: + - req_c8b1fdbZWRDi0l + Stripe-Account: + - acct_1OlKHuQQavT2yUiZ + Stripe-Should-Retry: + - 'false' + Stripe-Version: + - '2020-08-27' + Vary: + - Origin + X-Stripe-Routing-Context-Priority-Tier: + - api-testmode + Strict-Transport-Security: + - max-age=63072000; includeSubDomains; preload + body: + encoding: UTF-8 + string: |- + { + "id": "pi_3OlKHyQQavT2yUiZ1U0lESdv", + "object": "payment_intent", + "amount": 1000, + "amount_capturable": 0, + "amount_details": { + "tip": {} + }, + "amount_received": 0, + "application": "", + "application_fee_amount": null, + "automatic_payment_methods": null, + "canceled_at": 1708300855, + "cancellation_reason": null, + "capture_method": "manual", + "charges": { + "object": "list", + "data": [], + "has_more": false, + "total_count": 0, + "url": "/v1/charges?payment_intent=pi_3OlKHyQQavT2yUiZ1U0lESdv" + }, + "client_secret": "pi_3OlKHyQQavT2yUiZ1U0lESdv_secret_rpTnb2WYG0pVnybfmdKD0wp3k", + "confirmation_method": "automatic", + "created": 1708300854, + "currency": "aud", + "customer": null, + "description": null, + "invoice": null, + "last_payment_error": null, + "latest_charge": null, + "livemode": false, + "metadata": {}, + "next_action": null, + "on_behalf_of": null, + "payment_method": "pm_1OlKHxQQavT2yUiZRHGPw6fU", + "payment_method_configuration_details": null, + "payment_method_options": { + "card": { + "installments": null, + "mandate_options": null, + "network": null, + "request_three_d_secure": "automatic" + } + }, + "payment_method_types": [ + "card" + ], + "processing": null, + "receipt_email": null, + "review": null, + "setup_future_usage": null, + "shipping": null, + "source": null, + "statement_descriptor": null, + "statement_descriptor_suffix": null, + "status": "canceled", + "transfer_data": null, + "transfer_group": null + } + recorded_at: Mon, 19 Feb 2024 00:00:55 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/lib/stripe/profile_storer_spec.rb b/spec/lib/stripe/profile_storer_spec.rb index e7b69f8c8c..0553fe5fc4 100644 --- a/spec/lib/stripe/profile_storer_spec.rb +++ b/spec/lib/stripe/profile_storer_spec.rb @@ -5,6 +5,7 @@ require 'spec_helper' module Stripe describe ProfileStorer do include StripeStubs + include StripeHelper describe "create_customer_from_token" do let(:stripe_payment_method) { create(:stripe_sca_payment_method) } @@ -18,9 +19,11 @@ module Stripe { status: 200, body: JSON.generate(id: customer_id, sources: { data: [{ id: "1" }] }) } } - before do - Stripe.api_key = "sk_test_12345" + around do |example| + with_stripe_setup { example.run } + end + before do stub_customers_post_request(email: payment.order.email, response: customer_response_mock) stub_payment_method_attach_request(payment_method: card_id, customer: customer_id) end @@ -32,6 +35,18 @@ module Stripe expect(payment.source.gateway_customer_profile_id).to eq customer_id expect(payment.source.gateway_payment_profile_id).to eq card_id end + + context "when request fails" do + it "raises an error" do + expect(stripe_payment_method.provider).to receive(:store).and_return( + ActiveMerchant::Billing::Response.new(false, "some error") + ) + + expect { profile_storer.create_customer_from_token }.to raise_error( + Spree::Core::GatewayError + ) + end + end end end end diff --git a/spec/models/spree/gateway/stripe_sca_spec.rb b/spec/models/spree/gateway/stripe_sca_spec.rb index 3c704b80fc..58308deb89 100644 --- a/spec/models/spree/gateway/stripe_sca_spec.rb +++ b/spec/models/spree/gateway/stripe_sca_spec.rb @@ -3,7 +3,6 @@ require 'spec_helper' describe Spree::Gateway::StripeSCA, type: :model do - let(:order) { create(:order_ready_for_payment) } let(:year_valid) { Time.zone.now.year.next } @@ -25,17 +24,10 @@ describe Spree::Gateway::StripeSCA, type: :model do { order_id: order.number } } - let(:pm_card) do - Stripe::PaymentMethod.create({ - type: 'card', - card: { - number: '4242424242424242', - exp_month: 12, - exp_year: year_valid, - cvc: '314', - }, - }) - end + # Stripe testing card: + # https://stripe.com/docs/testing?testing-method=payment-methods + let(:pm_card) { Stripe::PaymentMethod.retrieve('pm_card_mastercard') } + let(:payment_intent) do Stripe::PaymentIntent.create({ amount: 1000, # given in AUD cents @@ -46,6 +38,14 @@ describe Spree::Gateway::StripeSCA, type: :model do }) end + let(:connected_account) do + Stripe::Account.create({ + type: 'standard', + country: 'AU', + email: 'carrot.producer@example.com' + }) + end + describe "#purchase", :vcr, :stripe_version do # Stripe acepts amounts as positive integers representing how much to charge # in the smallest currency unit @@ -71,6 +71,101 @@ describe Spree::Gateway::StripeSCA, type: :model do end end + describe "#void", :vcr, :stripe_version do + let(:stripe_test_account) { connected_account.id } + + before do + # Inject our test stripe account + stripe_account = create(:stripe_account, stripe_user_id: stripe_test_account) + allow(StripeAccount).to receive(:find_by).and_return(stripe_account) + + create( + :payment, + order:, + amount: order.total, + payment_method: subject, + source: credit_card, + response_code: payment_intent.id + ) + end + + context "with a confirmed payment" do + # Link the payment intent to our test stripe account, and automatically confirm and capture + # the payment. + let(:payment_intent) do + Stripe::PaymentIntent.create( + { + amount: 1000, # given in AUD cents + currency: 'aud', # AUD to match order currency + payment_method: 'pm_card_mastercard', + payment_method_types: ['card'], + capture_method: 'automatic', + confirm: true, + }, + stripe_account: stripe_test_account + ) + end + + it "refunds the payment" do + response = subject.void(payment_intent.id, nil, {}) + + expect(response.success?).to eq true + end + end + + context "with a voidable payment" do + # Link the payment intent to our test stripe account + let(:payment_intent) do + Stripe::PaymentIntent.create( + { + amount: 1000, # given in AUD cents + currency: 'aud', # AUD to match order currency + payment_method: 'pm_card_mastercard', + payment_method_types: ['card'], + capture_method: 'manual' + }, + stripe_account: stripe_test_account + ) + end + + it "void the payment" do + response = subject.void(payment_intent.id, nil, {}) + + expect(response.success?).to eq true + end + end + end + + describe "#credit", :vcr, :stripe_version do + let(:stripe_test_account) { connected_account.id } + + before do + # Inject our test stripe account + stripe_account = create(:stripe_account, stripe_user_id: stripe_test_account) + allow(StripeAccount).to receive(:find_by).and_return(stripe_account) + end + + it "refunds the payment" do + # Link the payment intent to our test stripe account, and automatically confirm and capture + # the payment. + payment_intent = Stripe::PaymentIntent.create( + { + amount: 1000, # given in AUD cents + currency: 'aud', # AUD to match order currency + payment_method: 'pm_card_mastercard', + payment_method_types: ['card'], + capture_method: 'automatic', + confirm: true, + }, + stripe_account: stripe_test_account + ) + + response = subject.credit(1000, nil, payment_intent.id, {}) + + expect(response.success?).to eq true + end + end + describe "#error message", :vcr, :stripe_version do context "when payment intent state is not in 'requires_capture' state" do before do diff --git a/spec/models/spree/payment_spec.rb b/spec/models/spree/payment_spec.rb index fcfa0fa767..1d90ebb478 100644 --- a/spec/models/spree/payment_spec.rb +++ b/spec/models/spree/payment_spec.rb @@ -32,26 +32,15 @@ describe Spree::Payment do let(:amount_in_cents) { payment.amount.to_f * 100 } let(:success_response) do - double('success_response', success?: true, - authorization: '123', - avs_result: { 'code' => 'avs-code' }, - cvv_result: { code: nil, message: nil }) + instance_double( + ActiveMerchant::Billing::Response, + authorization: "123", + success?: true, + avs_result: { 'code' => 'avs-code' }, + cvv_result: { code: nil, message: nil } + ) end - - let(:failed_response) { double('gateway_response', success?: false) } - - let(:payment_authorised) { - payment_intent(payment.amount, "requires_capture") - } - let(:payment_canceled) { - payment_intent(payment.amount, "canceled") - } - let(:payment_refunded) { - payment_intent(payment.amount, "refunded") - } - let(:capture_successful) { - payment_intent(payment.amount, "succeeded") - } + let(:failed_response) { instance_double(ActiveMerchant::Billing::Response, success?: false) } context "extends LocalizedNumber" do subject { build_stubbed(:payment) } @@ -121,11 +110,11 @@ describe Spree::Payment do end it "should make the state 'processing'" do - stub_request(:get, "https://api.stripe.com/v1/payment_intents/12345"). - to_return(status: 200, body: payment_authorised) - stub_request(:post, "https://api.stripe.com/v1/payment_intents/12345/capture"). - to_return(status: 200, body: capture_successful) + allow(payment_method).to receive(:capture).and_return(success_response) + allow(payment_method).to receive(:purchase).and_return(success_response) + expect(payment).to receive(:started_processing!) + payment.save! payment.process! end @@ -165,6 +154,7 @@ describe Spree::Payment do before do allow(payment_method).to receive(:authorize) { success_response } end + it "should call authorize on the gateway with the payment amount" do expect(payment.payment_method).to receive(:authorize).with( amount_in_cents, card, anything @@ -242,11 +232,9 @@ describe Spree::Payment do context "purchase" do before do - stub_request(:get, "https://api.stripe.com/v1/payment_intents/12345"). - to_return(status: 200, body: payment_authorised) - stub_request(:post, "https://api.stripe.com/v1/payment_intents/12345/capture"). - to_return(status: 200, body: capture_successful) + allow(payment_method).to receive(:purchase).and_return(success_response) end + it "should call purchase on the gateway with the payment amount" do expect(payment_method).to receive(:purchase).with(amount_in_cents, card, anything).and_return(success_response) @@ -347,6 +335,8 @@ describe Spree::Payment do before do payment.response_code = '123' payment.state = 'pending' + + allow(payment_method).to receive(:void).and_return(success_response) end context "when profiles are supported" do @@ -368,10 +358,6 @@ describe Spree::Payment do end it "should log the response" do - stub_request(:get, "https://api.stripe.com/v1/payment_intents/123"). - to_return(status: 200, body: payment_authorised) - stub_request(:post, "https://api.stripe.com/v1/payment_intents/123/cancel"). - to_return(status: 200, body: payment_canceled) payment.void_transaction! expect(payment).to have_received(:record_response) end @@ -385,24 +371,11 @@ describe Spree::Payment do end context "if successful" do - let(:mocked_response) { - instance_double(ActiveMerchant::Billing::Response, authorization: '12345', - success?: true) - } - - before do - allow(payment_method).to receive(:void).and_return(mocked_response) - end - it "should update the response_code with the authorization from the gateway" do - stub_request(:get, "https://api.stripe.com/v1/payment_intents/abc"). - to_return(status: 200, body: payment_authorised) - stub_request(:post, "https://api.stripe.com/v1/payment_intents/abc/cancel"). - to_return(status: 200, body: payment_canceled) - # Change it to something different payment.response_code = 'abc' payment.void_transaction! - expect(payment.response_code).to eq('12345') + + expect(payment.response_code).to eq('123') end end @@ -442,10 +415,13 @@ describe Spree::Payment do end end - context "#credit" do + describe "#credit" do before do payment.state = 'completed' payment.response_code = '123' + + # Stub payment.method#credit + allow(payment_method).to receive(:credit).and_return(success_response) end context "when outstanding_balance is less than payment amount" do @@ -468,10 +444,6 @@ describe Spree::Payment do end it "should not applied any transaction fees" do - stub_request(:get, "https://api.stripe.com/v1/payment_intents/123"). - to_return(status: 200, body: payment_authorised) - stub_request(:post, "https://api.stripe.com/v1/charges/ch_1234/refunds"). - to_return(status: 200, body: payment_refunded) payment.credit! expect(payment.adjustment.finalized?).to eq(false) expect(order.all_adjustments.payment_fee.length).to eq(0) @@ -504,11 +476,39 @@ describe Spree::Payment do end end + context "when amount <= credit_allowed" do + it "makes the state processing" do + payment.payment_method.name = 'Gateway' + payment.payment_method.distributors << create(:distributor_enterprise) + payment.payment_method.save! + + payment.order = create(:order) + + payment.state = 'completed' + allow(payment).to receive(:credit_allowed) { 10 } + payment.partial_credit(10) + expect(payment).to be_processing + end + + it "calls credit on the source with the payment and amount" do + payment.state = 'completed' + allow(payment).to receive(:credit_allowed) { 10 } + expect(payment).to receive(:credit!).with(10) + payment.partial_credit(10) + end + end + + context "when amount > credit_allowed" do + it "should not call credit on the source" do + payment = build_stubbed(:payment) + payment.state = 'completed' + allow(payment).to receive(:credit_allowed) { 10 } + payment.partial_credit(20) + expect(payment).to be_completed + end + end + it "should log the response" do - stub_request(:get, "https://api.stripe.com/v1/payment_intents/123"). - to_return(status: 200, body: payment_authorised) - stub_request(:post, "https://api.stripe.com/v1/charges/ch_1234/refunds"). - to_return(status: 200, body: payment_refunded) payment.credit! expect(payment).to have_received(:record_response) end @@ -523,26 +523,18 @@ describe Spree::Payment do context "when response is successful" do it "should create an offsetting payment" do - stub_request(:get, "https://api.stripe.com/v1/payment_intents/123"). - to_return(status: 200, body: payment_authorised) - stub_request(:post, "https://api.stripe.com/v1/charges/ch_1234/refunds"). - to_return(status: 200, body: payment_refunded) expect(Spree::Payment).to receive(:create!) payment.credit! end it "resulting payment should have correct values" do - stub_request(:get, "https://api.stripe.com/v1/payment_intents/123"). - to_return(status: 200, body: payment_authorised) - stub_request(:post, "https://api.stripe.com/v1/charges/ch_1234/refunds"). - to_return(status: 200, body: payment_refunded) allow(payment.order).to receive(:new_outstanding_balance) { 100 } allow(payment).to receive(:credit_allowed) { 10 } offsetting_payment = payment.credit! expect(offsetting_payment.amount.to_f).to eq(-10) expect(offsetting_payment).to be_completed - expect(offsetting_payment.response_code).to eq('12345') + expect(offsetting_payment.response_code).to eq('123') expect(offsetting_payment.source).to eq(payment) end @@ -552,15 +544,7 @@ describe Spree::Payment do verification_value: '123') end - let(:successful_response) do - ActiveMerchant::Billing::Response.new(true, "Yay!") - end - it 'lets the new payment to be saved' do - stub_request(:get, "https://api.stripe.com/v1/payment_intents/123"). - to_return(status: 200, body: payment_authorised) - stub_request(:post, "https://api.stripe.com/v1/charges/ch_1234/refunds"). - to_return(status: 200, body: payment_refunded) allow(payment.order).to receive(:new_outstanding_balance) { 100 } allow(payment).to receive(:credit_allowed) { 10 } @@ -636,42 +620,6 @@ describe Spree::Payment do end end - context "#credit" do - context "when amount <= credit_allowed" do - it "makes the state processing" do - stub_request(:get, "https://api.stripe.com/v1/payment_intents/12345"). - to_return(status: 200, body: payment_authorised) - stub_request(:post, "https://api.stripe.com/v1/charges/ch_1234/refunds"). - to_return(status: 200, body: payment_refunded) - payment.payment_method.name = 'Gateway' - payment.payment_method.distributors << create(:distributor_enterprise) - payment.payment_method.save! - - payment.order = create(:order) - - payment.state = 'completed' - allow(payment).to receive(:credit_allowed) { 10 } - payment.partial_credit(10) - expect(payment).to be_processing - end - it "calls credit on the source with the payment and amount" do - payment.state = 'completed' - allow(payment).to receive(:credit_allowed) { 10 } - expect(payment).to receive(:credit!).with(10) - payment.partial_credit(10) - end - end - context "when amount > credit_allowed" do - it "should not call credit on the source" do - payment = build_stubbed(:payment) - payment.state = 'completed' - allow(payment).to receive(:credit_allowed) { 10 } - payment.partial_credit(20) - expect(payment).to be_completed - end - end - end - context "#save" do context "completed payments" do it "updates order payment total" do diff --git a/spec/support/request/stripe_stubs.rb b/spec/support/request/stripe_stubs.rb index 9a10c9830a..524233cffc 100644 --- a/spec/support/request/stripe_stubs.rb +++ b/spec/support/request/stripe_stubs.rb @@ -44,7 +44,7 @@ module StripeStubs # Stubs the customers call to both the main stripe account and the connected account def stub_customers_post_request(email:, response: {}, stripe_account_header: false) stub = stub_request(:post, "https://api.stripe.com/v1/customers") - .with(body: { email: }) + .with(body: { expand: ["sources"], email: }) stub = stub.with(headers: { 'Stripe-Account' => 'abc123' }) if stripe_account_header stub.to_return(customers_response_mock(response)) end diff --git a/spec/system/consumer/checkout/payment_spec.rb b/spec/system/consumer/checkout/payment_spec.rb index 970c9a09c8..0646e40185 100644 --- a/spec/system/consumer/checkout/payment_spec.rb +++ b/spec/system/consumer/checkout/payment_spec.rb @@ -250,6 +250,25 @@ describe "As a consumer, I want to checkout my order" do click_on "Next - Order summary" proceed_to_summary end + + context "when saving card" do + it "selects Stripe SCA and proceeds to the summary step" do + stub_customers_post_request(email: order.user.email) + stub_payment_method_attach_request + + choose pay_method.to_s + fill_out_card_details + check "Save card for future use" + + click_on "Next - Order summary" + proceed_to_summary + + # Verify card has been saved with correct stripe IDs + user_credit_card = order.reload.user.credit_cards.first + expect(user_credit_card.gateway_payment_profile_id).to eq "pm_123" + expect(user_credit_card.gateway_customer_profile_id).to eq "cus_A123" + end + end end end