Module: Jamm::Contract
- Defined in:
- lib/jamm/contract.rb
Class Method Summary collapse
- .create_with_charge(buyer:, charge:, redirect:) ⇒ Object
- .create_without_charge(buyer:, redirect:) ⇒ Object
- .get(customer_id) ⇒ Object
Class Method Details
.create_with_charge(buyer:, charge:, redirect:) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/jamm/contract.rb', line 10 def self.create_with_charge(buyer:, charge:, redirect:) request = Jamm::OpenAPI::CreateContractWithChargeRequest.new( buyer: buyer, charge: charge, redirect: redirect ) Jamm::OpenAPI::PaymentApi.new(Jamm::Client.handler).create_contract_with_charge(request) rescue Jamm::OpenAPI::ApiError => e raise Jamm::ApiError.from_error(e) end |
.create_without_charge(buyer:, redirect:) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/jamm/contract.rb', line 22 def self.create_without_charge(buyer:, redirect:) request = Jamm::OpenAPI::CreateContractWithoutChargeRequest.new( buyer: buyer, redirect: redirect ) Jamm::OpenAPI::PaymentApi.new(Jamm::Client.handler).create_contract_without_charge(request) rescue Jamm::OpenAPI::ApiError => e raise Jamm::ApiError.from_error(e) end |
.get(customer_id) ⇒ Object
33 34 35 36 37 |
# File 'lib/jamm/contract.rb', line 33 def self.get(customer_id) Jamm::OpenAPI::CustomerApi.new(Jamm::Client.handler).get_contract(customer_id) rescue Jamm::OpenAPI::ApiError => e [404].include?(e.code) ? nil : Jamm::ApiError.from_error(e) end |