virtual_merchant 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/virtual_merchant.rb +10 -10
  2. metadata +1 -1
@@ -7,27 +7,27 @@ class VirtualMerchant
7
7
  require 'virtual_merchant/response'
8
8
 
9
9
  def self.charge(card, amount, creds)
10
- xml = self.generateXMLforVirtualMerchant(card, amount, creds)
10
+ xml = self.generateXMLforVirtualMerchant(card, amount, creds, "ccsale")
11
11
  vm_response = self.sendXMLtoVirtualMerchant(xml, creds)
12
12
  response = self.generateResponse(vm_response)
13
13
  self.printResponse(response)
14
14
  response
15
15
  end
16
16
 
17
- def self.generateXMLforVirtualMerchant(card, amount, creds)
18
- if amount.total.to_f > 0
19
- #if the amount to be processed is a positive number, this is a sale
20
- transactionType = 'ccsale'
21
- else
22
- #if the amount to be processed is a negative number, this is a return
23
- transactionType = 'cccredit'
24
- end
17
+ def self.refund(card, amount, creds)
18
+ xml = self.generateXMLforVirtualMerchant(card, amount, creds, 'cccredit')
19
+ vm_response = self.sendXMLtoVirtualMerchant(xml, creds)
20
+ response = self.generateResponse(vm_response)
21
+ self.printResponse(response)
22
+ response
23
+ end
25
24
 
25
+ def self.generateXMLforVirtualMerchant(card, amount, creds, transaction_type)
26
26
  xml = "xmldata=<txn>
27
27
  <ssl_merchant_id>" + creds.account_id + "</ssl_merchant_id>
28
28
  <ssl_user_id>" + creds.user_id + "</ssl_user_id>
29
29
  <ssl_pin>" + creds.pin + "</ssl_pin>
30
- <ssl_transaction_type>" + transactionType + "</ssl_transaction_type>
30
+ <ssl_transaction_type>" + transaction_type + "</ssl_transaction_type>
31
31
  <ssl_amount>" + amount.total + "</ssl_amount>
32
32
  <ssl_salestax>" + amount.tax + "</ssl_salestax>
33
33
  <ssl_customer_code>" + card.last_four + "</ssl_customer_code>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: virtual_merchant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: