CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Financial Transaction ID Error
Pages: [1]

Author Topic: Financial Transaction ID Error  (Read 1206 times)

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Financial Transaction ID Error
May 10, 2012, 12:44:41 pm
I am trying to get the CyberSource payment processor to work with CiviCRM 4.1.2. It is working on the CyberSource end, but now on the CiviCRM. The error is:

Code: [Select]
INSERT INTO civicrm_financial_trxn (trxn_date , trxn_type , total_amount , net_amount , currency , payment_processor ) VALUES ( 20120510151707 , 'Debit' ,  1 ,  1 , 'USD' , 'CyberSource' )  [nativecode=1062 ** Duplicate entry '' for key 'UI_ft_trxn_id']
Which means that because it's not submitting any value for the field trxn_id only one such record can exist. After that, it errors on the unique key set for that field.

Any suggestions where to look next to debug this particular issue?
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Financial Transaction ID Error
May 10, 2012, 01:41:14 pm

if cybersource is not returning a trxn_id, then the PP code should generate one internally and set it in the return values so civi can use it

I think the PP interface assumes that the PP generates a unique trxn_id

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Financial Transaction ID Error
May 10, 2012, 01:45:35 pm
I contacted them and they said that they are sending a trans id and they will email me the return data so I can examine it.

But which file is it that stores this record?

Thank you.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Financial Transaction ID Error
May 10, 2012, 01:55:29 pm

check a file like: CRM/Core/Payment/PayPalImpl.php

search for trxn_id

Civi expects that to be returned if a successful payment has happened

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Financial Transaction ID Error
May 12, 2012, 03:56:31 pm
I manually examined the return codes from CyberSource and I added this parameter to the return call in the code. Appears to work now. We will test more and then publish the new code on github.

I am guessing that older versions of CiviCRM didn't require this field, because the code I got from github, purported to work with CiviCRM 3.2, wasn't storing it.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Financial Transaction ID Error
May 12, 2012, 06:17:30 pm

hmm, dont think so. that code has not changed in ages to the best of my memory. however, as we get older our memory cells die, so my memory is not as reliable as i think :P

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Financial Transaction ID Error
May 13, 2012, 03:10:54 am
Quote from: Donald Lobo on May 12, 2012, 06:17:30 pm
so my memory is not as reliable as i think :P

This may be the case. Look at this:

Code: [Select]
$ grep -r ft_trxn_id *
CRM/Upgrade/TwoOne/sql/misc.mysql:    ADD UNIQUE `UI_ft_trxn_id` (`trxn_id`);
CRM/Upgrade/TwoOne/sql/domain_ids.mysql:    DROP INDEX UI_ft_trxn_id_domain_id;
sql/civicrm_upgradedb_v1.2_v1.3_41.mysql:  ,     UNIQUE INDEX UI_ft_trxn_id_domain_id(
sql/civicrm_upgradedb_v1.2_v1.3_40.mysql:  ,     UNIQUE INDEX UI_ft_trxn_id_domain_id(
sql/civicrm.mysql:    ,     UNIQUE INDEX `UI_ft_trxn_id`(

Looks like the key was added in 3.4, just as I suspected. It wasn't in 3.2 so it worked fine back then. :)
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Financial Transaction ID Error
May 13, 2012, 02:10:36 pm

in defence of my fast-failing memory (and hopefully not so fast-failing eyesight)

it was added in: 1.2->1.3 (with the domain id included in the key) and in 2.1 (aka TwoOne) we dropped domain id but still kept the UI requriement

not sure where / how u infer it was added in 3.4

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Financial Transaction ID Error
May 14, 2012, 05:12:16 am
I see now. Yes, you are right. Not sure how the code ever worked on anyone's site, then, as it never set the field trxn_id.

No matter--when we are finished testing, I will publish the current code.

Thanks.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Financial Transaction ID Error
May 22, 2012, 05:11:57 am
Code for CyberSource and CiviCRM 4.1 is online here:

https://github.com/hershelsr/civireceipts.d7

It still has one small bug that it shows a warning when there's an error with a CC, but anyhow it appears to work for valid credit cards.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Financial Transaction ID Error

This forum was archived on 2017-11-26.