Sha256: 32972667a4980cd26e2f5be3e4beb22a89125f6d7d3cd5660c7c7341636139f0

Contents?: true

Size: 754 Bytes

Versions: 2

Compression:

Stored size: 754 Bytes

Contents

# Flow.io (2017)
# communicates with flow api, responds to webhook events

module Flow::PayPal
  extend self

  def get_id(order)
    if order.flow_order
      # get PayPal ID using Flow api
      body = {
        # discriminator: 'merchant_of_record_payment_form',
        method:        'paypal',
        order_number:  order.number,
        amount:        order.flow_order.total.amount,
        currency:      order.flow_order.total.currency,
      }

      # Flow.api :post, '/:organization/payments', {}, body

      form     = ::Io::Flow::V0::Models::MerchantOfRecordPaymentForm.new body
      FlowCommerce.instance.payments.post Flow.organization, form
    else
      # to do
      raise 'PayPal only supported while using flow'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
flowcommerce-solidus-0.1.12 ./static/app/flow/flow/pay_pal.rb
flowcommerce-solidus-0.1.11 ./static/app/flow/flow/pay_pal.rb