Class: Payzilla::Gateways::Skylink

Inherits:
Gateway
  • Object
show all
Defined in:
lib/payzilla/gateways/skylink.rb

Instance Attribute Summary

Attributes inherited from Gateway

#config, #logger, #revision_page_size

Instance Method Summary collapse

Methods inherited from Gateway

available_attachments, available_settings, available_switches, can_list_providers, #can_list_providers?, can_list_providers?, #initialize, register_attachments, register_settings, register_switches, require_payment_fields, required_payment_fields, requires_revision, requires_revision?, #requires_revision?

Constructor Details

This class inherits a constructor from Payzilla::Gateways::Gateway

Instance Method Details

#check(payment) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/payzilla/gateways/skylink.rb', line 12

def check(payment)
  begin 
    result = send 'VALIDATE_PHONE',
      :PhoneNum => payment.

    return retval(result['string'].split(':').first)
  rescue Errno::ECONNRESET
    return retval(-1000)
  end
end

#pay(payment) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/payzilla/gateways/skylink.rb', line 23

def pay(payment)
  begin
    transaction = get_transaction

    result = send 'PAY_CASH_INPUT',
      :PayNum => transaction,
      :PurposeID => 2,
      :PurposeNum => payment.,
      :PaySum => (payment.enrolled_amount * 100).to_i,
      :PayDate => payment.created_at.strftime("%d.%m.%Y %H:%M:%S"),
      :RegDate => payment.created_at.strftime("%d.%m.%Y %H:%M:%S"),
      :Payer => 'Tester',
      :CardNum => '',
      :PosNum => "0",
      :PayDocNum => payment.id,
      :Dsc => '1'


    return retval(result['string'].split(':').first, transaction) #retval(result, transaction)
  rescue Errno::ECONNRESET
    return retval(-1000)
  end
end

#revise(payments, date) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/payzilla/gateways/skylink.rb', line 47

def revise(payments, date)
  builder = Builder::XmlMarkup.new

  builder.instruct!
  data = builder.payments do
    paginate_payments(payments, builder) do |slice, builder|
      generate_revision_page(slice, builder)
    end
  end

  result = send 'REPORT_XML_SEND',
    :RegDate => date.strftime("%d.%m.%Y"),
    :Register => data

  return retval(result['string'].split(':').first)
end