Class: Hps::HpsGiftCardActivate

Inherits:
HpsTransaction show all
Defined in:
lib/hps/entities/hps_gift_card.rb

Overview

= HpsGiftCardActivate =
=======================

Instance Attribute Summary collapse

Attributes inherited from HpsTransaction

#reference_number, #response_code, #response_text, #transaction_header, #transaction_id

Class Method Summary collapse

Methods inherited from HpsTransaction

#initialize

Constructor Details

This class inherits a constructor from Hps::HpsTransaction

Instance Attribute Details

#authorization_codeObject

Values used in the card activate response



19
20
21
# File 'lib/hps/entities/hps_gift_card.rb', line 19

def authorization_code
  @authorization_code
end

#balance_amountObject

Values used in the card activate response



19
20
21
# File 'lib/hps/entities/hps_gift_card.rb', line 19

def balance_amount
  @balance_amount
end

#notesObject

Notes contain reward messages to be displayed on a receipt, mobile app, or web page to inform an account holder about special rewards or promotions available on their account



28
29
30
# File 'lib/hps/entities/hps_gift_card.rb', line 28

def notes
  @notes
end

#points_balance_amountObject

Values used in the card activate response



19
20
21
# File 'lib/hps/entities/hps_gift_card.rb', line 19

def points_balance_amount
  @points_balance_amount
end

#rewardsObject

The rewards (dollars or points) added to the account as a result of the transaction



23
24
25
# File 'lib/hps/entities/hps_gift_card.rb', line 23

def rewards
  @rewards
end

Class Method Details

.from_response(response, txn_type, return_type = nil) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/hps/entities/hps_gift_card.rb', line 30

def self.from_response(response, txn_type, return_type = nil)
  activation_response = response['Transaction'][txn_type]

  activation = return_type ? return_type.constantize.new : self.new

  activation.transaction_id = response['Header']['GatewayTxnId']
  activation.authorization_code = activation_response['AuthCode']
  activation.balance_amount = activation_response['BalanceAmt']
  activation.points_balance_amount = activation_response['PointsBalanceAmt']
  activation.rewards = activation_response['Rewards']
  activation.notes = activation_response['Notes']
  activation.response_code = activation_response['RspCode']
  activation.response_text = activation_response['RspText']

  return activation
end