Skip to content

Commit

Permalink
release 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mungler committed Jan 16, 2020
1 parent 764941f commit 199734c
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 2 deletions.
43 changes: 43 additions & 0 deletions lib/pci_proxy/model/tokenised_card.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
module PciProxy
module Model
class TokenisedCard

attr_reader :pan_token, :cvv_token, :type_slug, :response

def initialize(response)
@response = response
@pan_token = response["aliasCC"]
@cvv_token = response["aliasCVV"]
@type_slug = slug_for(response["paymentMethod"])
end

private

def slug_for(payment_method)
return nil if payment_method.nil?

case payment_method
when 'VIS'
:visa
when 'ECA'
:mastercard
when 'AMX'
:amex
when 'DIN'
:diners
when 'DIS'
:discovery
when 'JCB'
:jcb
when 'ELO'
:elo
when 'CUP'
:cup
else
:unknown
end

end
end
end
end
3 changes: 2 additions & 1 deletion lib/pci_proxy/token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ def initialize(api_username:, api_password:)
# @raise [PciProxyAPIError] in cases where the API responds with a non-200 response code
# @return [Hash] result from PCI Proxy, decoded from JSON
def execute(transaction_id:, return_payment_method: true, cvv_mandatory: false)
request(params: { transactionId: transaction_id, returnPaymentMethod: return_payment_method, mandatoryAliasCVV: cvv_mandatory })
response = request(params: { transactionId: transaction_id, returnPaymentMethod: return_payment_method, mandatoryAliasCVV: cvv_mandatory })
PciProxy::Model::TokenisedCard.new(response)
end

end
Expand Down
2 changes: 1 addition & 1 deletion lib/pci_proxy/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module PciProxy
VERSION = "1.0.1"
VERSION = "1.1.0"
end

0 comments on commit 199734c

Please sign in to comment.