Class: OffsitePayments::Integrations::Chronopay::Notification

Inherits:
Notification
  • Object
show all
Defined in:
lib/offsite_payments/integrations/chronopay.rb

Instance Attribute Summary

Attributes inherited from Notification

#params, #raw

Instance Method Summary collapse

Methods inherited from Notification

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

Constructor Details

This class inherits a constructor from OffsitePayments::Notification

Instance Method Details

#acknowledge(authcode = nil) ⇒ Object



274
275
276
# File 'lib/offsite_payments/integrations/chronopay.rb', line 274

def acknowledge(authcode = nil)
  true
end

#cityObject

The customer’s city



221
222
223
# File 'lib/offsite_payments/integrations/chronopay.rb', line 221

def city
  params['city']
end

#complete?Boolean

Returns:

  • (Boolean)


129
130
131
# File 'lib/offsite_payments/integrations/chronopay.rb', line 129

def complete?
  status == 'Completed'
end

#countryObject

The customer’s country - 3 digit country code



216
217
218
# File 'lib/offsite_payments/integrations/chronopay.rb', line 216

def country
  params['country']
end

#currencyObject

The currency the purchase was made in



261
262
263
# File 'lib/offsite_payments/integrations/chronopay.rb', line 261

def currency
  params['currency']
end

#custom2Object

Additional parameter



251
252
253
# File 'lib/offsite_payments/integrations/chronopay.rb', line 251

def custom2
  params['cs2']
end

#custom3Object

Additional parameter



256
257
258
# File 'lib/offsite_payments/integrations/chronopay.rb', line 256

def custom3
  params['cs3']
end

#customer_idObject

Unique ID of customer



165
166
167
# File 'lib/offsite_payments/integrations/chronopay.rb', line 165

def customer_id
  params['customer_id']
end

#dateObject

Date of transaction in MM/DD/YYYY format



191
192
193
# File 'lib/offsite_payments/integrations/chronopay.rb', line 191

def date
  params['date']
end

#emailObject

The customer’s email address



206
207
208
# File 'lib/offsite_payments/integrations/chronopay.rb', line 206

def email
  params['email']
end

#grossObject

the money amount we received in X.2 decimal.



266
267
268
# File 'lib/offsite_payments/integrations/chronopay.rb', line 266

def gross
  params['total']
end

#item_idObject

The item id passed in the first custom parameter



246
247
248
# File 'lib/offsite_payments/integrations/chronopay.rb', line 246

def item_id
  params['cs1']
end

#languageObject

Language



180
181
182
# File 'lib/offsite_payments/integrations/chronopay.rb', line 180

def language
  params['language']
end

#nameObject

The customer’s full name



201
202
203
# File 'lib/offsite_payments/integrations/chronopay.rb', line 201

def name
  params['name']
end

#passwordObject

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



241
242
243
# File 'lib/offsite_payments/integrations/chronopay.rb', line 241

def password
  params['password']
end

#product_idObject

ID of a product that was purchased



175
176
177
# File 'lib/offsite_payments/integrations/chronopay.rb', line 175

def product_id
  params['product_id']
end

#received_atObject



184
185
186
187
188
# File 'lib/offsite_payments/integrations/chronopay.rb', line 184

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



170
171
172
# File 'lib/offsite_payments/integrations/chronopay.rb', line 170

def site_id
  params['site_id']
end

#stateObject

The customer’s state. Only useful for US Customers



231
232
233
# File 'lib/offsite_payments/integrations/chronopay.rb', line 231

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



146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/offsite_payments/integrations/chronopay.rb', line 146

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



211
212
213
# File 'lib/offsite_payments/integrations/chronopay.rb', line 211

def street
  params['street']
end

#test?Boolean

Returns:

  • (Boolean)


270
271
272
# File 'lib/offsite_payments/integrations/chronopay.rb', line 270

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

#timeObject

Time of transaction in HH:MM:SS format



196
197
198
# File 'lib/offsite_payments/integrations/chronopay.rb', line 196

def time
  params['time']
end

#transaction_idObject

Unique ID of transaction



160
161
162
# File 'lib/offsite_payments/integrations/chronopay.rb', line 160

def transaction_id
  params['transaction_id']
end

#usernameObject

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



236
237
238
# File 'lib/offsite_payments/integrations/chronopay.rb', line 236

def username
  params['username']
end

#zipObject

The customer’s zip



226
227
228
# File 'lib/offsite_payments/integrations/chronopay.rb', line 226

def zip
  params['zip']
end