Class: Spree::PayoutProvider::System

Inherits:
Base
  • Object
show all
Defined in:
app/models/spree/payout_provider/system.rb

Overview

The built-in provider: it keeps the books and moves no money.

This is what a marketplace runs before it connects anything. Sellers accrue earnings as their orders ship, those earnings batch into settlements on schedule, and the operator sees exactly what is owed to whom — then pays it by bank transfer and marks the settlement complete.

An earning is confirmed immediately, because with no remote party there is nothing to confirm: the seller has shipped and the marketplace holds their money. A settlement, by contrast, stays pending until somebody says it was actually sent — that is a claim about the outside world, and only a person can make it here.

Instance Method Summary collapse

Methods inherited from Base

available_for_store?, #available_payout, display_name, #idempotency_key, #onboarded?, #onboarding_message, #onboarding_state, #onboarding_url, provider_key, reference_system, requires_payout_account?, to_api_hash

Methods included from ApiTyped

#api_type, api_type_for, #api_typed_family, class_name_for, find, registered_class

Instance Method Details

#pay!(seller_payout) ⇒ Object

Deliberately does nothing. The payout waits in the operator's queue until it is marked paid — recording it as settled here would assert a bank transfer nobody has made.



24
25
26
# File 'app/models/spree/payout_provider/system.rb', line 24

def pay!(seller_payout)
  seller_payout
end

#reverse!(seller_transfer) ⇒ Object

The ledger row is the whole reversal. Nothing was ever sent, so nothing has to come back.



30
31
32
33
# File 'app/models/spree/payout_provider/system.rb', line 30

def reverse!(seller_transfer)
  seller_transfer.update!(status: 'completed')
  seller_transfer
end

#transfer!(seller_transfer) ⇒ Object



16
17
18
19
# File 'app/models/spree/payout_provider/system.rb', line 16

def transfer!(seller_transfer)
  seller_transfer.update!(status: 'completed')
  seller_transfer
end