[Fwd: [ic] iTransact Help needed] - globalsub/itransact -
where is it?
Kevin Old
interchange-users@icdevgroup.org
Thu Mar 6 21:09:00 2003
On Thu, 2003-03-06 at 20:22, Kevin Old wrote:
> On Thu, 2003-03-06 at 17:21, Stefan Hornburg wrote:
> > On 06 Mar 2003 16:47:02 -0500
> > Kevin Old <kold@carolina.rr.com> wrote:
> >
> > > On Thu, 2003-03-06 at 16:13, Stefan Hornburg wrote:
> > > > On 06 Mar 2003 15:34:21 -0500
> > > > Kevin Old <kold@carolina.rr.com> wrote:
> > > >
> > > > > Hello everyone,
> > > > >
> > > > > Well, I've figured out that there isn't even a itransact file in the
> > > > > globalsub directory in the 4.9.6 source. Does anyone have this
> > > > > working? I'm starting to write an itransact file for the
> > > > > globalsubs....can anyone offer any help?
> > > >
> > > > I wonder why you don't use the iTransact payment module in 4.9.
> > > > There are instructions inside Vend/Payment/iTransact.pm.
> > > >
> > > > Bye
> > > > Racke
> > > > _______________________________________________
> > > > interchange-users mailing list
> > > > interchange-users@icdevgroup.org
> > > > http://www.icdevgroup.org/mailman/listinfo/interchange-users
> > >
> > > Racke,
> > >
> > > Yes, I have read all of the instructions and followed them exactly.
> > > Nothing works. Have you ever setup IC with iTransact?
> >
> > Nothing works isn't a very good problem description. No, I never
> > used IC with iTransact, but I should be possible to pinpoint
> > the actual problem.
> >
> > Bye
> > Racke
>
> Racke,
>
> Ok, here's a step by step explanation of what I've done and what isn't
> working.
>
> I've set MV_PAYMENT_MODE (in variable.txt) to itransact and iTransact.
> Neither worked.
>
> I've also set the ITRANSACT_ID variable in variable.txt.
>
> Yes, I do have this line in catalog.cfg:
> Route itransact id "__ITRANSACT_ID__"
>
> I'm using the checkout.html that comes in the foundation demo without
> any modification.....and the mv_order_profile is set to credit_card.
>
> The etc/profile.order file I have not changed as it does not need any.
>
> After clicking Place Order I get the following error message:
> (itransact): Charge operation 'itransact' failed.
>
> and in the log..... Unknown charge type: itransact
>
> I've seen several posts that point to the globalsubs directory....I've
> only found this directory under eg/ when I untar'ed it. It had several
> GlobalSub routines for authorizenet and others. Soooooo....I found this
> globalsub that someone posted to the list years ago......I added this to
> my interchange.cfg....
>
> ...<snip>..... from interchange.cfg
>
> GlobalSub sub test_global_sub { return 'Test of global subroutine OK.' }
>
> GlobalSub <<EOS
> sub itransact {
>
> my %actual = Vend::Order::map_actual();
>
> $actual{mv_credit_card_exp_month} =~ s/\D//g;
> $actual{mv_credit_card_exp_month} =~ s/^0+//;
> $actual{mv_credit_card_exp_year} =~ s/\D//g;
>
> my $exp_year = $actual{mv_credit_card_exp_year};
> $exp_year += 2000 unless $exp_year =~ /\d{4}/;
>
> $actual{mv_credit_card_number} =~ s/\D//g;
>
> my @month = (qw/January
> Febuary
> March
> April
> May
> June
> July
> August
> September
> October
> November
> December/);
>
> my $exp_month = @month[$actual{mv_credit_card_exp_month} - 1];
> my $precision = $::Variable->{MV_PAYMENT_PRECISION} ||
> $::Variable->{CYBER_PRECISION} || 2;
> my $amount = Vend::Interpolate::total_cost();
> $amount = sprintf("%.${precision}f", $amount);
>
> my $address = $actual{b_address1};
> my $address .= ", $actual{b_address2}" if $actual{b_address2};
>
> ::logDebug("address: $address\n actual-address: " . $actual{address});
>
> my %values = (
> vendor_id => $::Variable->{MV_MERCHANT_ID},
> home_page => "http://"; . $::Variable->{SERVER_NAME},
> ret_addr => "success",
> '1-qty' => 1,
> '1-desc' => $::Variable->{COMPANY}. " Order",
> '1-cost' => $amount,
> first_name => $actual{b_fname},
> last_name => $actual{b_lname},
> address => $actual{address},
> city => $actual{b_city},
> state => $actual{b_state},
> zip => $actual{b_zip},
> country => $actual{b_country},
> phone => $::Values->{phone_day},
> email => $::Values->{email},
> ccnum => $actual{mv_credit_card_number},
> ccmo => $exp_month,
> ccyr => $exp_year,
> ret_mode => "redirect",
> );
>
> my $submit_url = "https://secure.itransact.com/cgi-bin/rc/ord.cgi";;
> use LWP::UserAgent;
> use HTTP::Request::Common qw(POST);
>
> my $ua = LWP::UserAgent->new();
> my $req = POST $submit_url, \%values;
>
> my $resp = $ua->request($req);
> my %result;
>
> ## check for errors
> my $error;
> unless ($resp->as_string() =~ m/Location: success/) {
> my $content = $resp->content();
> if ($content =~ m/BEGIN ERROR DESCRIPTION --\>(.*)\<\!-- END ERROR
> DESCRIPTION/s) {
> $error = $1;
> $error =~ s/\<.*?\>//g;
> $error =~ s/[^-A-Za-z_0-9 ]//g;
> } else {
> ## something very bad happened
> $error = "something bad happened--we don't know what is is.";
> }
>
> ::logError("iTransact Error: " . $error);
> $result{MStatus} = 'denied';
> $result{ErrMsg} = $error;
>
> return %result;
> }
>
> ## at this point, we assume everything worked just fine
> $result{MStatus} = 'success';
> $result{'order-id'} = "1";
>
> return %result;
> }
> EOS
>
> ...<snip>.....
>
>
> I've looked over this example, but can't seem to figure out what I'm
> doing wrong.
> http://www.icdevgroup.org/pipermail/interchange-users/2002-July/022937.html
>
> I have searched the mailing list for 4 days....read and tried the
> documentation written in the iTransact.pm module....and have not been
> able to get past the two errors that don't really mean anything other
> than it doesn't work.
>
> Any help would be appreciated. When I find a solution I will write
> step by step documentation on how to set it up and get it to the
> icdevgroup, the rtfm page and the list.
>
> Thanks,
> Kevin
Well, I figured it out....I had the Require Vend::Payment::iTransact
line in the interchange.cfg under the catalog, not the main
interchange.cfg.
Kevin
--
Kevin Old <kold@carolina.rr.com>