Class: SpreeStripe::StatementDescriptorSuffixPresenter
- Inherits:
-
Object
- Object
- SpreeStripe::StatementDescriptorSuffixPresenter
- Defined in:
- app/presenters/spree_stripe/statement_descriptor_suffix_presenter.rb
Constant Summary collapse
- STATEMENT_DESCRIPTOR_MAX_CHARS =
10- STATEMENT_DESCRIPTOR_NOT_ALLOWED_CHARS =
/[<>'"*\\]/.freeze
- STATEMENT_PREFIX =
'O#'
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(order_description:) ⇒ StatementDescriptorSuffixPresenter
constructor
A new instance of StatementDescriptorSuffixPresenter.
Constructor Details
#initialize(order_description:) ⇒ StatementDescriptorSuffixPresenter
Returns a new instance of StatementDescriptorSuffixPresenter.
7 8 9 |
# File 'app/presenters/spree_stripe/statement_descriptor_suffix_presenter.rb', line 7 def initialize(order_description:) @order_description = order_description.to_s end |
Instance Method Details
#call ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'app/presenters/spree_stripe/statement_descriptor_suffix_presenter.rb', line 11 def call return if stripped_order_description.blank? if stripped_order_description.count("A-Z") > 0 stripped_order_description else "#{STATEMENT_PREFIX}#{stripped_order_description}"[0...STATEMENT_DESCRIPTOR_MAX_CHARS].strip end end |