Class: MerbMerchant::Billing::Integrations::Chronopay::Notification

Inherits:
Notification
  • Object
show all
Defined in:
lib/merb_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 MerbMerchant::Billing::Integrations::Notification

Instance Method Details

#acknowledgeObject



149
150
151
# File 'lib/merb_merchant/billing/integrations/chronopay/notification.rb', line 149

def acknowledge
  true
end

#cityObject

The customer’s city



96
97
98
# File 'lib/merb_merchant/billing/integrations/chronopay/notification.rb', line 96

def city
  params['city']
end

#complete?Boolean

Returns:

  • (Boolean)


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

def complete?
  status == 'Completed'
end

#countryObject

The customer’s country - 3 digit country code



91
92
93
# File 'lib/merb_merchant/billing/integrations/chronopay/notification.rb', line 91

def country
  params['country']
end

#currencyObject

The currency the purchase was made in



136
137
138
# File 'lib/merb_merchant/billing/integrations/chronopay/notification.rb', line 136

def currency
  params['currency']
end

#custom2Object

Additional parameter



126
127
128
# File 'lib/merb_merchant/billing/integrations/chronopay/notification.rb', line 126

def custom2
  params['cs2']
end

#custom3Object

Additional parameter



131
132
133
# File 'lib/merb_merchant/billing/integrations/chronopay/notification.rb', line 131

def custom3
  params['cs3']
end

#customer_idObject

Unique ID of customer



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

def customer_id
  params['customer_id']
end

#dateObject

Date of transaction in MM/DD/YYYY format



66
67
68
# File 'lib/merb_merchant/billing/integrations/chronopay/notification.rb', line 66

def date 
  params['date']
end

#emailObject

The customer’s email address



81
82
83
# File 'lib/merb_merchant/billing/integrations/chronopay/notification.rb', line 81

def email
  params['email']
end

#grossObject

the money amount we received in X.2 decimal.



141
142
143
# File 'lib/merb_merchant/billing/integrations/chronopay/notification.rb', line 141

def gross
  params['total']
end

#item_idObject

The item id passed in the first custom parameter



121
122
123
# File 'lib/merb_merchant/billing/integrations/chronopay/notification.rb', line 121

def item_id
  params['cs1']
end

#languageObject

Language



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

def language
  params['language']
end

#nameObject

The customer’s full name



76
77
78
# File 'lib/merb_merchant/billing/integrations/chronopay/notification.rb', line 76

def name
  params['name']
end

#passwordObject

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



116
117
118
# File 'lib/merb_merchant/billing/integrations/chronopay/notification.rb', line 116

def password
  params['password']
end

#product_idObject

ID of a product that was purchased



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

def product_id
  params['product_id']
end

#received_atObject



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

def received_at
  Time.parse("#{date} #{time}") unless date.blank? || time.blank?
end

#site_idObject

Unique ID of Merchant’s web-site



47
48
49
# File 'lib/merb_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



106
107
108
# File 'lib/merb_merchant/billing/integrations/chronopay/notification.rb', line 106

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/merb_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



86
87
88
# File 'lib/merb_merchant/billing/integrations/chronopay/notification.rb', line 86

def street
  params['street']
end

#test?Boolean

Returns:

  • (Boolean)


145
146
147
# File 'lib/merb_merchant/billing/integrations/chronopay/notification.rb', line 145

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

#timeObject

Time of transaction in HH:MM:SS format



71
72
73
# File 'lib/merb_merchant/billing/integrations/chronopay/notification.rb', line 71

def time
  params['time']
end

#transaction_idObject

Unique ID of transaction



37
38
39
# File 'lib/merb_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



111
112
113
# File 'lib/merb_merchant/billing/integrations/chronopay/notification.rb', line 111

def username
  params['username']
end

#zipObject

The customer’s zip



101
102
103
# File 'lib/merb_merchant/billing/integrations/chronopay/notification.rb', line 101

def zip
  params['zip']
end