Class: ActiveMerchant::Billing::Integrations::Chronopay::Notification

Inherits:
Notification
  • Object
show all
Defined in:
lib/active_merchant/billing/integrations/chronopay/notification.rb

Instance Attribute Summary

Attributes inherited from Notification

#params, #raw

Instance Method Summary collapse

Methods inherited from Notification

#amount, #empty!, #gross_cents, #initialize, #valid_sender?

Constructor Details

This class inherits a constructor from ActiveMerchant::Billing::Integrations::Notification

Instance Method Details

#acknowledge(authcode = nil) ⇒ Object



151
152
153
# File 'lib/active_merchant/billing/integrations/chronopay/notification.rb', line 151

def acknowledge(authcode = nil)
  true
end

#cityObject

The customer’s city



98
99
100
# File 'lib/active_merchant/billing/integrations/chronopay/notification.rb', line 98

def city
  params['city']
end

#complete?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/active_merchant/billing/integrations/chronopay/notification.rb', line 6

def complete?
  status == 'Completed'
end

#countryObject

The customer’s country - 3 digit country code



93
94
95
# File 'lib/active_merchant/billing/integrations/chronopay/notification.rb', line 93

def country
  params['country']
end

#currencyObject

The currency the purchase was made in



138
139
140
# File 'lib/active_merchant/billing/integrations/chronopay/notification.rb', line 138

def currency
  params['currency']
end

#custom2Object

Additional parameter



128
129
130
# File 'lib/active_merchant/billing/integrations/chronopay/notification.rb', line 128

def custom2
  params['cs2']
end

#custom3Object

Additional parameter



133
134
135
# File 'lib/active_merchant/billing/integrations/chronopay/notification.rb', line 133

def custom3
  params['cs3']
end

#customer_idObject

Unique ID of customer



42
43
44
# File 'lib/active_merchant/billing/integrations/chronopay/notification.rb', line 42

def customer_id
  params['customer_id']
end

#dateObject

Date of transaction in MM/DD/YYYY format



68
69
70
# File 'lib/active_merchant/billing/integrations/chronopay/notification.rb', line 68

def date 
  params['date']
end

#emailObject

The customer’s email address



83
84
85
# File 'lib/active_merchant/billing/integrations/chronopay/notification.rb', line 83

def email
  params['email']
end

#grossObject

the money amount we received in X.2 decimal.



143
144
145
# File 'lib/active_merchant/billing/integrations/chronopay/notification.rb', line 143

def gross
  params['total']
end

#item_idObject

The item id passed in the first custom parameter



123
124
125
# File 'lib/active_merchant/billing/integrations/chronopay/notification.rb', line 123

def item_id
  params['cs1']
end

#languageObject

Language



57
58
59
# File 'lib/active_merchant/billing/integrations/chronopay/notification.rb', line 57

def language
  params['language']
end

#nameObject

The customer’s full name



78
79
80
# File 'lib/active_merchant/billing/integrations/chronopay/notification.rb', line 78

def name
  params['name']
end

#passwordObject

Customer’s password for restricted access zone of Merchant’s Web-site, as chosen



118
119
120
# File 'lib/active_merchant/billing/integrations/chronopay/notification.rb', line 118

def password
  params['password']
end

#product_idObject

ID of a product that was purchased



52
53
54
# File 'lib/active_merchant/billing/integrations/chronopay/notification.rb', line 52

def product_id
  params['product_id']
end

#received_atObject



61
62
63
64
65
# File 'lib/active_merchant/billing/integrations/chronopay/notification.rb', line 61

def received_at
  # Date should be formatted "dd-mm-yy" to be parsed by 1.8 and 1.9 the same way
  formatted_date = Date.strptime(date, "%m/%d/%Y").strftime("%d-%m-%Y")
  Time.parse("#{formatted_date} #{time}") unless date.blank? || time.blank?
end

#site_idObject

Unique ID of Merchant’s web-site



47
48
49
# File 'lib/active_merchant/billing/integrations/chronopay/notification.rb', line 47

def site_id 
  params['site_id']
end

#stateObject

The customer’s state. Only useful for US Customers



108
109
110
# File 'lib/active_merchant/billing/integrations/chronopay/notification.rb', line 108

def state
  params['state']
end

#statusObject

Status of transaction. List of possible values:

onetime – one time payment has been made, no repayment required;
initial – first payment has been made, repayment required in corresponding period;
decline – charge request has been rejected;
<tt>rebill – repayment has been made together with initial transaction;</ttt>
cancel – repayments has been disabled;
expire – customer’s access to restricted zone membership has been expired;
refund – request to refund has been received;
chargeback – request to chargeback has been received.

This implementation of Chronopay does not support subscriptions. The status codes used are matched to the status codes that Paypal sends. See Paypal::Notification#status for more details



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/active_merchant/billing/integrations/chronopay/notification.rb', line 23

def status
  case params['transaction_type']
  when 'onetime'
    'Completed'
  when 'refund'
    'Refunded'
  when 'chargeback'
    'Reversed'
  else
    'Failed'
  end
end

#streetObject

The customer’s street address



88
89
90
# File 'lib/active_merchant/billing/integrations/chronopay/notification.rb', line 88

def street
  params['street']
end

#test?Boolean

Returns:

  • (Boolean)


147
148
149
# File 'lib/active_merchant/billing/integrations/chronopay/notification.rb', line 147

def test?
  date.blank? && time.blank? && transaction_id.blank?
end

#timeObject

Time of transaction in HH:MM:SS format



73
74
75
# File 'lib/active_merchant/billing/integrations/chronopay/notification.rb', line 73

def time
  params['time']
end

#transaction_idObject

Unique ID of transaction



37
38
39
# File 'lib/active_merchant/billing/integrations/chronopay/notification.rb', line 37

def transaction_id
  params['transaction_id']
end

#usernameObject

Customer’s login for restricted access zone of Merchant’s Web-site



113
114
115
# File 'lib/active_merchant/billing/integrations/chronopay/notification.rb', line 113

def username
  params['username']
end

#zipObject

The customer’s zip



103
104
105
# File 'lib/active_merchant/billing/integrations/chronopay/notification.rb', line 103

def zip
  params['zip']
end