# Activemerchant and UK Maestro (formerly Switch) problem

**URL:** <https://www.ruby-forum.com/t/activemerchant-and-uk-maestro-formerly-switch-problem/150861>\
**Category:** Rails\
**Created:** [October 14, 2008, 10:41am UTC](https://www.ruby-forum.com/t/activemerchant-and-uk-maestro-formerly-switch-problem/150861 "2008-10-14T10:41:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hubert\_SSSSSSSSSpic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/73ab20/32.png) [@Hubert\_SSSSSSSSSpic](https://www.ruby-forum.com/u/Hubert_SSSSSSSSSpic)\
**Post date:** [October 14, 2008, 10:41am UTC](https://www.ruby-forum.com/t/activemerchant-and-uk-maestro-formerly-switch-problem/150861/1 "2008-10-14T10:41:45Z")

</div>

Hi,

I am having problem with users reporting malfunctioning of UK Maestro  
cards functionality on website of a client. I am using most recent  
Activemerchant library from github, which I managed to make work with  
rails 1.2.

Reported error is:

Credit card invalid: start\_month is invalid issue\_number cannot be  
empty.

In my code I made special case for UK Maestro:

```
   credit_card = ActiveMerchant::Billing::CreditCard.new(
       :type => params[:payment][:card_type],
       :number => params[:payment][:card_number],
       :month => params[:payment][:card_valid_ex_month],
       :year => params[:payment][:card_valid_ex_year],
       :first_name => @join_request.first_name,
       :last_name => @join_request.last_name,
       :verification_value => params[:payment][:security_number]
   )

 start_month = params[:payment][:card_valid_from_month]
 start_year = params[:payment][:card_valid_from_year]
 issue_number = params[:payment][:issue_number]

 if params[:payment][:card_type] == "switch"
   credit_card.start_month = start_month if start_month and

```

start\_month != “”  
credit\_card.start\_year = start\_year if start\_year and  
start\_year !=""  
credit\_card.issue\_number = issue\_number if issue\_number and  
issue\_number != “”  
end

```
 ... do rest of processing ...

```

I am using:  
Rails 1.2 + patched activesupport to work with activemerchant  
Activemerchant 1.3.2

Please for any suggestion on what I am doing wrong or piece of code  
that is proven to work with old UK Maestro/Switch cards.

Thanks,  
H.
