Class: Pay::AwsMarketplace::Customer

Inherits:
Customer
  • Object
show all
Defined in:
lib/pay/aws_marketplace/customer.rb

Instance Method Summary collapse

Instance Method Details

#add_payment_method(payment_method_id, default: false) ⇒ Object

Raises:



33
34
35
# File 'lib/pay/aws_marketplace/customer.rb', line 33

def add_payment_method(payment_method_id, default: false)
  raise PaymentMethodError
end

#api_recordObject



11
12
13
# File 'lib/pay/aws_marketplace/customer.rb', line 11

def api_record
  {customer_identifier: processor_id, customer_aws_account_id: }.compact
end

#charge(amount, options = {}) ⇒ Object

Raises:



19
20
21
# File 'lib/pay/aws_marketplace/customer.rb', line 19

def charge(amount, options = {})
  raise ChargeError, "AWS Marketplace does not support one-off charges"
end

#checkout(product_id:) ⇒ Object



23
24
25
26
27
# File 'lib/pay/aws_marketplace/customer.rb', line 23

def checkout(product_id:)
  URI("https://aws.amazon.com/marketplace/procurement").tap do |url|
    url.query = URI.encode_www_form(productId: product_id)
  end.to_s
end

#subscribe(name: Pay.default_product_name, plan: Pay.default_plan_name, **options) ⇒ Object

Raises:



29
30
31
# File 'lib/pay/aws_marketplace/customer.rb', line 29

def subscribe(name: Pay.default_product_name, plan: Pay.default_plan_name, **options)
  raise UpdateError
end

#update_api_record(**attributes) ⇒ Object

Raises:



15
16
17
# File 'lib/pay/aws_marketplace/customer.rb', line 15

def update_api_record(**attributes)
  raise UpdateError, "AWS Marketplace does not allow updating customer information"
end