Eric Gross
06/16/2023, 9:30 PMconfig/solidus_stripe.rb
Spree::Config.static_model_preferences.add(
"SolidusStripe::PaymentMethod",
"solidus_stripe_env_credentials",
api_key: Rails.application.credentials.stripe.api_key!,
publishable_key: Rails.application.credentials.stripe.publishable_key!,
test_mode: Rails.application.credentials.stripe.api_key!.start_with?("sk_test_"),
webhook_endpoint_signing_secret: Rails.application.credentials.stripe.webhook_signing_secret!,
)
for some reason in app/views/orders/payment_info/_stripe.html.erb
,
stripe_payment_method = payment.source.stripe_payment_method
# <https://stripe.com/docs/api/payment_methods/object#payment_method_object-type>
partial_base = "checkouts/existing_payment/stripe"
payment_type = stripe_payment_method.type
isn't working because stripe_payment_method
is nil.Eric Gross
06/16/2023, 10:36 PMSolidusStripe::PaymentSource Create -- { :sql => "INSERT INTO \"solidus_stripe_payment_sources\" (\"payment_method_id\", \"stripe_payment_method_id\", \"created_at\", \"updated_at\", \"tenant_id\") VALUES ($1, $2, $3, $4, $5) RETURNING \"id\"", :binds => { :payment_method_id => 3, :stripe_payment_method_id => "", :created_at => "2023-06-16 22:32:55.502506", :updated_at => "2023-06-16 22:32:55.502506", :tenant_id => 1 }, :allocations => 929, :cached => nil }
Eric Gross
06/16/2023, 11:13 PM#update
is failingEric Gross
06/17/2023, 4:35 AMpm_1NJqq9LPxMF9XGLKpVzp7mTF
🤔Eric Gross
06/17/2023, 3:23 PMpayment_method
but somehow it isn't making it into solidus
{
"capture_method": "manual",
"metadata": {
"solidus_order_number": "R529472096"
},
"currency": "USD",
"customer": "cus_O62wMmve74c61l",
"payment_method": "pm_1NK0s3LPxMF9XGLKwdhcdaoU",
"amount": "2624",
"payment_method_types": {
"0": "card"
}
}
loic
06/18/2023, 2:11 PMEric Gross
06/18/2023, 2:18 PMloic
06/18/2023, 2:22 PMloic
06/18/2023, 2:22 PMstripe listen …
Eric Gross
06/18/2023, 2:45 PMloic
06/18/2023, 2:45 PMEric Gross
06/18/2023, 2:45 PMEric Gross
06/18/2023, 2:54 PMexisting_payment/stripe/_default
partial is being used rather than what i expect, _card
. when the _default
template loads, the line
<%= stripe_payment_method.type.humanize %>
fails because
Rails -- Exception: ActionView::Template::Error: undefined method `type' for nil:NilClass
but i am not sure exactly what is going wrongloic
06/18/2023, 2:56 PMEric Gross
06/18/2023, 3:01 PMEric Gross
06/18/2023, 3:02 PMEric Gross
06/18/2023, 3:12 PMEric Gross
06/18/2023, 3:17 PMstripe_payment_method_id
is empty, which seems wrong 🤷
Completed #update -- { :controller => "CheckoutsController", :action => "update", :params => { "authenticity_token" => "[FILTERED]", "order" => { "payments_attributes" => [ { "payment_method_id" => "3" } ] }, "payment_source" => { "3" => { "stripe_payment_method_id" => "" } }, "commit" => "", "state" => "payment" }, :format => "TURBO_STREAM", :method => "PATCH", :path => "/checkout/update/payment", :status => 302, :view_runtime => 0.0, :db_runtime => 189.95, :allocations => 86196, :status_message => "Found" }
2023-06-18 08:00:12.017479 D [15279:puma srv tp 003] Rack -- Started -- { :method => "GET", :path => "/checkout/confirm", :ip => "127.0.0.1" }
Eric Gross
06/18/2023, 3:30 PM<div data-turbo="false">
in my application.html.erb
just inside the <body>
... but i'd like to keep using turbo drive if possibleEric Gross
06/18/2023, 3:30 PMloic
06/19/2023, 7:17 AMEric Gross
06/19/2023, 1:03 PMkennyadsl
kennyadsl
Eric Gross
06/20/2023, 2:41 PMkennyadsl
kennyadsl
Eric Gross
06/20/2023, 3:32 PMEric Gross
06/20/2023, 3:33 PM