Class: DefraRubyMocks::GovpayCreatePaymentService

Inherits:
BaseService
  • Object
show all
Defined in:
app/services/defra_ruby_mocks/govpay_create_payment_service.rb

Instance Method Summary collapse

Methods inherited from BaseService

run

Instance Method Details

#run(amount:, description:, return_url:) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/services/defra_ruby_mocks/govpay_create_payment_service.rb', line 8

def run(amount:, description:, return_url:)
  {
    created_date: Time.current,
    state: { status: "created", finished: false },
    _links: {
      self: { href: "#{base_url}/#{payment_id}", method: "GET" },
      next_url: { href: return_url, method: "GET" }
    },
    amount: amount.to_i,
    reference: "12345",
    description: description,
    payment_id: payment_id,
    payment_provider: "sandbox"
  }
end