solidus_mollie 0.1.0 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +21 -23
  3. data/README.md +90 -56
  4. data/app/controllers/solidus_mollie/callbacks_controller.rb +43 -0
  5. data/app/decorators/solidus_mollie/spree/checkout_controller_decorator.rb +60 -0
  6. data/app/models/solidus_mollie/client.rb +66 -0
  7. data/app/models/solidus_mollie/mollie_source.rb +31 -0
  8. data/app/models/solidus_mollie/payment_method.rb +106 -0
  9. data/app/models/solidus_mollie/response.rb +33 -0
  10. data/app/services/solidus_mollie/create_order_payment.rb +76 -0
  11. data/app/services/solidus_mollie/process_webhook.rb +68 -0
  12. data/app/views/spree/checkout/payment/_mollie.html.erb +5 -0
  13. data/config/locales/en.yml +5 -6
  14. data/config/routes.rb +6 -15
  15. data/db/migrate/20260620143922_create_solidus_mollie_sources.rb +15 -0
  16. data/lib/generators/solidus_mollie/install/install_generator.rb +24 -16
  17. data/lib/generators/solidus_mollie/install/templates/initializer.rb +5 -4
  18. data/lib/solidus_mollie/engine.rb +24 -14
  19. data/lib/solidus_mollie/factories.rb +16 -0
  20. data/lib/solidus_mollie/version.rb +1 -1
  21. data/lib/solidus_mollie.rb +9 -1
  22. metadata +50 -84
  23. data/.circleci/config.yml +0 -41
  24. data/.gem_release.yml +0 -5
  25. data/.github/stale.yml +0 -17
  26. data/.github_changelog_generator +0 -2
  27. data/.gitignore +0 -20
  28. data/.rspec +0 -2
  29. data/.rubocop.yml +0 -5
  30. data/CHANGELOG.md +0 -1
  31. data/Gemfile +0 -33
  32. data/Rakefile +0 -6
  33. data/app/assets/javascripts/spree/backend/solidus_mollie.js +0 -2
  34. data/app/assets/javascripts/spree/frontend/solidus_mollie.js +0 -2
  35. data/app/assets/stylesheets/spree/backend/solidus_mollie.css +0 -4
  36. data/app/assets/stylesheets/spree/frontend/solidus_mollie.css +0 -4
  37. data/app/controllers/spree/api/mollie_controller.rb +0 -31
  38. data/app/controllers/spree/mollie_controller.rb +0 -53
  39. data/app/decorators/models/line_item_decorator.rb +0 -21
  40. data/app/decorators/models/payment_create_decorator.rb +0 -22
  41. data/app/models/spree/gateway/mollie_gateway.rb +0 -155
  42. data/app/models/spree/mollie/order_serializer.rb +0 -169
  43. data/app/models/spree/mollie/payment_state_updater.rb +0 -62
  44. data/app/models/spree/mollie_logger.rb +0 -16
  45. data/app/models/spree/mollie_payment_source.rb +0 -57
  46. data/app/models/spree/payment_method/mollie.rb +0 -26
  47. data/app/views/spree/admin/payments/source_forms/_mollie.html.erb +0 -8
  48. data/app/views/spree/admin/payments/source_views/_mollie.html.erb +0 -27
  49. data/app/views/spree/api/payments/show.json.jbuilder +0 -5
  50. data/app/views/spree/api/payments/source_views/_mollie.json.jbuilder +0 -2
  51. data/bin/console +0 -17
  52. data/bin/rails +0 -7
  53. data/bin/rails-engine +0 -13
  54. data/bin/rails-sandbox +0 -16
  55. data/bin/rake +0 -7
  56. data/bin/sandbox +0 -86
  57. data/bin/setup +0 -8
  58. data/db/migrate/20201110194821_create_solidus_mollie_payment_source.rb +0 -14
  59. data/lib/solidus_mollie/configuration.rb +0 -21
  60. data/lib/solidus_mollie/testing_support/factories.rb +0 -4
  61. data/solidus_mollie.code-workspace +0 -8
  62. data/solidus_mollie.gemspec +0 -35
  63. data/spec/solidus_mollie_gateway_spec.rb +0 -5
  64. data/spec/spec_helper.rb +0 -31
@@ -1,2 +0,0 @@
1
- // Placeholder manifest file.
2
- // the installer will append this file to the app vendored assets here: vendor/assets/javascripts/spree/frontend/all.js'
@@ -1,4 +0,0 @@
1
- /*
2
- Placeholder manifest file.
3
- the installer will append this file to the app vendored assets here: 'vendor/assets/stylesheets/spree/backend/all.css'
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Placeholder manifest file.
3
- the installer will append this file to the app vendored assets here: 'vendor/assets/stylesheets/spree/frontend/all.css'
4
- */
@@ -1,31 +0,0 @@
1
- module Spree
2
- module Api
3
- class MollieController < Spree::Api::BaseController
4
- def payment_methods
5
- #FIXME: This is not safe.
6
- order = Spree::Order.find_by(number: params[:id])
7
- method_params = payload(order)
8
-
9
- payment_methods = Spree::PaymentMethod::Mollie.first.gateway.available_methods(method_params).map(&:attributes)
10
-
11
- render json: payment_methods
12
- end
13
-
14
- def validate_payment
15
- end
16
-
17
- private
18
-
19
- def payload(order)
20
- {
21
- amount: {
22
- currency: order.currency,
23
- value: Spree::Money.new(order.order_total_after_store_credit, { symbol: nil, thousands_separator: nil, decimal_mark: '.' }).format
24
- },
25
- resource: 'orders',
26
- billingCountry: order.bill_address.country.iso
27
- }
28
- end
29
- end
30
- end
31
- end
@@ -1,53 +0,0 @@
1
- module Spree
2
- class MollieController < BaseController
3
- skip_before_action :verify_authenticity_token, only: [:update_payment_status]
4
-
5
- # We might need this if the Webhook is late
6
- def validate_payment
7
- payment_number = split_payment_identifier(params[:order_number])
8
- payment = Spree::Payment.find_by(number: payment_number)
9
- payment.payment_method.gateway.update_payment_status(payment)
10
-
11
- order = payment.order
12
- order.reload
13
-
14
- binding.pry
15
-
16
- # Order is paid for or authorized (e.g. Klarna Pay Later)
17
- if (order.paid? && (order.can_complete?))
18
- order.complete
19
-
20
- redirect_to "https://bitter-lizard-32.loca.lt/checkout/success/#{order.number}"
21
- # redirect_to order_path(payment.order)
22
- else payment.pending?
23
- redirect_to "https://bitter-lizard-32.loca.ltcheckout/#{params[:order_number]}"
24
- # redirect_to checkout_state_path(:payment)
25
- end
26
- end
27
-
28
- # Mollie might send us information about a transaction through the webhook.
29
- # We should update the payment state accordingly.
30
- def update_payment_status
31
- payment_number = split_payment_identifier(params[:payment_identifier])
32
- payment = Spree::Payment.find_by(number: payment_number)
33
- payment.payment_method.gateway.update_payment_status(payment)
34
-
35
- head :ok
36
- end
37
-
38
- private
39
-
40
- # Payment identifier is a combination of order_number and payment_id.
41
- def split_payment_identifier(payment_identifier)
42
- payment_identifier.split('-')[1]
43
- end
44
-
45
- def payment_status_params
46
- params.permit(:payment_identifier, :id)
47
- end
48
-
49
- def load_order
50
- @order = ::Spree::Order.find_by!(number: params[:order_id])
51
- end
52
- end
53
- end
@@ -1,21 +0,0 @@
1
- module SolidusMollie
2
- module LineItemDecorator
3
-
4
- def tax_rate
5
- if adjustments.tax.any?
6
- # Solidus allows line items to have multiple TaxRate adjustments.
7
- # Mollie does not support this. Raise an error if there > 1 TaxRate adjustment.
8
-
9
- if adjustments.tax.count > 1
10
- raise 'Mollie does not support multiple TaxRate adjustments per line item'
11
- end
12
-
13
- adjustments.tax.first.source.amount
14
- else
15
- 0.00
16
- end
17
- end
18
-
19
- ::Spree::LineItem.prepend self
20
- end
21
- end
@@ -1,22 +0,0 @@
1
- module SolidusMollie
2
- module PaymentCreateDecorator
3
-
4
- def authorized?
5
- if source.is_a? Spree::MolliePaymentSource
6
- pending?
7
- else
8
- false
9
- end
10
- end
11
-
12
- def after_pay_method?
13
- if source.is_a? Spree::MolliePaymentSource
14
- return source.payment_method_name == ::Mollie::Method::KLARNAPAYLATER || source.payment_method_name == ::Mollie::Method::KLARNASLICEIT
15
- else
16
- false
17
- end
18
- end
19
-
20
- ::Spree::PaymentCreate.prepend self
21
- end
22
- end
@@ -1,155 +0,0 @@
1
- # Credit
2
-
3
- # 1. Webhook Callbacks
4
- # 2. Payment Methods through API
5
- # 3. Create Mollie User
6
- # 4. Mollie shipments
7
-
8
- # X. Client wrapper like PayPal
9
- # X. Ugly functions in serializer
10
- # x. Nice helper for Payment ID
11
- # X. Check if we pass only variables needed
12
-
13
- module Spree
14
- class Gateway::MollieGateway
15
-
16
- def initialize(options)
17
- ::Mollie::Client.configure do |config|
18
- config.api_key = options[:api_key]
19
- end
20
- end
21
-
22
- def format_money(money)
23
- Spree::Money.new(money, { symbol: nil, thousands_separator: nil, decimal_mark: '.' }).format
24
- end
25
-
26
- def authorize(_money, _source, gateway_options = {})
27
- begin
28
- payment = gateway_options[:originator]
29
- invalidate_previous_orders(payment.order_id)
30
-
31
- # Create a new Mollie order and update the payment source
32
- mollie_order = create_mollie_order(gateway_options)
33
- payment.source.update(status: mollie_order.status, payment_id: mollie_order.id, payment_url: mollie_order.checkout_url)
34
-
35
- ActiveMerchant::Billing::Response.new(true, 'Order created')
36
- rescue ::Mollie::Exception => e
37
- ActiveMerchant::Billing::Response.new(false, "Order could not be created: #{e.message}")
38
- end
39
- end
40
-
41
- def capture(_money, _response_code, gateway_options = {})
42
- authorize(_money, nil, gateway_options)
43
- # ActiveMerchant::Billing::Response.new(true, 'Mollie will automatically capture the amount.')
44
- end
45
-
46
- def purchase(money, source, gateway_options = {})
47
- authorize(money, source, gateway_options = {})
48
- end
49
-
50
- def void(_respoonse_code, gateway_options = {})
51
- begin
52
- payment_id = gateway_options[:originator].source.payment_id
53
-
54
- if cancel_mollie_order!(payment_id)
55
- ActiveMerchant::Billing::Response.new(true, 'Mollie order has been cancelled.')
56
- else
57
- ActiveMerchant::Billing::Response.new(true, 'Spree order has been canceled, could not cancel Mollie order.')
58
- end
59
- rescue ::Mollie::Exception => e
60
- ActiveMerchant::Billing::Response.new(false, 'Order cancellation unsuccessful.')
61
- end
62
- end
63
-
64
- def credit(_money_cents, _transaction_id, options)
65
- refund = options[:originator]
66
-
67
- payment = refund.try(:payment)
68
- order = payment.try(:order)
69
- reimbursement = refund.try(:reimbursement)
70
-
71
- # binding.pry
72
- begin
73
- if reimbursement
74
- mollie_order = ::Mollie::Order.get(payment.source.payment_id)
75
-
76
- mollie_order_refund_lines = reimbursement.return_items.map do |reimbursement|
77
- line_item = mollie_order.lines.detect { |line|
78
- line_item.sku == reimbursement.inventory_unit.line_item.mollie_identifier
79
- }
80
- { id: line_item.id, quantity: ri.inventory_unit.line_item.quantity } if line_item
81
- end.compact
82
-
83
- mollie_order.refund!({lines: mollie_order_refund_lines})
84
- else
85
- ::Mollie::Payment::Refund.create(
86
- payment_id: payment_id,
87
- amount: {
88
- value: format_money(refund.amount),
89
- currency: refund.currency
90
- },
91
- description: "Refund Order ID: #{order.number}",
92
-
93
- )
94
- end
95
- ActiveMerchant::Billing::Response.new(true, "Successfully refunded #{order.display_total} for order #{order_number}")
96
- rescue ::Mollie::Exception => e
97
- ActiveMerchant::Billing::Response.new(false, e.message)
98
- end
99
- end
100
-
101
- def available_methods(params = nil)
102
- method_params = {
103
- include: 'issuers',
104
- resource: 'orders'
105
- }
106
-
107
- method_params.merge! params if params.present?
108
-
109
- ::Mollie::Method.all(method_params)
110
- end
111
-
112
- def available_methods_for_order(order)
113
- params = {
114
- amount: {
115
- currency: order.currency,
116
- value: format_money(order.total)
117
- },
118
- resource: 'orders',
119
- billingCountry: order.billing_address.country.try(:iso)
120
- }
121
- available_methods(params)
122
- end
123
-
124
- def update_payment_status(payment)
125
- mollie_order = ::Mollie::Order.get(payment.source.payment_id, embed: 'payments')
126
-
127
- Spree::Mollie::PaymentStateUpdater.new(mollie_order, payment).call
128
- end
129
-
130
- private
131
-
132
- def create_mollie_order(gateway_options)
133
- order_params = Spree::Mollie::OrderSerializer.serialize(gateway_options)
134
-
135
- ::Mollie::Order.create(order_params)
136
- end
137
-
138
- def cancel_mollie_order!(payment_id)
139
- mollie_order = ::Mollie::Order.get(payment_id)
140
- mollie_order.cancel if mollie_order.cancelable?
141
- end
142
-
143
- def invalidate_previous_orders(order_id)
144
- #TODO: Nice scope that checks for Payment Source
145
- # Spree::Payment.by_mollie_and_order(order_id).each { cancel_mollie_order(paymnet) }
146
-
147
- Spree::Payment.where(order_id: order_id).where("state = ? OR state = ?", 'pending', 'processing').each do |payment|
148
- if payment.source_type == "Spree::MolliePaymentSource"
149
- payment.void!
150
- cancel_mollie_order!(payment.source.payment_id)
151
- end
152
- end
153
- end
154
- end
155
- end
@@ -1,169 +0,0 @@
1
- module Spree
2
- module Mollie
3
- class OrderSerializer
4
- # include ::Spree::Mollie::MoneyFormatter
5
-
6
- def self.serialize(gateway_options)
7
- new(gateway_options).serialize
8
- end
9
-
10
- def initialize(gateway_options)
11
- @gateway_options = gateway_options
12
- @source = @gateway_options[:originator].source
13
- @order = Spree::Order.find(@gateway_options[:originator].order_id)
14
- end
15
-
16
- def serialize
17
- spree_routes = ::Spree::Core::Engine.routes.url_helpers
18
- payment_identifier = @gateway_options[:order_id]
19
-
20
- order_params = {
21
- amount: price(@order.total),
22
- metadata: {
23
- order_number: @order.number,
24
- payment_identifier: payment_identifier
25
- },
26
- orderNumber: payment_identifier,
27
- redirectUrl: spree_routes.mollie_validate_payment_mollie_url(
28
- order_number: payment_identifier,
29
- host: Spree::Store.default.url
30
- ),
31
- webhookUrl: spree_routes.mollie_update_payment_status_mollie_url(
32
- payment_identifier: payment_identifier,
33
- host: Spree::Store.default.url
34
- ),
35
- locale: 'en_US',
36
- }
37
-
38
- if @gateway_options[:billing_address].present?
39
- order_params.merge! ({
40
- billingAddress: serialize_address(@gateway_options[:billing_address])
41
- })
42
- end
43
-
44
- if @gateway_options[:shipping_address].present?
45
- order_params.merge! ({
46
- shippingAddress: serialize_address(@gateway_options[:shipping_address])
47
- })
48
- end
49
-
50
- order_params.merge! ({
51
- lines: prepare_line_items
52
- })
53
-
54
- # User has already selected a payment method
55
- if @source.try(:payment_method_name).present?
56
- order_params.merge! ({
57
- method: @source.payment_method_name
58
- })
59
- end
60
-
61
- # User has selected an issuer (available for iDEAL payments)
62
- if @source.try(:issuer).present?
63
- order_params.merge! ({
64
- payment: {
65
- issuer: @source.issuer
66
- }
67
- })
68
- end
69
-
70
- order_params
71
- end
72
-
73
- private
74
-
75
- def prepare_line_items
76
- order_lines = []
77
- @order.line_items.each do |line|
78
- order_lines << serialize_line_item(line)
79
- end
80
-
81
- order_lines << serialize_discounts if @order.adjustments.any?
82
-
83
- order_lines << serialize_shipping_costs
84
-
85
- # if @order.shipping_discount.positive?
86
- # order_lines << serialize_shipping_discounts
87
- # end
88
-
89
- order_lines
90
- end
91
-
92
- def serialize_address(address)
93
- {
94
- streetAndNumber: [address[:address1], address[:address2]].join(" "),
95
- city: address[:city],
96
- postalCode: address[:zip],
97
- country: address[:country],
98
- region: address[:state],
99
- givenName: address[:name],
100
- familyName: address[:name],
101
- email: @order.email
102
- }
103
- end
104
-
105
- def serialize_shipping_costs
106
- {
107
- type: 'shipping_fee',
108
- name: 'Shipping',
109
- quantity: 1, # Considering shipment as one line item per order and not per item or package
110
- unitPrice: price(@order.shipments.map(&:cost).inject(0, &:+).to_f + @order.shipments.map(&:adjustment_total).inject(0, &:+).to_f),
111
- totalAmount: price(@order.shipments.map(&:cost).inject(0, &:+).to_f + @order.shipments.map(&:adjustment_total).inject(0, &:+).to_f),
112
- vatAmount: price(format_money(@order.shipments.map(&:included_tax_total).inject(0, &:+).to_f)), #TODO: Extract to its own method
113
- vatRate: @order.shipments.first.tax_category.tax_rates.first.amount.to_f * 100 #TODO: Mollie allows only one tax rate, extract to method
114
- }
115
- end
116
-
117
- def serialize_discounts
118
- binding.pry #TODO: Not implemented
119
- {
120
- type: 'discount',
121
- name: 'Order discount',
122
- quantity: 1,
123
- unitPrice: price(@order.display_order_adjustment_total),
124
- totalAmount: price(@order.display_order_adjustment_total),
125
- vatAmount: price(0),
126
- vatRate: '0'
127
- }
128
- end
129
-
130
- def serialize_shipping_discounts
131
- binding.pry #TODO: Not implemented
132
- {
133
- type: 'discount',
134
- name: 'Shipping discount',
135
- quantity: 1,
136
- unitPrice: price(@order.display_shipping_discount),
137
- totalAmount: price(@order.display_shipping_discount),
138
- vatAmount: price(0),
139
- vatRate: '0'
140
- }
141
- end
142
-
143
- def serialize_line_item(line_item)
144
- {
145
- type: 'physical',
146
- name: line_item.name,
147
- quantity: line_item.quantity,
148
- unitPrice: price(line_item.price),
149
- discountAmount: price(line_item.promo_total),
150
- totalAmount: price(line_item.total),
151
- vatAmount: price(line_item.included_tax_total),
152
- vatRate: line_item.tax_rate.to_f * 100, # TODO: Might need to verify this rates just one tax_rate
153
- sku: line_item.sku
154
- }
155
- end
156
-
157
- def price(amount)
158
- {
159
- value: format_money(amount),
160
- currency: @order.currency
161
- }
162
- end
163
-
164
- def format_money(money)
165
- Spree::Money.new(money, { symbol: nil, thousands_separator: nil, decimal_mark: '.' }).format
166
- end
167
- end
168
- end
169
- end
@@ -1,62 +0,0 @@
1
- module Spree
2
- module Mollie
3
- class PaymentStateUpdater
4
-
5
- attr_reader :payment
6
- attr_reader :mollie_order
7
-
8
- def initialize(mollie_order, payment)
9
- @mollie_order = mollie_order
10
- @payment = payment
11
- end
12
-
13
- def call
14
- case mollie_order.status
15
-
16
- when 'created'
17
- transition_to_created!
18
- when 'expired'
19
- transition_to_failed!
20
- when 'authorized'
21
- transition_to_pending!
22
- when 'paid', 'completed'
23
- transition_to_complete!
24
- when 'canceled'
25
- transition_to_void!
26
- when 'shipping'
27
- transition_to_shipping!
28
- else
29
- MollieLogger.debug("Unhandled Mollie payment state received: #{mollie_order.status}. Therefore we did not update the payment state.")
30
- end
31
-
32
- end
33
-
34
- private
35
-
36
- def transition_to_created!
37
- true
38
- end
39
-
40
- def transition_to_failed!
41
- payment.failure! unless @spree_payment.failed?
42
- end
43
-
44
- def transition_to_pending!
45
- payment.pend! unless @spree_payment.pending?
46
- end
47
-
48
- def transition_to_complete!
49
- payment.complete! unless @payment.completed?
50
- end
51
-
52
- def transition_to_void!
53
- payment.void! unless @payment.void?
54
- end
55
-
56
- def transition_to_shipping!
57
- true
58
- end
59
-
60
- end
61
- end
62
- end
@@ -1,16 +0,0 @@
1
- module Spree
2
- class MollieLogger
3
- def self.debug(message = nil)
4
- return unless message.present?
5
-
6
- @logger ||= Logger.new(File.join(Rails.root, 'log', 'solidus_mollie.log'))
7
-
8
- # .datetime_format = "%Y-%m-%d %H:%M:%S"
9
- @logger.debug(message)
10
- end
11
-
12
- class << self
13
- attr_writer :logger
14
- end
15
- end
16
- end
@@ -1,57 +0,0 @@
1
- module Spree
2
- class MolliePaymentSource < Spree::PaymentSource
3
-
4
- self.table_name = "solidus_mollie_payment_sources"
5
-
6
- def transaction_id
7
- payment_id
8
- end
9
-
10
- def method_type
11
- 'mollie_payment_source'
12
- end
13
-
14
- def name
15
- case payment_method_name
16
- when ::Mollie::Method::IDEAL then
17
- 'iDEAL'
18
- when ::Mollie::Method::CREDITCARD then
19
- 'Credit card'
20
- when ::Mollie::Method::BANCONTACT then
21
- 'Bancontact'
22
- when ::Mollie::Method::SOFORT then
23
- 'SOFORT Banking'
24
- when ::Mollie::Method::BANKTRANSFER then
25
- 'Bank transfer'
26
- when ::Mollie::Method::PAYPAL then
27
- 'PayPal'
28
- when ::Mollie::Method::KBC then
29
- 'KBC/CBC Payment Button'
30
- when ::Mollie::Method::BELFIUS then
31
- 'Belfius Pay Button'
32
- when ::Mollie::Method::PAYSAFECARD then
33
- 'paysafecard'
34
- when ::Mollie::Method::GIFTCARD then
35
- 'Giftcard'
36
- when ::Mollie::Method::INGHOMEPAY then
37
- 'ING Home\'Pay'
38
- when ::Mollie::Method::EPS then
39
- 'EPS'
40
- when ::Mollie::Method::GIROPAY then
41
- 'Giropay'
42
- when ::Mollie::Method::DIRECTDEBIT then
43
- 'SEPA Direct debit'
44
- when ::Mollie::Method::KLARNASLICEIT then
45
- 'Klarna Slice it'
46
- when ::Mollie::Method::KLARNAPAYLATER then
47
- 'Klarna Pay Later'
48
- when ::Mollie::Method::PRZELEWY24 then
49
- 'Przelewy24'
50
- when ::Mollie::Method::APPLEPAY then
51
- 'Apple Pay'
52
- else
53
- 'Mollie (Unknown method)'
54
- end
55
- end
56
- end
57
- end
@@ -1,26 +0,0 @@
1
-
2
- # frozen_string_literal: true
3
-
4
- module Spree
5
- class PaymentMethod::Mollie < Spree::PaymentMethod
6
- preference :api_key, :string
7
-
8
- def payment_source_class
9
- MolliePaymentSource
10
- end
11
-
12
- def partial_name
13
- "mollie"
14
- end
15
-
16
- def auto_capture
17
- false
18
- end
19
-
20
- protected
21
-
22
- def gateway_class
23
- Spree::Gateway::MollieGateway
24
- end
25
- end
26
- end
@@ -1,8 +0,0 @@
1
- <fieldset class="no-border-bottom js-edit-credit-card">
2
- <legend><%= payment_method.name %></legend>
3
-
4
- <div id="card_form<%= payment_method.id %>" data-hook class="js-new-credit-card-form">
5
- <% param_prefix = "payment_source[#{payment_method.id}]" %>
6
-
7
- </div>
8
- </fieldset>
@@ -1,27 +0,0 @@
1
- <fieldset data-hook="credit_card">
2
- <legend align="center"><%= Spree::MolliePaymentSource.model_name.human %></legend>
3
-
4
- <div class="row">
5
- <div class="col-12">
6
- <dl>
7
- <dt><%= t('spree.payment_method') %>:</dt>
8
- <dd><%= payment.source.payment_method_name %></dd>
9
-
10
- <dt><%= t('spree.transaction_id') %>:</dt>
11
- <dd><%= payment.source.payment_id %></dd>
12
-
13
- <dt><%= t('spree.Payment Link') %>:</dt>
14
- <dd><a href="<%= payment.source.payment_url %>"><%= payment.source.payment_url %></a></dd>
15
-
16
- <% if payment.source.issuer %>
17
- <dt><%= t('spree.issuer') %>:</dt>
18
- <dd><%= payment.source.issuer %></dd>
19
- <% end %>
20
-
21
- <dt><%= t('spree.payment_status') %>:</dt>
22
- <dd><%= payment.source.status %></dd>
23
- </dl>
24
-
25
- </div>
26
- </div>
27
- </fieldset>
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- json.(@payment, *payment_attributes)
4
- json.(@payment.source, :payment_url)
5
- #FIXME: This works, but I think there is a better way than overwriting this template
@@ -1,2 +0,0 @@
1
- attrs = [:id, :payment_url]
2
- json.(payment_source, *attrs)