mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-19 13:54:25 +01:00
retrieve gateway objects with multiple ids
This commit is contained in:
parent
87cd41794e
commit
4e109f7edb
@ -1,3 +1,5 @@
|
||||
@use 'sass:math';
|
||||
|
||||
// a flag to toggle asset pipeline / compass integration
|
||||
// defaults to true if twbs-font-path function is present (no function => twbs-font-path('') parsed as string == right side)
|
||||
// in Sass 3.3 this can be improved with: function-exists(twbs-font-path)
|
||||
@ -471,8 +473,8 @@ $container-lg: $container-large-desktop !default;
|
||||
$navbar-height: 50px !default;
|
||||
$navbar-margin-bottom: $line-height-computed !default;
|
||||
$navbar-border-radius: $border-radius-base !default;
|
||||
$navbar-padding-horizontal: floor($grid-gutter-width / 2) !default;
|
||||
$navbar-padding-vertical: ($navbar-height - $line-height-computed) / 2 !default;
|
||||
$navbar-padding-horizontal: floor(math.div($grid-gutter-width, 2)) !default;
|
||||
$navbar-padding-vertical: math.div($navbar-height - $line-height-computed, 2) !default;
|
||||
$navbar-collapse-max-height: 340px !default;
|
||||
|
||||
$navbar-default-color: #777 !default;
|
||||
|
@ -16,10 +16,10 @@ class PaymentGatewayObject < ApplicationRecord
|
||||
belongs_to :space, foreign_type: 'Space', foreign_key: 'item_id'
|
||||
belongs_to :training, foreign_type: 'Training', foreign_key: 'item_id'
|
||||
|
||||
has_one :payment_gateway_object # some objects may require a reference to another object for remote recovery
|
||||
belongs_to :payment_gateway_object # some objects may require a reference to another object for remote recovery
|
||||
|
||||
def gateway_object
|
||||
related_item = !payment_gateway_object_id.nil? ? payment_gateway_object&.gateway_object_id : nil
|
||||
related_item = payment_gateway_object&.gateway_object_id
|
||||
Payment::ItemBuilder.build(gateway_object_type, gateway_object_id, related_item)
|
||||
end
|
||||
|
||||
|
@ -7,7 +7,7 @@ class CreatePaymentGatewayObjects < ActiveRecord::Migration[5.2]
|
||||
t.string :gateway_object_id
|
||||
t.string :gateway_object_type
|
||||
t.references :item, polymorphic: true
|
||||
t.number :payment_gateway_object_id
|
||||
t.references :payment_gateway_object, index: true, foreign_key: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -16,8 +16,11 @@ class PayZen::Item < Payment::Item
|
||||
def retrieve(id = nil, *args)
|
||||
@id ||= id
|
||||
@args ||= args
|
||||
params = [@id].concat(@args)
|
||||
params.compact!
|
||||
|
||||
client = klass.constantize.new
|
||||
client.get(@id, *@args)
|
||||
client.get(*params)
|
||||
end
|
||||
|
||||
def payment_mean?
|
||||
|
@ -9,7 +9,7 @@ module Stripe; end
|
||||
class Stripe::Item < Payment::Item
|
||||
attr_accessor :id
|
||||
|
||||
def retrieve(id = nil)
|
||||
def retrieve(id = nil, *_args)
|
||||
@id ||= id
|
||||
klass.constantize.retrieve(@id, api_key: Setting.get('stripe_secret_key'))
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user