Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions lib/ioki/apis/passenger_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,26 @@ class PassengerApi
base_path: [API_BASE_PATH, 'geocoding', 'session', :id],
path: 'details',
model_class: Ioki::Model::Passenger::GeocodingSearchDetails
),
Endpoints.crud_endpoints(
:purchase,
base_path: [API_BASE_PATH],
model_class: Ioki::Model::Passenger::Purchase,
only: [:index, :show]
),
Endpoints::UpdateSingular.new(
:reserve_debit,
path: 'reserve_debit',
base_path: [API_BASE_PATH, 'purchases', :id],
model_class: Ioki::Model::Passenger::Purchase,
outgoing_model_class: Ioki::Model::Passenger::ReserveDebit
),
Endpoints::UpdateSingular.new(
:settle_debit,
path: 'settle_debit',
base_path: [API_BASE_PATH, 'purchases', :id],
model_class: Ioki::Model::Passenger::Purchase,
outgoing_model_class: Ioki::Model::Passenger::SettleDebit
)
].freeze
end
Expand Down
2 changes: 2 additions & 0 deletions lib/ioki/model/passenger/booking.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ class Booking < Base
omit_if_nil_on: :create

attribute :paypal_secure_element, type: :string, on: :create, omit_if_nil_on: :create
attribute :on_session, on: :create, type: :boolean, omit_if_nil_on: :create
attribute :async, on: :create, type: :boolean, omit_if_nil_on: :create
end
end
end
Expand Down
37 changes: 37 additions & 0 deletions lib/ioki/model/passenger/invoice.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# frozen_string_literal: true

module Ioki
module Model
module Passenger
class Invoice < Base
attribute :type,
on: :read,
type: :string

attribute :id,
on: :read,
type: :string

attribute :created_at,
on: :read,
type: :date_time

attribute :updated_at,
on: :read,
type: :date_time

attribute :attachment_url,
on: :read,
type: :string

attribute :user_id,
on: :read,
type: :string

attribute :purchase_id,
on: :read,
type: :string
end
end
end
end
69 changes: 69 additions & 0 deletions lib/ioki/model/passenger/nested_charge.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# frozen_string_literal: true

module Ioki
module Model
module Passenger
class NestedCharge < Base
attribute :type,
on: :read,
type: :string

attribute :id,
on: :read,
type: :string

attribute :created_at,
on: :read,
type: :date_time

attribute :updated_at,
on: :read,
type: :date_time

attribute :amount,
on: :read,
type: :object,
class_name: 'Money'

attribute :charge_type,
on: :read,
type: :string

attribute :payment_charge_id,
on: :read,
type: :string

attribute :payment_method,
on: :read,
type: :object,
class_name: 'PaymentMethod'

attribute :pending_action,
on: :read,
type: :object,
class_name: 'Payment::ChargeChallenge'

attribute :purchase_ids,
on: :read,
type: :array

attribute :receipt,
on: :read,
type: :object,
class_name: 'Receipt'

attribute :reservation,
on: :read,
type: :boolean

attribute :state,
on: :read,
type: :string

attribute :user_id,
on: :read,
type: :string
end
end
end
end
23 changes: 23 additions & 0 deletions lib/ioki/model/passenger/nested_charge_split.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# frozen_string_literal: true

module Ioki
module Model
module Passenger
class NestedChargeSplit < Base
attribute :amount,
on: :read,
type: :object,
class_name: 'Money'

attribute :purchase_id,
on: :read,
type: :string

attribute :charge,
on: :read,
type: :object,
class_name: 'NestedCharge'
end
end
end
end
20 changes: 20 additions & 0 deletions lib/ioki/model/passenger/payment/charge_challenge.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# frozen_string_literal: true

module Ioki
module Model
module Passenger
module Payment
class ChargeChallenge < Base
attribute :type,
on: :read,
type: :string

attribute :action,
on: :read,
type: :object,
class_name: ['OpenUrl']
end
end
end
end
end
19 changes: 19 additions & 0 deletions lib/ioki/model/passenger/payment/open_url.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

module Ioki
module Model
module Passenger
module Payment
class OpenUrl < Base
attribute :type,
on: :read,
type: :string

attribute :url,
on: :read,
type: :string
end
end
end
end
end
4 changes: 2 additions & 2 deletions lib/ioki/model/passenger/payment_method.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ module Model
module Passenger
class PaymentMethod < Base
attribute :type, on: :read, type: :string
attribute :id, on: [:read, :create], type: :string, omit_if_blank_on: :create
attribute :id, on: [:read, :create, :update], type: :string, omit_if_blank_on: :create
attribute :created_at, on: :read, type: :date_time
attribute :updated_at, on: :read, type: :date_time
attribute :payment_method_type, on: :create, type: :string
attribute :payment_method_type, on: [:create, :update], type: :string
attribute :requires_paypal_secure_element, on: :read, type: :boolean
attribute :attached, on: :read, type: :boolean
attribute :summary, on: :read, type: :object, class_name: 'PaymentMethodSummary'
Expand Down
2 changes: 2 additions & 0 deletions lib/ioki/model/passenger/personal_discount.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class PersonalDiscount < Base

attribute :personal_discount_type_id, on: :create, type: :string
attribute :paypal_secure_element, on: :create, type: :string, omit_if_nil_on: :create
attribute :on_session, on: :create, type: :boolean, omit_if_nil_on: :create
attribute :async, on: :create, type: :boolean, omit_if_nil_on: :create
end
end
end
Expand Down
120 changes: 120 additions & 0 deletions lib/ioki/model/passenger/purchase.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# frozen_string_literal: true

module Ioki
module Model
module Passenger
class Purchase < Base
attribute :type,
on: :read,
type: :string

attribute :id,
on: :read,
type: :string

attribute :created_at,
on: :read,
type: :date_time

attribute :updated_at,
on: :read,
type: :date_time

attribute :amount,
on: :read,
type: :object,
class_name: 'Money'

attribute :purchase_type,
on: :read,
type: :string

attribute :charge_splits,
on: :read,
type: :array,
force_type: true,
class_name: 'NestedChargeSplit'

attribute :claimable_at,
on: :read,
type: :date_time

attribute :creator_type,
on: :read,
type: :string

attribute :creator_id,
on: :read,
type: :string

attribute :debit_purchase_id,
on: :read,
type: :string

attribute :forfeited_at,
on: :read,
type: :date_time

attribute :gifted_amount,
on: :read,
type: :object,
class_name: 'Money'

attribute :invoices,
on: :read,
type: :array,
class_name: 'Invoice'

attribute :invoice,
on: :read,
type: :object,
class_name: 'Invoice'

attribute :payment_action,
on: :read,
type: :string

attribute :payment_method,
on: :read,
type: :object,
class_name: 'PaymentMethod'

attribute :purchasable_description,
on: :read,
type: :string

attribute :purchasable_title,
on: :read,
type: :string

attribute :purchasable_id,
on: :read,
type: :string

attribute :purchasable_type,
on: :read,
type: :string

attribute :ride_id,
on: :read,
type: :string

attribute :reason,
on: :read,
type: :string

attribute :state,
on: :read,
type: :string

attribute :succeeded_at,
on: :read,
type: :date_time

attribute :user_id,
on: :read,
type: :string
end
end
end
end
1 change: 1 addition & 0 deletions lib/ioki/model/passenger/receipt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Receipt < Base
attribute :updated_at, on: :read, type: :date_time
attribute :attachment_url, on: :read, type: :string
attribute :receipt_type, on: :read, type: :string
attribute :charge_id, on: :read, type: :string
end
end
end
Expand Down
13 changes: 13 additions & 0 deletions lib/ioki/model/passenger/reserve_debit.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

module Ioki
module Model
module Passenger
class ReserveDebit < Base
attribute :paypal_secure_element,
on: :update,
type: :string
end
end
end
end
2 changes: 2 additions & 0 deletions lib/ioki/model/passenger/service_credit_create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ def self.schema_path
attribute :value, type: :integer, on: :create
attribute :payment_method, type: :object, on: :create, class_name: 'PaymentMethod'
attribute :paypal_secure_element, type: :string, on: :create, omit_if_nil_on: :create
attribute :on_session, on: :create, type: :boolean, omit_if_nil_on: :create
attribute :async, on: :create, type: :boolean, omit_if_nil_on: :create
end
end
end
Expand Down
Loading
Loading