diff --git a/lib/active_merchant/billing/gateways/litle.rb b/lib/active_merchant/billing/gateways/litle.rb index afb742a09f2..10b80277fb0 100755 --- a/lib/active_merchant/billing/gateways/litle.rb +++ b/lib/active_merchant/billing/gateways/litle.rb @@ -335,7 +335,7 @@ def create_hash(money, options) end if options[:description] - enhanced_data['customerReference'] = options[:description] + enhanced_data['customerReference'] = options[:description][0..16] end if options[:billing_address] diff --git a/test/unit/gateways/litle_test.rb b/test/unit/gateways/litle_test.rb index 8ca342b3e0c..5a895b35911 100755 --- a/test/unit/gateways/litle_test.rb +++ b/test/unit/gateways/litle_test.rb @@ -744,6 +744,20 @@ def test_deprecated_credit end end + def test_refund_should_not_error_on_customer_reference_length + return_object = { + 'response' => '0', + 'creditResponse' => { + 'response' => '000', + 'message' => 'pass', + 'litleTxnId' =>'123456789012345678' + } + } + LitleOnline::Communications.expects(:http_post => return_object.to_xml(:root => 'litleOnlineResponse')) + response = @gateway.refund(0, "1234;credit", {:description => 'A lengthy refund description'}) + assert response.success? + end + private def with_litle_configuration_restoration(&block)