lib/pay/payment.rb in pay-3.0.13 vs lib/pay/payment.rb in pay-3.0.14

- old
+ new

@@ -1,10 +1,10 @@ module Pay class Payment attr_reader :intent - delegate :id, :amount, :client_secret, :customer, :status, :confirm, to: :intent + delegate :id, :amount, :client_secret, :currency, :customer, :status, :confirm, to: :intent def self.from_id(id) intent = id.start_with?("seti_") ? ::Stripe::SetupIntent.retrieve(id) : ::Stripe::PaymentIntent.retrieve(id) new(intent) end @@ -37,9 +37,13 @@ intent.is_a?(::Stripe::PaymentIntent) end def setup_intent? intent.is_a?(::Stripe::SetupIntent) + end + + def amount_with_currency + Pay::Currency.format(amount, currency: currency) end def validate if requires_payment_method? raise Pay::InvalidPaymentMethod.new(self)