Sha256: d53c28d17dbc586f07d5b66e5441ad1baaa57ae6478162fc79252fedf269b1da

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 KB

Contents

module PaymentPlanExtension

  def add_billing_payment_plan(session_key, billing_id, billing_type_id, start_date=nil, end_date=nil, options={})
    parameters =
      {
          'BillingScheduleId': billing_id,
          'BillingTypeId': billing_type_id,
          'StartDate': start_date,
          'EndDate': end_date
      }
    options.merge!(basic_auth: @auth, headers: @headers)
    options.merge!(:body => parameters)
    response = self.class.post(base_api_endpoint("Web/Cart/#{session_key}/Payments/Plan/Schedule"), options)
    JSON.parse(response.body)
  end

  def validate_payment_plan(session_key, options={})
    parameters =
      {
          'ValidatePaymentPlan': true
      }
    options.merge!(basic_auth: @auth, headers: @headers)
    options.merge!(:body => parameters)
    response = self.class.post(base_api_endpoint("Web/Cart/#{session_key}/Validate"), options)
    JSON.parse(response.body)
  end

  def remove_payment_plan(session_key, options={})
    options.merge!(basic_auth: @auth, headers: @headers)
    self.class.delete(base_api_endpoint("Web/Cart/#{session_key}/Payments/Plan"), options)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tessitura_rest-0.4.3 lib/tessitura_rest/web/payment_plan_extension.rb
tessitura_rest-0.4.2 lib/tessitura_rest/web/payment_plan_extension.rb
tessitura_rest-0.4.1 lib/tessitura_rest/web/payment_plan_extension.rb
tessitura_rest-0.4.0 lib/tessitura_rest/web/payment_plan_extension.rb