lib/active_merchant/billing/gateways/payflow.rb in activemerchant-1.0.3 vs lib/active_merchant/billing/gateways/payflow.rb in activemerchant-1.1.0
- old
+ new
@@ -46,10 +46,12 @@
add_address(xml, 'BillTo', billing_address, options)
add_address(xml, 'ShipTo', shipping_address, options)
xml.tag! 'TotalAmt', amount(money), 'Currency' => currency(money)
+
+
end
xml.tag! 'Tender' do
add_credit_card(xml, credit_card)
end
@@ -63,17 +65,29 @@
xml.tag! 'CardType', CARD_MAPPING[credit_card.type.to_sym]
xml.tag! 'CardNum', credit_card.number
xml.tag! 'ExpDate', expdate(credit_card)
xml.tag! 'NameOnCard', credit_card.name
xml.tag! 'CVNum', credit_card.verification_value if credit_card.verification_value?
+
+ if [ 'switch', 'solo' ].include?(credit_card.type.to_s)
+ xml.tag!('ExtData', 'Name' => 'CardStart', 'Value' => startdate(credit_card)) unless credit_card.start_month.blank? || credit_card.start_year.blank?
+ xml.tag!('ExtData', 'Name' => 'CardIssue', 'Value' => credit_card.issue_number) unless credit_card.issue_number.blank?
+ end
end
end
def expdate(creditcard)
year = sprintf("%.4i", creditcard.year)
month = sprintf("%.2i", creditcard.month)
"#{year}#{month}"
+ end
+
+ def startdate(creditcard)
+ year = format(creditcard.start_year, :two_digits)
+ month = format(creditcard.start_month, :two_digits)
+
+ "#{month}#{year}"
end
def build_response(success, message, response, options = {})
Response.new(success, message, response, options)
end