Business-OnlinePayment-OpenECHO-0.03/0000755000175000017500000000000010411214124016007 5ustar ivanivanBusiness-OnlinePayment-OpenECHO-0.03/MANIFEST0000644000175000017500000000046410411163753017157 0ustar ivanivanOpenECHO.pm Changes MANIFEST Makefile.PL README TODO t/load.t t/crypt_load.t t/credit_card.t t/crypt_credit_card.t t/check.t t/bop.t t/capture.t t/bad_card.t t/crypt_bad_card.t t/bad_check.t t/crypt_bad_check.t t/crypt_check.t generror/ISPGuide-Codes.asp generror/errortable.html generror/errortable2hash.pl Business-OnlinePayment-OpenECHO-0.03/Changes0000644000175000017500000000165610411214044017313 0ustar ivanivan0.03 Sat Mar 25 02:11:51 PST 2006 - Include final 0.02 changelog - Actually bump the version number this time - Switch from GET to POST, as per old 1.5 prerelease from Michael Lehmkuhl - Don't check expiration for ECHECK and refunds - For the unsupported "void" action, return is_success 0 and error msg suggesting "credit" action, instead of croaking. This way the "try void first, if it fails, try credit" idiom will work. - tests: enable check.t and add crypt_check.t and {crypt_}bad_check.t - update with new test account - s/CHECK/ECHECK/, DOH - move "payee" to a new() option, that makes more sense? - use '00000000' for check # if one is missing then. what else to do for recurring transactions? 0.02 Mon Sep 13 17:14:29 2004 - update test account with new PIN - customer_id => merchant_trace_nbr 0.01 Wed Aug 25 23:27:55 2004 - original version; created by ivan 1.0 Business-OnlinePayment-OpenECHO-0.03/generror/0000755000175000017500000000000010411214124017632 5ustar ivanivanBusiness-OnlinePayment-OpenECHO-0.03/generror/ISPGuide-Codes.asp0000644000175000017500000023003610116200050023002 0ustar ivanivan V: ECHOnline Decline and Error Responses
ECHO Merchant Center Interface Specification ECHOnline
Document revision date 05/24/2004

Return to the ECHO Internet Development Tools home page.

Part V: Decline and Error Responses

This document describes the content of an ECHOTYPE1 response containing a decline or error response received from the ECHO host computers. For a general description of ECHONLINE responses see Response Protocol in Part I of this Specification.

Host responses differ depending on the transaction code and whether or not an error or decline was detected by the host. For a description of acknowledgement and approval responses see Part IV: ECHONLINE Host Responses .

Credit card transactions and electronic check transactions differ slightly in their format. For this reason they are treated separately in the sections below. In the examples, the "·" character is used to indicate a space character.

Credit Card Transactions

Decline and error responses are very similar in that they both represent situations that prevent a transaction from being authorized. Decline codes can actually represent a system error, and error codes can actually represent an account restriction. The difference between the two is more of a historical artifact than any distinction between an "error" and a "decline."

Decline responses are always preceded by the word "DECLINED," while error responses contain various text messages from ECHO's host computer or the issuer's computers. Decline and error responses are described below.

Message Formats

Decline responses are formatted as follows.

Field Size Description
tag 11 "<ECHOTYPE1>"
decline 9 "DECLINED "
decline code 2 See Decline Codes table below
filler 1 " " (space)
amount 20 Declined transaction amount. Note: This field is right-justified with leading zeroes suppressed. Depending on the type of decline, there may or may not be a "$" character in the leftmost position of this field. Examples: "$bbbbbbbbbbbbbbb2.99" and "bbbbbbbbbbbbbbbb2.99"
tag 12 "</ECHOTYPE1>"

Error responses are formatted as follows.

Field Size Description
tag 11 "<ECHOTYPE1>"
error text 20 error description
error code 4 See Error Codes table below
tag 12 "</ECHOTYPE1>"

Decline Codes

Decline codes are defined in the following table.

Decline
Code
Short
Description

Explanation
01 Refer to card issuer The merchant must call the issuer before the transaction can be approved.
02 Refer to card issuer, special condition The merchant must call the issuer before the transaction can be approved.
03 Invalid merchant number The merchant ID is not valid.
04 Pick-up card. Capture for reward The card is listed on the Warning Bulletin.  Merchant may receive reward money by capturing the card.
05 Do not honor. The transaction was declined by the issuer without definition or reason The transaction was declined without explanation by the card issuer.
06 Error The card issuer returned an error without further explanation.
07 Pick-up card, special condition The card is listed on the Warning Bulletin.  Merchant may receive reward money by capturing the card.
08 Honor with identification Honor with identification.
09 Request in progress Request in progress.
10 Approved for partial amount Approved for partial amount.
11 Approved, VIP Approved, VIP program.
12 Invalid transaction The requested transaction is not supported or is not valid for the card number presented.
13 Invalid amount The amount exceeds the limits established by the issuer for this type of transaction.
14 Invalid card # The issuer indicates that this card is not valid.
15 No such issuer The card issuer number is not valid.
16 Approved, update track 3 Approved, update track 3.
17 Customer cancellation Customer cancellation.
18 Customer dispute Customer dispute.
19 Re enter transaction Customer should resubmit transaction.
20 Invalid response Invalid response.
21 No action taken No action taken. The issuer declined with no other explanation.
22 Suspected malfunction Suspected malfunction.
23 Unacceptable transaction fee Unacceptable transaction fee.
24 File update not supported File update not supported.
25 Unable to locate record Unable to locate record.
26 Duplicate record Duplicate record.
27 File update edit error File update edit error.
28 File update file locked File update file locked.
29 not used  
30 Format error, call ECHO The host reported that the transaction was not formatted properly.
31 Bank not supported Bank not supported by switch.
32 Completed partially Completed partially.
33 Expired card, pick-up The card is expired.  Merchant may receive reward money by capturing the card.
34 Issuer suspects fraud, pick-up card The card issuer suspects fraud.  Merchant may receive reward money by capturing the card.
35 Contact acquirer, pick-up Contact card issuer.  Merchant may receive reward money by capturing the card.
36 Restricted card, pick-up The card is restricted by the issuer.  Merchant may receive reward money by capturing the card.
37 Call ECHO security, pick-up Contact ECHO security.  Merchant may receive reward money by capturing the card.
38 PIN tries exceeded, pick-up PIN attempts exceed issuer limits.  Merchant may receive reward money by capturing the card.
39 No credit account No credit account.
40 Function not supported Requested function not supported.
41 Lost Card, capture for reward The card has been reported lost.
42 No universal account No universal account.
43 Stolen Card, capture for reward The card has been reported stolen.
44 No investment account No investment account.
45 - 50 not used  
51 Not sufficient funds The credit limit for this account has been exceeded.
52 - 53 not used  
54 Expired card The card is expired.
55 Incorrect PIN The cardholder PIN is incorrect.
56 No card record No card record.
57 Transaction not permitted to cardholder The card is not allowed the type of transaction requested.
58 Transaction not permitted on terminal The Merchant is not allowed this type of transaction.
59 Suspected fraud Suspected fraud.
60 Contact ECHO Contact ECHO.
61 Exceeds withdrawal limit The amount exceeds the allowed daily maximum.
62 Restricted card The card has been restricted.
63 Security violation. The card has been restricted.
64 Original amount incorrect Original amount incorrect.
65 Exceeds withdrawal frequency The allowable number of daily transactions has been exceeded.
66 Call acquirer security, call ECHO Call acquirer security, call ECHO.
67 not used  
68 Response received too late Response received too late.
69 - 74 not used  
75 PIN tries exceeded The allowed number of PIN retries has been exceeded.
76 Invalid "to" account The debit account does not exist.
77 Invalid "from" account The credit account does not exist.
78 Invalid account specified (general) The associated card number account is invalid or does not exist.
79 Already reversed Already reversed.
80 - 83 not used  
84 Invalid authorization life cycle The authorization life cycle is invalid.
85  not used  
86 Cannot verify PIN Cannot verify PIN.
87 Network Unavailable Network Unavailable.
88 not used  
89 Ineligible to receive financial position information Ineligible to receive financial position information.
90 Cut-off in progress Cut-off in progress.
91 Issuer or switch inoperative The bank is not available to authorize this transaction.
92 Routing error The transaction cannot be routed to the authorizing agency.
93 Violation of law Violation of law.
94 Duplicate transaction Duplicate transaction.
95 Reconcile error Reconcile error.
96 System malfunction A system error has occurred.
97 not used  
98 Exceeds cash limit Exceeds cash limit.

Error codes are defined in the following table.

Error
Code
Short
Description

Explanation
1000 Unrecoverable error. An unrecoverable error has occurred in the ECHONLINE processing.
1001 Account closed The merchant account has been closed.
1002 System closed Services for this system are not available.
(Not used by ECHONLINE)
1003 E-Mail Down The e-mail function is not available.
(Not used by ECHONLINE)
1004-1011 not used  
1012 Invalid trans code The host computer received an invalid transaction code.
1013 Invalid term id The ECHO-ID is invalid.
1014 not used  
1015 Invalid card number The credit card number that was sent to the host computer was invalid
1016 Invalid expiry date The card has expired or the expiration date was invalid.
1017 Invalid amount The dollar amount was less than 1.00 or greater than the maximum allowed for this card.
1018 not used  
1019 Invalid state The state code was invalid.
(Not used by ECHONLINE)
1020 not used  
1021 Invalid service The merchant or card holder is not allowed to perform that kind of transaction
1022-1023 not used  
1024 Invalid auth code The authorization number presented with this transaction is incorrect. (deposit transactions only)
1025 Invalid reference number The reference number presented with this transaction is incorrect or is not numeric.
1026-1028 not used  
1029 Invalid contract number The contract number presented with this transaction is incorrect or is not numeric.
(Not used by ECHONLINE)
1030 Invalid inventory data The inventory data presented with this transaction is not ASCII "printable".
(Not used by ECHONLINE)
1031-1500 not used  
Error Codes 1501 through 1599 are generated by ECHONLINE after validating the merchant but before presenting the transaction to the host computers for processing.
1501-1507 not used  
1508   Invalid or missing order_type.
1509   The merchant is not approved to submit this order_type.
1510   The merchant is not approved to submit this transaction_type.
1511   Duplicate transaction attempt (see counter in Part I of this Specification).
1512-1598 not used  
1599   An system error occurred while validating the transaction input.
1600-1800 not used  
Error Codes 1801 through 1814 are generated by ECHONLINE to indicate responses to AVS-Only transactions when the response is anything but "X" or "Y" (all digits match).
1801 Return Code "A" Address matches; ZIP does not match.
1802 Return Code "W" 9-digit ZIP matches; Address does not match.
1803 Return Code "Z" 5-digit ZIP matches; Address does not match.
1804 Return Codes "U" Issuer unavailable; cannot verify.
1805 Return Code "R" Retry; system is currently unable to process.
1806 Return Code "S" or "G" Issuer does not support AVS.
1807 Return Code "N" Nothing matches.
1808 Return Code "E" Invalid AVS only response.
1809 Return Code "B" Street address match. Postal code not verified because of incompatible formats.
1810 Return Code "C" Street address and Postal code not verified because of incompatible formats.
1811 Return Code "D" Street address match and Postal code match.
1812 Return Code "I" Address information not verified for international transaction.
1813 Return Code "M" Street address match and Postal code match.
1814 Return Code "P" Postal code match. Street address not verified because of incompatible formats.
1815-1896 not used  
1897 invalid response The host returned an invalid response.
1898 disconnect The host unexpectedly disconnected.
1899 timeout Timeout waiting for host response.
1900-2070 not used  
2071 Call VISA An authorization number from the VISA Voice Center is required to approve this transaction.
2072 Call Master Card An authorization number from the Master Card Voice Center is required to approve this transaction.
2073 Call Carte Blanche An authorization number from the Carte Blanche Voice Center is required to approve this transaction.
2074 Call Diners Club An authorization number from the Diners' Club Voice Center is required to approve this transaction.
2075 Call AMEX An authorization number from the American Express Voice Center is required to approve this transaction.
2076 Call Discover An authorization number from the Discover Voice Center is required to approve this transaction.
2077 not used  
2078 Call ECHO The merchant must call ECHO Customer Support for approval.or because there is a problem with the merchant's account.
2079 Call XpresscheX The merchant must call ECHO Customer Support for approval.or because there is a problem with the merchant's account.
The remaining error codes are generated by the ECHO host computers in response to errors in the dial-up protocol. These messages should never appear in ECHONLINE. They are listed below for completeness.
3001 No ACK on Resp The host did not receive an ACK from the terminal after sending the transaction response.
3002 POS NAK'd 3 Times The host disconnected after the terminal replied 3 times to the host response with a NAK.
3003 Drop on Wait The line dropped before the host could send a response to the terminal.
3005 Drop on Resp The line dropped while the host was sending the response to the terminal.
3007 Drop Before EOT The host received an ACK from the terminal but the line dropped before the host could send the EOT.
3011 No Resp to ENQ The line was up and carrier detected, but the terminal did not respond to the ENQ.
3012 Drop on Input The line disconnected while the host was receiving data from the terminal.
3013 FEP NAK'd 3 Times The host disconnected after receiving 3 transmissions with incorrect LRC from the terminal.
3014 No Resp to ENQ The line disconnected during input data wait in Multi-Trans Mode.
3015 Drop on Input The host encountered a full queue and discarded the input data.
9000-9999 Host Error The host encountered an internal error and was not able to process the transaction.

Electronic Check Transactions

ECHO verifies all electronic checks against the National Check Information Systems (NCIS) database. This is a real-time check verification system that can return a wide variety of responses and conditions. ECHONLINE does nor recognize a warning response, only approvals and declines. Therefore, warnings received from NCIS are treated as declines by ECHONLINE.

Decline responses are formatted as shown below. Each message is 16 characters long and contains information regarding the reasons for the decline or warning and the name and contact number for the agency providing the information leading to the decline.

The NCN Response Format.pdf document located in the XPRESSCHEXPLUS Transaction Validation Tool contains all Check Verification Responses.

Field Size Description
tag 11 "<ECHOTYPE1>"
message 16 Decline message (see examples below).
message 16 from 0 to n instances of additional decline and warning messages.
tag 12 "</ECHOTYPE1>"

Examples:
The first example shows a decline response containing 7 separate messages.<p><code><!--<ECHOTYPE1>DECLINE·CHECK···50·UNPAIDS·(ALL)UNPAID·AMT=·3778PHN·800-555-4503···CHKACHEK·····PHN·800-555-2954····XPCK!·······</ECHOTYPE1>--><br><!--<ECHOTYPE1>WARNING·········DAYLOC/NCHCKS=14DAYLOC/AMT=45···WINLOC/AMT=12···</ECHOTYPE1> -->
<!-- <ECHOTYPE1>ERROR IN ID·····</ECHOTYPE1> -->
<!-- <ECHOTYPE1>DECLINE·CHECK····2·UNPAIDS·(LOC)UNPAID·AMT=··376BANK·STOP·······PHN 800-555-4503SUPER·COLLECT···</ECHOTYPE1> -->
<!-- <ECHOTYPE1>RE-PRESENTED CHK</ECHOTYPE1> -->

Note:
All Electronic Check Declines return a Decline Code of "0005" in the ECHOTYPE3 <decline_code> tag (i.e., <decline_code>0005</decline_code> ). To determine the exact reason for the decline, the ECHOTYPE1 response must be examined.


Merchant Center  ECHO Home  Feedback  Contact ECHO  Copyright  Login
Business-OnlinePayment-OpenECHO-0.03/generror/errortable.html0000644000175000017500000010602010116200051022654 0ustar ivanivan 01 Refer to card issuer The merchant must call the issuer before the transaction can be approved. 02 Refer to card issuer, special condition The merchant must call the issuer before the transaction can be approved. 03 Invalid merchant number The merchant ID is not valid. 04 Pick-up card. Capture for reward The card is listed on the Warning Bulletin.  Merchant may receive reward money by capturing the card. 05 Do not honor. The transaction was declined by the issuer without definition or reason The transaction was declined without explanation by the card issuer. 06 Error The card issuer returned an error without further explanation. 07 Pick-up card, special condition The card is listed on the Warning Bulletin.  Merchant may receive reward money by capturing the card. 08 Honor with identification Honor with identification. 09 Request in progress Request in progress. 10 Approved for partial amount Approved for partial amount. 11 Approved, VIP Approved, VIP program. 12 Invalid transaction The requested transaction is not supported or is not valid for the card number presented. 13 Invalid amount The amount exceeds the limits established by the issuer for this type of transaction. 14 Invalid card # The issuer indicates that this card is not valid. 15 No such issuer The card issuer number is not valid. 16 Approved, update track 3 Approved, update track 3. 17 Customer cancellation Customer cancellation. 18 Customer dispute Customer dispute. 19 Re enter transaction Customer should resubmit transaction. 20 Invalid response Invalid response. 21 No action taken No action taken. The issuer declined with no other explanation. 22 Suspected malfunction Suspected malfunction. 23 Unacceptable transaction fee Unacceptable transaction fee. 24 File update not supported File update not supported. 25 Unable to locate record Unable to locate record. 26 Duplicate record Duplicate record. 27 File update edit error File update edit error. 28 File update file locked File update file locked. 29 not used   30 Format error, call ECHO The host reported that the transaction was not formatted properly. 31 Bank not supported Bank not supported by switch. 32 Completed partially Completed partially. 33 Expired card, pick-up The card is expired.  Merchant may receive reward money by capturing the card. 34 Issuer suspects fraud, pick-up card The card issuer suspects fraud.  Merchant may receive reward money by capturing the card. 35 Contact acquirer, pick-up Contact card issuer.  Merchant may receive reward money by capturing the card. 36 Restricted card, pick-up The card is restricted by the issuer.  Merchant may receive reward money by capturing the card. 37 Call ECHO security, pick-up Contact ECHO security.  Merchant may receive reward money by capturing the card. 38 PIN tries exceeded, pick-up PIN attempts exceed issuer limits.  Merchant may receive reward money by capturing the card. 39 No credit account No credit account. 40 Function not supported Requested function not supported. 41 Lost Card, capture for reward The card has been reported lost. 42 No universal account No universal account. 43 Stolen Card, capture for reward The card has been reported stolen. 44 No investment account No investment account. 45 - 50 not used   51 Not sufficient funds The credit limit for this account has been exceeded. 52 - 53 not used   54 Expired card The card is expired. 55 Incorrect PIN The cardholder PIN is incorrect. 56 No card record No card record. 57 Transaction not permitted to cardholder The card is not allowed the type of transaction requested. 58 Transaction not permitted on terminal The Merchant is not allowed this type of transaction. 59 Suspected fraud Suspected fraud. 60 Contact ECHO Contact ECHO. 61 Exceeds withdrawal limit The amount exceeds the allowed daily maximum. 62 Restricted card The card has been restricted. 63 Security violation. The card has been restricted. 64 Original amount incorrect Original amount incorrect. 65 Exceeds withdrawal frequency The allowable number of daily transactions has been exceeded. 66 Call acquirer security, call ECHO Call acquirer security, call ECHO. 67 not used   68 Response received too late Response received too late. 69 - 74 not used   75 PIN tries exceeded The allowed number of PIN retries has been exceeded. 76 Invalid "to" account The debit account does not exist. 77 Invalid "from" account The credit account does not exist. 78 Invalid account specified (general) The associated card number account is invalid or does not exist. 79 Already reversed Already reversed. 80 - 83 not used   84 Invalid authorization life cycle The authorization life cycle is invalid. 85  not used   86 Cannot verify PIN Cannot verify PIN. 87 Network Unavailable Network Unavailable. 88 not used   89 Ineligible to receive financial position information Ineligible to receive financial position information. 90 Cut-off in progress Cut-off in progress. 91 Issuer or switch inoperative The bank is not available to authorize this transaction. 92 Routing error The transaction cannot be routed to the authorizing agency. 93 Violation of law Violation of law. 94 Duplicate transaction Duplicate transaction. 95 Reconcile error Reconcile error. 96 System malfunction A system error has occurred. 97 not used   98 Exceeds cash limit Exceeds cash limit. 1000 Unrecoverable error. An unrecoverable error has occurred in the ECHONLINE processing. 1001 Account closed The merchant account has been closed. 1002 System closed Services for this system are not available.
(Not used by ECHONLINE) 1003 E-Mail Down The e-mail function is not available.
(Not used by ECHONLINE) 1004-1011 not used   1012 Invalid trans code The host computer received an invalid transaction code. 1013 Invalid term id The ECHO-ID is invalid. 1014 not used   1015 Invalid card number The credit card number that was sent to the host computer was invalid 1016 Invalid expiry date The card has expired or the expiration date was invalid. 1017 Invalid amount The dollar amount was less than 1.00 or greater than the maximum allowed for this card. 1018 not used   1019 Invalid state The state code was invalid.
(Not used by ECHONLINE) 1020 not used   1021 Invalid service The merchant or card holder is not allowed to perform that kind of transaction 1022-1023 not used   1024 Invalid auth code The authorization number presented with this transaction is incorrect. (deposit transactions only) 1025 Invalid reference number The reference number presented with this transaction is incorrect or is not numeric. 1026-1028 not used   1029 Invalid contract number The contract number presented with this transaction is incorrect or is not numeric.
(Not used by ECHONLINE) 1030 Invalid inventory data The inventory data presented with this transaction is not ASCII "printable".
(Not used by ECHONLINE) 1031-1500 not used   1501-1507 not used   1508   Invalid or missing order_type. 1509   The merchant is not approved to submit this order_type. 1510   The merchant is not approved to submit this transaction_type. 1511   Duplicate transaction attempt (see counter in Part I of this Specification). 1512-1598 not used   1599   An system error occurred while validating the transaction input. 1600-1800 not used   1801 Return Code "A" Address matches; ZIP does not match. 1802 Return Code "W" 9-digit ZIP matches; Address does not match. 1803 Return Code "Z" 5-digit ZIP matches; Address does not match. 1804 Return Codes "U" Issuer unavailable; cannot verify. 1805 Return Code "R" Retry; system is currently unable to process. 1806 Return Code "S" or "G" Issuer does not support AVS. 1807 Return Code "N" Nothing matches. 1808 Return Code "E" Invalid AVS only response. 1809 Return Code "B" Street address match. Postal code not verified because of incompatible formats. 1810 Return Code "C" Street address and Postal code not verified because of incompatible formats. 1811 Return Code "D" Street address match and Postal code match. 1812 Return Code "I" Address information not verified for international transaction. 1813 Return Code "M" Street address match and Postal code match. 1814 Return Code "P" Postal code match. Street address not verified because of incompatible formats. 1815-1896 not used   1897 invalid response The host returned an invalid response. 1898 disconnect The host unexpectedly disconnected. 1899 timeout Timeout waiting for host response. 1900-2070 not used   2071 Call VISA An authorization number from the VISA Voice Center is required to approve this transaction. 2072 Call Master Card An authorization number from the Master Card Voice Center is required to approve this transaction. 2073 Call Carte Blanche An authorization number from the Carte Blanche Voice Center is required to approve this transaction. 2074 Call Diners Club An authorization number from the Diners' Club Voice Center is required to approve this transaction. 2075 Call AMEX An authorization number from the American Express Voice Center is required to approve this transaction. 2076 Call Discover An authorization number from the Discover Voice Center is required to approve this transaction. 2077 not used   2078 Call ECHO The merchant must call ECHO Customer Support for approval.or because there is a problem with the merchant's account. 2079 Call XpresscheX The merchant must call ECHO Customer Support for approval.or because there is a problem with the merchant's account. 3001 No ACK on Resp The host did not receive an ACK from the terminal after sending the transaction response. 3002 POS NAK'd 3 Times The host disconnected after the terminal replied 3 times to the host response with a NAK. 3003 Drop on Wait The line dropped before the host could send a response to the terminal. 3005 Drop on Resp The line dropped while the host was sending the response to the terminal. 3007 Drop Before EOT The host received an ACK from the terminal but the line dropped before the host could send the EOT. 3011 No Resp to ENQ The line was up and carrier detected, but the terminal did not respond to the ENQ. 3012 Drop on Input The line disconnected while the host was receiving data from the terminal. 3013 FEP NAK'd 3 Times The host disconnected after receiving 3 transmissions with incorrect LRC from the terminal. 3014 No Resp to ENQ The line disconnected during input data wait in Multi-Trans Mode. 3015 Drop on Input The host encountered a full queue and discarded the input data. 9000-9999 Host Error The host encountered an internal error and was not able to process the transaction. Business-OnlinePayment-OpenECHO-0.03/generror/errortable2hash.pl0000755000175000017500000000471410116200051023263 0ustar ivanivan#!/usr/bin/perl -w use strict; my($code, $short, $explanation); my $mode = 'code'; my $DEBUG = 0; while (<>) { if ( /^\s*\s*$/i ) { ($code, $short, $explanation) = ('', '', ''); } elsif ( /^\s*]*>(\d+)(\s| )*<\/td>\s*$/i ) { $code = $1; warn "found code $code" if $DEBUG; $mode = 'short'; } elsif ( /^\s*]*>(\d+(\s| )*\-\s*\d+)<\/td>\s*$/i ){ warn "skipping range $1" if $DEBUG; until ( ($_=<>) =~ /^\s*<\/tr>\s*$/i ) { #nop } next; } elsif ( /^\s*]*>(.*)<\/td>\s*$/i ) { warn "found one line data" if $DEBUG; if ( $mode eq 'short' ) { $short = $1; $short =~ s/<\/?FONT[^>]*>//gi; $short =~ s/ / /g; $short =~ s/<\/?a[^>]*>//gi; $mode = 'explanation'; } elsif ( $mode eq 'explanation' ) { $explanation = $1; $explanation =~ s/<\/?FONT[^>]*>//gi; $explanation =~ s/ / /g; $mode = 'code'; } else { die "found (one-line) data, but in unknown mode $mode"; } } elsif ( /^\s*]*>(.*)$/i ) { warn "found multi-line data (mode $mode)" if $DEBUG; chop(my $data = $1); #$data =~ s/<\/?FONT[^>]*>//g; until ( ($_=<>) =~ /^\s*(.*)<\/td>/i ) { /^\s*(.*)\s*$/ or die; chop($data .= $1); warn "found intermediate data $1" if $DEBUG; } $_ =~ /^\s*(.*)<\/td>/i; $data .= $1; $data =~ s/<\/?FONT[^>]*>//gi; $data =~ s/ / /g; $data =~ s/<\/?[BI]>//gi; $data =~ s/<\/?BR>/ /gi; $data =~ s/<\/?a[^>]*>//gi; warn "last line $1 ($_)" if $DEBUG; warn "coalesced multi-line data: $data" if $DEBUG; if ( $mode eq 'short' ) { $short = $data; $mode = 'explanation'; } elsif ( $mode eq 'explanation' ) { $explanation = $data; $mode = 'code'; } elsif ( $mode eq 'code' && $data =~ /^(\d+)$/ ) { $code = $1; warn "found code $code" if $DEBUG; $mode = 'short'; } else { die "found (multi-line) data, but in unknown mode $mode or don't know what to do with it: $data"; } } elsif ( /^\s*<\/tr>\s*$/i ) { #$short =~ s/<\/?FONT[^>]*>//g; #$explanation =~ s/<\/?FONT[^>]*>//g; #$short =~ s/[\n\r]//; #$explanation =~ s/[\n\r]//; $short =~ s/"/\\"/gi; $explanation =~ s/"/\\"/gi; warn "end of row, printing hash element (code $code)" if $DEBUG; print qq! "$code" => \[ "$short", "$explanation" \],\n! unless $short =~ /^\s*not\s*used\s*/i; $mode = 'code'; } } Business-OnlinePayment-OpenECHO-0.03/Makefile.PL0000644000175000017500000000165710116200043017767 0ustar ivanivanuse ExtUtils::MakeMaker; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. WriteMakefile( 'NAME' => 'Business::OnlinePayment::OpenECHO', 'VERSION_FROM' => 'OpenECHO.pm', # finds $VERSION 'AUTHOR' => 'Ivan Kohler ', #really just #the maintainer #'NORECURS' => 1, # dont descend into subdirectories 'PREREQ_PM' => { 'Business::OnlinePayment' => 0, # for HTTPS (maybe it should be a separate dist?) 'URI::Escape' => 0, 'Tie::IxHash' => 0, # 'Net::SSLeay' => 0, # or 'Crypt::SSLeay' => 0, # 'URI }, #'dist' => {CI => 'ci -l'}, ); Business-OnlinePayment-OpenECHO-0.03/OpenECHO.pm0000644000175000017500000007123310411214044017714 0ustar ivanivan############################################################################## # Business::OnlinePayment::OpenECHO # # Credit card transactions via SSL to # Electronic Clearing House (ECHO) Systems # # Refer to ECHO's documentation for more info # http://www.openecho.com/echo_gateway_guide.html # # AUTHOR # Michael Lehmkuhl # # SPECIAL THANKS # Jim Darden # Dan Browning # # BUSINESS::ONLINEPAYMENT IMPLEMENTATION # Ivan Kohler # # VERSION HISTORY # + v1.2 08/17/2002 Corrected problem with certain string comparisons. # + v1.3 08/23/2002 Converted Interchange GlobalSub to Vend::Payment module. # + v1.3.1 11/12/2002 Updated the OpenECHO_example.perl test script. # + v1.4 11/18/2002 Corrected a problem with Submit method when using LWP. # + v1.5 03/29/2003 Updated for additional status and avs_result codes. # + v1.6 08/26/2003 Cleaned up code (salim qadeer sqadeer@echo-inc.com) # + v1.6.2 09/23/2003 Added DH transaction type (salim qadeer sqadeer@echo-inc.com) # -------- # + v0.1 08/26/2004 Business::OnlinePayment implementation # + v0.2 09/13/2004 # + v0.3 03/25/2006 # # Copyright (C) 2002 Electric Pulp. # Copyright (C) 2004-2006 Ivan Kohler # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public # License along with this program; if not, write to the Free # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA. # ################################################################################ package Business::OnlinePayment::OpenECHO; use strict; use Carp; use Business::OnlinePayment 3; use Business::OnlinePayment::HTTPS; use vars qw($VERSION @ISA $DEBUG); @ISA = qw(Business::OnlinePayment::HTTPS); $VERSION = '0.03'; $DEBUG = 0; sub set_defaults { my $self = shift; $self->server('wwws.echo-inc.com'); $self->port('443'); $self->path('/scripts/INR200.EXE'); $self->build_subs(qw( order_number avs_code )); # order_type # md5 cvv2_response cavv_response } #map_fileds originally from AuthorizeNet.pm sub map_fields { my($self) = @_; ##AD (Address Verification) - 0.18 cents #AS (Authorization) - 0.18 cents #AV (Authorization with Address Verification) - 0.18 cents #CR (Credit) - 0.18 cents + 0.12 cents (discount fee returned to merchant) #DS (Deposit) - 0.18 cents + 0.12 cents #ES (Authorization and Deposit) - 0.18 cents + 0.12 cents + an extra 0.17% #EV (Authorization and Deposit with Address Verification) - 0.18 cents + 0.12 cents ##CK (System check) - 0.18 cents #DV (Electronic Check Verification) - check your contract #DD (Electronic Check Debit with Verification) - check your contract #DH (Electronic Check Debit ACH Only) - check your contract #DC (Electronic Check Credit) - check your contract my %content = $self->content(); if ( lc($content{'action'}) eq 'void' ) { $self->is_success(0); $self->error_message( 'OpenECHO gateway does not support voids; '. 'try action => "Credit" ' ); return; } my $avs = $self->require_avs; $avs = 1 unless defined($avs) && length($avs); #default AVS on unless explicitly turned off my %map; if ( $content{'type'} =~ /^(cc|visa|mastercard|american express|discover)$/i ) { if ( $avs ) { %map = ( 'normal authorization' => 'EV', 'authorization only' => 'AV', 'credit' => 'CR', 'post authorization' => 'DS', #'void' => 'VOID', ); } else { %map = ( 'normal authorization' => 'ES', 'authorization only' => 'AS', 'credit' => 'CR', 'post authorization' => 'DS', #'void' => 'VOID', ); } } elsif ( $content{'type'} =~ /^e?check$/i ) { %map = ( 'normal authorization' => 'DD', 'authorization only' => 'DV', 'credit' => 'DC', 'post authorization' => 'DH', #'void' => 'VOID', ); } else { croak 'Unknown type: '. $content{'type'}; } $content{'type'} = $map{lc($content{'action'})} or croak 'Unknown action: '. $content{'action'}; $self->transaction_type($content{'type'}); # stuff it back into %content $self->content(%content); } sub submit { my($self) = @_; $self->map_fields(); $self->remap_fields( # => 'order_type', type => 'transaction_type', #action => login => 'merchant_echo_id', password => 'merchant_pin', # => 'isp_echo_id', # => 'isp_pin', #transaction_key => authorization => 'authorization', # auth_code => 'authorization', customer_ip => 'billing_ip_address', # 'billing_prefix', name => 'billing_name', first_name => 'billing_first_name', last_name => 'billing_last_name', company => 'billing_company_name', address => 'billing_address_1', # => 'billing_address_2', city => 'billing_city', state => 'billing_state', zip => 'billing_zip', country => 'billing_country', phone => 'billing_phone', fax => 'billing_fax', email => 'billing_email', card_number => 'cc_number', # => 'ccexp_month', # => 'ccexp_year', # => 'counter', # => 'debug', #XXX# => 'ec_*', 'amount' => 'grand_total', # => 'merchant_email', #invoice_number => customer_id => 'merchant_trace_nbr', # => 'original_amount', # => 'original_trandate_mm', # => 'original_trandate_dd', # => 'original_trandate_yyyy', # => 'original_reference', order_number => 'order_number', # => 'shipping_flag', #description => #currency => #ship_last_name => #ship_first_name => #ship_company => #ship_address => #ship_city => #ship_state => #ship_zip => #ship_country => #expiration => cvv2 => 'cnp_security', #check_type => #account_name => 'ec_last_name' & 'ec_first_name', account_number => 'ec_account', #account_type => bank_name => 'ec_bank_name', routing_code => 'ec_rt', #customer_org => #customer_ssn => license_num => 'ec_id_number', license_state => 'ec_id_state', #license_dob => #get from new() args instead# payee => 'ec_payee', check_number => 'ec_serial_number', #recurring_billing => 'cnp_recurring', ); #XXX hosted order_type? $self->{_content}{order_type} = 'S'; #XXX counter field shouldn't be just a random integer (but it does need a #default this way i guess... $self->{_content}{counter} = int(rand(2**31)); if ( $self->transaction_type =~ /^[EA][VS]$/ ) { #ccexp_month & ccexp_year $self->{_content}{'expiration'} =~ /^(\d+)\D+\d*(\d{2})$/ or croak "unparsable expiration ". $self->{_content}{expiration}; my( $month, $year ) = ( $1, $2 ); $month = '0'. $month if $month =~ /^\d$/; $self->{_content}{ccexp_month} = $month; $self->{_content}{ccexp_year} = $year; } if ( $self->transaction_type =~ /^D[DVCH]$/ ) { #echeck #check number kludge... "periodic bill payments" don't have check #s! #$self->{_content}{ec_serial_number} = 'RECURRIN' $self->{_content}{ec_serial_number} = '00000000' if ! length($self->{_content}{ec_serial_number}) && $self->{_content}{ec_payment_type} =~ /^(PPD)?$/i; ( $self->{_content}{ec_payee} = $self->payee ) or croak "'payee' option required when instantiating new ". "Business::OnlinePayment::OpenECHO object\n"; } $self->{_content}{cnp_recurring} = 'Y' if exists($self->{_content}{recurring_billing}) && $self->{_content}{recurring_billing} =~ /^y/i; #XXX echeck use customer_org and account_type to generate ec_account_type #XXX set required fields # https://wwws.echo-inc.com/ISPGuide-Fields2.asp $self->required_fields(); my( $page, $response, %reply_headers) = $self->https_post( $self->get_fields( $self->fields ) ); warn "raw echo response: $page" if $DEBUG; #XXX check $response and die if not 200? my $echotype1 = $self->GetEchoReturn($page, 1); my $echotype2 = $self->GetEchoReturn($page, 2); my $echotype3 = $self->GetEchoReturn($page, 3); my $openecho = $self->GetEchoReturn($page, 'OPEN'); # server_response # avs_code # order_number # is_success # result_code # authorization #md5 cvv2_response cavv_response ...? # Get all the metadata. $self->server_response($page); $self->authorization( $self->GetEchoProp($echotype3, 'auth_code') ); $self->order_number( $self->GetEchoProp($echotype3, 'order_number') ); #XXX ??? #$self->reference( $this->GetEchoProp($echotype3, "echo_reference"); $self->result_code( $self->GetEchoProp($echotype3, 'status') ); $self->avs_code( $self->GetEchoProp($echotype3, 'avs_result') ); #XXX ??? #$self->security_result( $self->GetEchoProp($echotype3, 'security_result'); #$self->mac( $self->GetEchoProp($echotype3, 'mac') ); #$self->decline_code( $self->GetEchoProp($echotype3, 'decline_code') ); if ($self->result_code =~ /^[GR]$/ ) { #success #XXX special case for AVS-only transactions we don't handle yet #if ($self->transaction_type eq "AD") { # if ($self->avs_code =~ /^[XYDM]$/ ) { # $self->is_success(1); # } else { # $self->is_success(0); # } #} else { $self->is_success(1); #} } else { $self->is_success(0); my $decline_code = $self->GetEchoProp($echotype3, 'decline_code'); my $error_message = $self->error($decline_code); if ( $decline_code =~ /^(00)?30$/ ) { $echotype2 =~ s/
/\n/ig; $echotype2 =~ s'''ig; $error_message .= ": $echotype2"; } $self->error_message( $error_message ); } $self->is_success(0) if $page eq ''; } sub fields { my $self = shift; my @fields = qw( order_type transaction_type merchant_echo_id merchant_pin isp_echo_id isp_pin authorization billing_ip_address billing_prefix billing_name billing_first_name billing_last_name billing_company_name billing_address1 billing_address2 billing_city billing_state billing_zip billing_country billing_phone billing_fax billing_email cc_number ccexp_month ccexp_year counter debug ); if ($self->transaction_type =~ /^D[DCVH]$/) { push @fields, qw( ec_account ec_account_type ec_payment_type ec_address1 ec_address2 ec_bank_name ec_business_acct ec_city ec_email ec_first_name ec_id_country ec_id_exp_mm ec_id_exp_dd ec_id_exp_yy ec_id_number ec_id_state ec_id_type ec_last_name ec_merchant_ref ec_nbds_code ec_other_name ec_payee ec_rt ec_serial_number ec_state ec_transaction_dt ec_zip ); } push @fields, qw( grand_total merchant_email merchant_trace_nbr original_amount original_trandate_mm original_trandate_dd original_trandate_yyyy original_reference order_number shipping_flag shipping_prefix shipping_name shipping_address1 shipping_address2 shipping_city shipping_state shipping_zip shipping_comments shipping_country shipping_phone shipping_fax shipper shipper_tracking_nbr track1 track2 cnp_security cnp_recurring ); return @fields; } sub GetEchoProp { my( $self, $raw, $prop ) = @_; local $^W=0; my $data; ($data) = $raw =~ m"<$prop>(.*?)"gsi; $data =~ s/<.*?>/ /gs; chomp $data; return $data; } # Get's a given Echo return type and strips all HTML style tags from it. # It also strips any new line characters from the returned string. # # This function based on Ben Reser's Echo::Process # module. sub GetEchoReturn { my( $self, $page, $type ) = @_; local $^W=0; my $data; if ($type eq 'OPEN') { ($data) = $page =~ m"(.*?)"gsi; } else { ($data) = $page =~ m"(.*?)"gsi; } # $data =~ s"<.*?>" "g; #unless (length($data)) { # warn "$self $page $type"; #} chomp $data; return $data; } use vars qw(%error); %error = ( "01" => [ "Refer to card issuer", "The merchant must call the issuer before the transaction can be approved." ], "02" => [ "Refer to card issuer, special condition", "The merchant must call the issuer before the transaction can be approved." ], "03" => [ "Invalid merchant number", "The merchant ID is not valid." ], "04" => [ "Pick-up card. Capture for reward", "The card is listed on the Warning Bulletin. Merchant may receive reward money by capturing the card." ], "05" => [ "Do not honor. The transaction was declined by the issuer without definition or reason", "The transaction was declined without explanation by the card issuer." ], "06" => [ "Error", "The card issuer returned an error without further explanation." ], "07" => [ "Pick-up card, special condition", "The card is listed on the Warning Bulletin. Merchant may receive reward money by capturing the card." ], "08" => [ "Honor with identification", "Honor with identification." ], "09" => [ "Request in progress", "Request in progress." ], "10" => [ "Approved for partial amount", "Approved for partial amount." ], "11" => [ "Approved, VIP", "Approved, VIP program." ], "12" => [ "Invalid transaction", "The requested transaction is not supported or is not valid for the card number presented." ], "13" => [ "Invalid amount", "The amount exceeds the limits established by the issuer for this type of transaction." ], "14" => [ "Invalid card #", "The issuer indicates that this card is not valid." ], "15" => [ "No such issuer", "The card issuer number is not valid." ], "16" => [ "Approved, update track 3", "Approved, update track 3." ], "17" => [ "Customer cancellation", "Customer cancellation." ], "18" => [ "Customer dispute", "Customer dispute." ], "19" => [ "Re enter transaction", "Customer should resubmit transaction." ], "20" => [ "Invalid response", "Invalid response." ], "21" => [ "No action taken", "No action taken. The issuer declined with no other explanation." ], "22" => [ "Suspected malfunction", "Suspected malfunction." ], "23" => [ "Unacceptable transaction fee", "Unacceptable transaction fee." ], "24" => [ "File update not supported", "File update not supported." ], "25" => [ "Unable to locate record", "Unable to locate record." ], "26" => [ "Duplicate record", "Duplicate record." ], "27" => [ "File update edit error", "File update edit error." ], "28" => [ "File update file locked", "File update file locked." ], "30" => [ "Format error, call ECHO", "The host reported that the transaction was not formatted properly." ], "31" => [ "Bank not supported", "Bank not supported by switch." ], "32" => [ "Completed partially", "Completed partially." ], "33" => [ "Expired card, pick-up", "The card is expired. Merchant may receive reward money by capturing the card." ], "34" => [ "Issuer suspects fraud, pick-up card", "The card issuer suspects fraud. Merchant may receive reward money by capturing the card." ], "35" => [ "Contact acquirer, pick-up", "Contact card issuer. Merchant may receive reward money by capturing the card." ], "36" => [ "Restricted card, pick-up", "The card is restricted by the issuer. Merchant may receive reward money by capturing the card." ], "37" => [ "Call ECHO security, pick-up", "Contact ECHO security. Merchant may receive reward money by capturing the card." ], "38" => [ "PIN tries exceeded, pick-up", "PIN attempts exceed issuer limits. Merchant may receive reward money by capturing the card." ], "39" => [ "No credit account", "No credit account." ], "40" => [ "Function not supported", "Requested function not supported." ], "41" => [ "Lost Card, capture for reward", "The card has been reported lost." ], "42" => [ "No universal account", "No universal account." ], "43" => [ "Stolen Card, capture for reward", "The card has been reported stolen." ], "44" => [ "No investment account", "No investment account." ], "51" => [ "Not sufficient funds", "The credit limit for this account has been exceeded." ], "54" => [ "Expired card", "The card is expired." ], "55" => [ "Incorrect PIN", "The cardholder PIN is incorrect." ], "56" => [ "No card record", "No card record." ], "57" => [ "Transaction not permitted to cardholder", "The card is not allowed the type of transaction requested." ], "58" => [ "Transaction not permitted on terminal", "The Merchant is not allowed this type of transaction." ], "59" => [ "Suspected fraud", "Suspected fraud." ], "60" => [ "Contact ECHO", "Contact ECHO." ], "61" => [ "Exceeds withdrawal limit", "The amount exceeds the allowed daily maximum." ], "62" => [ "Restricted card", "The card has been restricted." ], "63" => [ "Security violation.", "The card has been restricted." ], "64" => [ "Original amount incorrect", "Original amount incorrect." ], "65" => [ "Exceeds withdrawal frequency", "The allowable number of daily transactions has been exceeded." ], "66" => [ "Call acquirer security, call ECHO", "Call acquirer security, call ECHO." ], "68" => [ "Response received too late", "Response received too late." ], "75" => [ "PIN tries exceeded", "The allowed number of PIN retries has been exceeded." ], "76" => [ "Invalid \"to\" account", "The debit account does not exist." ], "77" => [ "Invalid \"from\" account", "The credit account does not exist." ], "78" => [ "Invalid account specified (general)", "The associated card number account is invalid or does not exist." ], "79" => [ "Already reversed", "Already reversed." ], "84" => [ "Invalid authorization life cycle", "The authorization life cycle is invalid." ], "86" => [ "Cannot verify PIN", "Cannot verify PIN." ], "87" => [ "Network Unavailable", "Network Unavailable." ], "89" => [ "Ineligible to receive financial position information", "Ineligible to receive financial position information." ], "90" => [ "Cut-off in progress", "Cut-off in progress." ], "91" => [ "Issuer or switch inoperative", "The bank is not available to authorize this transaction." ], "92" => [ "Routing error", "The transaction cannot be routed to the authorizing agency." ], "93" => [ "Violation of law", "Violation of law." ], "94" => [ "Duplicate transaction", "Duplicate transaction." ], "95" => [ "Reconcile error", "Reconcile error." ], "96" => [ "System malfunction", "A system error has occurred." ], "98" => [ "Exceeds cash limit", "Exceeds cash limit." ], "1000" => [ "Unrecoverable error.", "An unrecoverable error has occurred in the ECHONLINE processing." ], "1001" => [ "Account closed", "The merchant account has been closed." ], "1002" => [ "System closed", "Services for this system are not available. (Not used by ECHONLINE)" ], "1003" => [ "E-Mail Down", "The e-mail function is not available. (Not used by ECHONLINE)" ], "1012" => [ "Invalid trans code", "The host computer received an invalid transaction code." ], "1013" => [ "Invalid term id", "The ECHO-ID is invalid." ], "1015" => [ "Invalid card number", "The credit card number that was sent to the host computer was invalid" ], "1016" => [ "Invalid expiry date", "The card has expired or the expiration date was invalid." ], "1017" => [ "Invalid amount", "The dollar amount was less than 1.00 or greater than the maximum allowed for this card." ], "1019" => [ "Invalid state", "The state code was invalid. (Not used by ECHONLINE)" ], "1021" => [ "Invalid service", "The merchant or card holder is not allowed to perform that kind of transaction" ], "1024" => [ "Invalid auth code", "The authorization number presented with this transaction is incorrect. (deposit transactions only)" ], "1025" => [ "Invalid reference number", "The reference number presented with this transaction is incorrect or is not numeric." ], "1029" => [ "Invalid contract number", "The contract number presented with this transaction is incorrect or is not numeric. (Not used by ECHONLINE)" ], "1030" => [ "Invalid inventory data", "The inventory data presented with this transaction is not ASCII \"printable\". (Not used by ECHONLINE)" ], "1508" => [ " ", "Invalid or missing order_type." ], "1509" => [ " ", "The merchant is not approved to submit this order_type." ], "1510" => [ " ", "The merchant is not approved to submit this transaction_type." ], #"1511" => [ " ", "Duplicate transaction attempt (see counterin Part I of this Specification)." ], "1511" => [ " ", "Duplicate transaction attempt (set counter field?)." ], "1599" => [ " ", "An system error occurred while validating the transaction input." ], "1801" => [ "Return Code \"A\"", "Address matches; ZIP does not match." ], "1802" => [ "Return Code \"W\"", "9-digit ZIP matches; Address does not match." ], "1803" => [ "Return Code \"Z\"", "5-digit ZIP matches; Address does not match." ], "1804" => [ "Return Codes \"U\"", "Issuer unavailable; cannot verify." ], "1805" => [ "Return Code \"R\"", "Retry; system is currently unable to process." ], "1806" => [ "Return Code \"S\" or \"G\"", "Issuer does not support AVS." ], "1807" => [ "Return Code \"N\"", "Nothing matches." ], "1808" => [ "Return Code \"E\"", "Invalid AVS only response." ], "1809" => [ "Return Code \"B\"", "Street address match. Postal code not verified because of incompatible formats." ], "1810" => [ "Return Code \"C\"", "Street address and Postal code not verified because of incompatible formats." ], "1811" => [ "Return Code \"D\"", "Street address match and Postal code match." ], "1812" => [ "Return Code \"I\"", "Address information not verified for international transaction." ], "1813" => [ "Return Code \"M\"", "Street address match and Postal code match." ], "1814" => [ "Return Code \"P\"", "Postal code match. Street address not verified because of incompatible formats." ], "1897" => [ "invalid response", "The host returned an invalid response." ], "1898" => [ "disconnect", "The host unexpectedly disconnected." ], "1899" => [ "timeout", "Timeout waiting for host response." ], "2071" => [ "Call VISA", "An authorization number from the VISA Voice Center is required to approve this transaction." ], "2072" => [ "Call Master Card", "An authorization number from the Master Card Voice Center is required to approve this transaction." ], "2073" => [ "Call Carte Blanche", "An authorization number from the Carte Blanche Voice Center is required to approve this transaction." ], "2074" => [ "Call Diners Club", "An authorization number from the Diners' Club Voice Center is required to approve this transaction." ], "2075" => [ "Call AMEX", "An authorization number from the American Express Voice Center is required to approve this transaction." ], "2076" => [ "Call Discover", "An authorization number from the Discover Voice Center is required to approve this transaction." ], "2078" => [ "Call ECHO", "The merchant must call ECHOCustomer Support for approval.or because there is a problem with the merchant's account." ], "2079" => [ "Call XpresscheX", "The merchant must call ECHOCustomer Support for approval.or because there is a problem with the merchant's account." ], "3001" => [ "No ACK on Resp", "The host did not receive an ACK from the terminal after sending the transaction response." ], "3002" => [ "POS NAK'd 3 Times", "The host disconnected after the terminal replied 3 times to the host response with a NAK." ], "3003" => [ "Drop on Wait", "The line dropped before the host could send a response to the terminal." ], "3005" => [ "Drop on Resp", "The line dropped while the host was sending the response to the terminal." ], "3007" => [ "Drop Before EOT", "The host received an ACK from the terminal but the line dropped before the host could send the EOT." ], "3011" => [ "No Resp to ENQ", "The line was up and carrier detected, but the terminal did not respond to the ENQ." ], "3012" => [ "Drop on Input", "The line disconnected while the host was receiving data from the terminal." ], "3013" => [ "FEP NAK'd 3 Times", "The host disconnected after receiving 3 transmissions with incorrect LRC from the terminal." ], "3014" => [ "No Resp to ENQ", "The line disconnected during input data wait in Multi-Trans Mode." ], "3015" => [ "Drop on Input", "The host encountered a full queue and discarded the input data." ], ); for ( 9000..9999 ) { $error{$_} = [ "Host Error", "The host encountered an internal error and was not able to process the transaction." ]; } sub error { my( $self, $num ) = @_; $num =~ s/^00(\d\d)$/$1/; return $num. ': '. $error{$num}[0]. ': '. $error{$num}[1]; } 1; __END__ =head1 NAME Business::OnlinePayment::OpenECHO - ECHO backend module for Business::OnlinePayment =head1 SYNOPSIS use Business::OnlinePayment; #### # One step transaction, the simple case. #### my $tx = new Business::OnlinePayment("OpenECHO"); $tx->content( type => 'VISA', login => '1234684752', password => '43400210', action => 'Normal Authorization', description => 'Business::OnlinePayment test', amount => '49.95', invoice_number => '100100', customer_id => 'jsk', first_name => 'Tofu', last_name => 'Beast', address => '123 Anystreet', city => 'Anywhere', state => 'UT', zip => '84058', card_number => '4005550000000019', expiration => '08/06', cvv2 => '1234', #optional referer => 'http://valid.referer.url/', ); $tx->submit(); if($tx->is_success()) { print "Card processed successfully: ".$tx->authorization."\n"; } else { print "Card was rejected: ".$tx->error_message."\n"; } =head1 SUPPORTED TRANSACTION TYPES =head2 CC, Visa, MasterCard, American Express, Discover Content required: type, login, password, action, amount, first_name, last_name, card_number, expiration. =head2 Check Content required: type, login, password, action, amount, first_name, last_name, account_number, routing_code, bank_name. (...more) =head1 PREREQUISITES URI::Escape Tie::IxHash Net::SSLeay _or_ ( Crypt::SSLeay and LWP ) =head1 DESCRIPTION For detailed information see L. =head1 AUTHOR Original Author Michael Lehmkuhl Special Thanks Jim Darden Dan Browning Business::OnlinePayment Implementation Ivan Kohler =head1 SEE ALSO perl(1). L. =cut Business-OnlinePayment-OpenECHO-0.03/README0000644000175000017500000000206410116200043016666 0ustar ivanivanCopyright (C) 2002 Electric Pulp. Copyright (c) 2004 Ivan Kohler All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This is Business::OnlinePayment::OpenECHO, an Business::OnlinePayment backend module for ECHO. It is only useful if you have a merchant account with ECHO: http://www.echo-inc.com/ (also see http://www.openecho.com/) This module is based on code written by Michael Lehmkuhl , with special thanks to Jim Darden and Dan Browning . It was adapted to the Business::OnlinePayment API by Ivan Kohler . Business::OnlinePayment is a generic interface for processing payments through online credit card processors, online check acceptance houses, etc. (If you like buzzwords, call it an "multiplatform ecommerce-enabling middleware solution"). Business-OnlinePayment-OpenECHO-0.03/TODO0000644000175000017500000000124610116200043016477 0ustar ivanivan- set required fields https://wwws.echo-inc.com/ISPGuide-Fields2.asp - counter field shouldn't be just a random integer (but it does need to fallback to that as B:OP doesn't require it) - echecks / ACH #echeck use customer_org and account_type to generate ec_account_type - check HTTPS response code and die if not 200? - order_type & ccexp_month,ccexp_year setting fiddling ->{_content} directly - 'echo_reference', 'security_result', 'mac', and 'decline_code' fields...? - handle returning correct is_success and error_message values in the special case for AVS-only transactions we don't handle yet (B:OP needs a name for that transaction!) - Hosted order type? Business-OnlinePayment-OpenECHO-0.03/t/0000755000175000017500000000000010411214124016252 5ustar ivanivanBusiness-OnlinePayment-OpenECHO-0.03/t/bad_card.t0000644000175000017500000000204010333633020020155 0ustar ivanivanBEGIN { $| = 1; print "1..1\n"; } eval "use Net::SSLeay;"; if ( $@ ) { print "ok 1 # Skipped: Net::SSLeay is not installed\n"; exit; } use Business::OnlinePayment; my $tx = new Business::OnlinePayment("OpenECHO"); $tx->content( type => 'VISA', 'login' => '123>4685706', 'password' => '09437869', action => 'Normal Authorization', description => 'Business::OnlinePayment visa test', amount => '49.95', invoice_number => '100100', customer_id => 'jsk', first_name => 'Tofu', last_name => 'Beast', address => '123 Anystreet', city => 'Anywhere', state => 'UT', zip => '84058', phone => '420-543-2199', card_number => '4007000000027', expiration => '08/06', ); $tx->test_transaction(1); # test, dont really charge $tx->submit(); if($tx->is_success()) { print "not ok 1\n"; } else { #warn $tx->server_response."\n"; #warn $tx->error_message. "\n"; print "ok 1\n"; } Business-OnlinePayment-OpenECHO-0.03/t/bad_check.t0000644000175000017500000000224110411213740020324 0ustar ivanivanBEGIN { $| = 1; print "1..1\n"; } print "ok 1 # Skipped: testing account won't accept ACH transactions\n"; exit; eval "use Net::SSLeay;"; if ( $@ ) { print "ok 1 # Skipped: Net::SSLeay is not installed\n"; exit; } use Business::OnlinePayment; # checks are broken it seems my $ctx = new Business::OnlinePayment("OpenECHO", payee => 'Tofu Heavy Enterprises, GmbH', ); $ctx->content( type => 'ECHECK', 'login' => '123>4685706', 'password' => '09437869', action => 'Normal Authorization', amount => '49.95', invoice_number => '100100', customer_id => 'jsk', first_name => 'Tofu', last_name => 'Beast', account_number => '12345', routing_code => '026009593', bank_name => 'First National Test Bank', phone => '420-420-5454', #payee => 'Tofu Heavy Enterprises, GmbH', check_number => '420', ); $ctx->test_transaction(1); # test, dont really charge $ctx->submit(); print $ctx->is_success()."\n"; if($ctx->is_success()) { #warn $ctx->error_message(); print "not ok 1 (".$ctx->error_message().")\n"; } else { print "ok 1\n"; } Business-OnlinePayment-OpenECHO-0.03/t/bop.t0000644000175000017500000000020510116200045017213 0ustar ivanivanBEGIN { $| = 1; print "1..1\n"; } END {print "not ok 1\n" unless $loaded;} use Business::OnlinePayment; $loaded = 1; print "ok 1\n"; Business-OnlinePayment-OpenECHO-0.03/t/capture.t0000644000175000017500000000343710170673626020133 0ustar ivanivanBEGIN { $| = 1; print "1..2\n"; } print "ok 1 # Skipped: no separate auth + capture test yet\n"; print "ok 2 # Skipped: no separate auth + capture test yet\n"; exit; use Business::OnlinePayment; my $tx = new Business::OnlinePayment("OpenECHO"); $tx->content( type => 'VISA', login => 'testing',# CHANGE THESE TO TEST password => 'testing',# action => 'Authorization Only', description => 'Business::OnlinePayment visa test', amount => '49.95', invoice_number => '100100', customer_id => 'jsk', first_name => 'Tofu', last_name => 'Beast', address => '123 Anystreet', city => 'Anywhere', state => 'UT', zip => '84058', card_number => '4007000000027', expiration => '08/06', ); $tx->test_transaction(1); # test, dont really charge $tx->submit(); unless($tx->is_success()) { print "not ok 1\n"; print "not ok 2\n"; } else { my $order_number = $tx->order_number; warn $order_number; print "ok 1\n"; my $settle_tx = new Business::OnlinePayment("OpenECHO"); $settle_tx->content( type => 'VISA', login => 'testing', # CHANGE THESE TO TEST password => 'testing', # action => 'Post Authorization', description => 'Business::OnlinePayment visa test', amount => '49.95', invoice_number => '100100', order_number => '111', card_number => '4007000000027', expiration => '08/06', ); $settle_tx->test_transaction(1); # test, dont really charge $settle_tx->submit(); if($settle_tx->is_success()) { print "ok 2\n"; } else { warn $settle_tx->error_message; print "not ok 2\n"; } } Business-OnlinePayment-OpenECHO-0.03/t/check.t0000644000175000017500000000253010411213740017517 0ustar ivanivanBEGIN { $| = 1; print "1..1\n"; } print "ok 1 # Skipped: testing account won't accept ACH transactions\n"; exit; eval "use Net::SSLeay;"; if ( $@ ) { print "ok 1 # Skipped: Net::SSLeay is not installed\n"; exit; } use Business::OnlinePayment; my $ctx = new Business::OnlinePayment( "OpenECHO", 'payee' => 'Tofu Heavy Enterprises, GmbH', ); #$Business::OnlinePayment::HTTPS::DEBUG = 1; #$Business::OnlinePayment::HTTPS::DEBUG = 1; #$Business::OnlinePayment::OpenECHO::DEBUG = 1; #$Business::OnlinePayment::OpenECHO::DEBUG = 1; # checks are broken it seems? $ctx->content( type => 'ECHECK', 'login' => '123>4685706', 'password' => '09437869', action => 'Normal Authorization', amount => '49.95', invoice_number => '100100', customer_id => 'jsk', first_name => 'Tofu', last_name => 'Beast', account_number => '12345', routing_code => '026009593', bank_name => 'First National Test Bank', phone => '420-420-5454', #payee => 'Tofu Heavy Enterprises, GmbH', check_number => '420', ); $ctx->test_transaction(1); # test, dont really charge $ctx->submit(); print $ctx->is_success()."\n"; if($ctx->is_success()) { print "ok 1\n"; } else { warn $ctx->error_message(); print "not ok 1 (".$ctx->error_message().")\n"; } Business-OnlinePayment-OpenECHO-0.03/t/credit_card.t0000644000175000017500000000204310333633020020704 0ustar ivanivanBEGIN { $| = 1; print "1..1\n"; } eval "use Net::SSLeay;"; if ( $@ ) { print "ok 1 # Skipped: Net::SSLeay is not installed\n"; exit; } use Business::OnlinePayment; my $tx = new Business::OnlinePayment("OpenECHO"); $tx->content( type => 'VISA', 'login' => '123>4685706', 'password' => '09437869', action => 'Normal Authorization', description => 'Business::OnlinePayment visa test', amount => '49.95', invoice_number => '100100', customer_id => 'jsk', first_name => 'Tofu', last_name => 'Beast', address => '123 Anystreet', city => 'Anywhere', state => 'UT', zip => '84058', phone => '420-543-2199', card_number => '4005550000000019', expiration => '08/06', ); $tx->test_transaction(1); # test, dont really charge $tx->submit(); if($tx->is_success()) { print "ok 1\n"; } else { #warn $tx->server_response."\n"; warn $tx->error_message. "\n"; print "not ok 1\n"; } Business-OnlinePayment-OpenECHO-0.03/t/crypt_bad_card.t0000644000175000017500000000222110333633020021377 0ustar ivanivanBEGIN { $| = 1; print "1..1\n"; $Business::OnlinePayment::HTTPS::skip_NetSSLeay=1; $Business::OnlinePayment::HTTPS::skip_NetSSLeay=1; } eval "use Crypt::SSLeay;"; if ( $@ ) { print "ok 1 # Skipped: Crypt::SSLeay is not installed\n"; exit; } use Business::OnlinePayment; my $tx = new Business::OnlinePayment("OpenECHO"); $tx->content( type => 'VISA', 'login' => '123>4685706', 'password' => '09437869', action => 'Normal Authorization', description => 'Business::OnlinePayment visa test', amount => '49.95', invoice_number => '100100', customer_id => 'jsk', first_name => 'Tofu', last_name => 'Beast', address => '123 Anystreet', city => 'Anywhere', state => 'UT', zip => '84058', phone => '420-543-2199', card_number => '4007000000027', expiration => '08/06', ); $tx->test_transaction(1); # test, dont really charge $tx->submit(); if($tx->is_success()) { print "not ok 1\n"; } else { #warn $tx->server_response."\n"; #warn $tx->error_message. "\n"; print "ok 1\n"; } Business-OnlinePayment-OpenECHO-0.03/t/crypt_bad_check.t0000644000175000017500000000242110411213740021545 0ustar ivanivanBEGIN { $| = 1; print "1..1\n"; $Business::OnlinePayment::HTTPS::skip_NetSSLeay=1; $Business::OnlinePayment::HTTPS::skip_NetSSLeay=1; } print "ok 1 # Skipped: testing account won't accept ACH transactions\n"; exit; eval "use Crypt::SSLeay;"; if ( $@ ) { print "ok 1 # Skipped: Crypt::SSLeay is not installed\n"; exit; } use Business::OnlinePayment; # checks are broken it seems my $ctx = new Business::OnlinePayment("OpenECHO", payee => 'Tofu Heavy Enterprises, GmbH', ); $ctx->content( type => 'ECHECK', 'login' => '123>4685706', 'password' => '09437869', action => 'Normal Authorization', amount => '49.95', invoice_number => '100100', customer_id => 'jsk', first_name => 'Tofu', last_name => 'Beast', account_number => '12345', routing_code => '026009593', bank_name => 'First National Test Bank', phone => '420-420-5454', #payee => 'Tofu Heavy Enterprises, GmbH', check_number => '420', ); $ctx->test_transaction(1); # test, dont really charge $ctx->submit(); print $ctx->is_success()."\n"; if($ctx->is_success()) { #warn $ctx->error_message(); print "not ok 1 (".$ctx->error_message().")\n"; } else { print "ok 1\n"; } Business-OnlinePayment-OpenECHO-0.03/t/crypt_check.t0000644000175000017500000000242010411213740020736 0ustar ivanivanBEGIN { $| = 1; print "1..1\n"; $Business::OnlinePayment::HTTPS::skip_NetSSLeay=1; $Business::OnlinePayment::HTTPS::skip_NetSSLeay=1; } print "ok 1 # Skipped: testing account won't accept ACH transactions\n"; exit; eval "use Crypt::SSLeay;"; if ( $@ ) { print "ok 1 # Skipped: Crypt::SSLeay is not installed\n"; exit; } use Business::OnlinePayment; # checks are broken it seems my $ctx = new Business::OnlinePayment("OpenECHO", payee => 'Tofu Heavy Enterprises, GmbH', ); $ctx->content( type => 'ECHECK', 'login' => '123>4685706', 'password' => '09437869', action => 'Normal Authorization', amount => '49.95', invoice_number => '100100', customer_id => 'jsk', first_name => 'Tofu', last_name => 'Beast', account_number => '12345', routing_code => '026009593', bank_name => 'First National Test Bank', phone => '420-420-5454', #payee => 'Tofu Heavy Enterprises, GmbH', check_number => '420', ); $ctx->test_transaction(1); # test, dont really charge $ctx->submit(); print $ctx->is_success()."\n"; if($ctx->is_success()) { print "ok 1\n"; } else { warn $ctx->error_message(); print "not ok 1 (".$ctx->error_message().")\n"; } Business-OnlinePayment-OpenECHO-0.03/t/crypt_credit_card.t0000644000175000017500000000222310333633020022125 0ustar ivanivanBEGIN { $| = 1; print "1..1\n"; $Business::OnlinePayment::HTTPS::skip_NetSSLeay=1; $Business::OnlinePayment::HTTPS::skip_NetSSLeay=1; } eval "use Crypt::SSLeay;"; if ( $@ ) { print "ok 1 # Skipped: Crypt::SSLeay is not installed\n"; exit; } use Business::OnlinePayment; my $tx = new Business::OnlinePayment("OpenECHO"); $tx->content( type => 'VISA', 'login' => '123>4685706', 'password' => '09437869', action => 'Normal Authorization', description => 'Business::OnlinePayment visa test', amount => '49.95', invoice_number => '100100', customer_id => 'jsk', first_name => 'Tofu', last_name => 'Beast', address => '123 Anystreet', city => 'Anywhere', state => 'UT', zip => '84058', phone => '420-543-2199', card_number => '4005550000000019', expiration => '08/06', ); $tx->test_transaction(1); # test, dont really charge $tx->submit(); if($tx->is_success()) { print "ok 1\n"; } else { #warn $tx->server_response."\n"; warn $tx->error_message. "\n"; print "not ok 1\n"; } Business-OnlinePayment-OpenECHO-0.03/t/crypt_load.t0000644000175000017500000000055610170673626020627 0ustar ivanivanBEGIN { $| = 1; print "1..1\n"; eval "use Crypt::SSLeay;"; if ( $@ ) { print "ok 1 # Skipped: Crypt::SSLeay is not installed\n"; exit; } $Business::OnlinePayment::HTTPS::skip_NetSSLeay=1; $Business::OnlinePayment::HTTPS::skip_NetSSLeay=1; } END {print "not ok 1\n" unless $loaded;} use Business::OnlinePayment::OpenECHO; $loaded = 1; print "ok 1\n"; Business-OnlinePayment-OpenECHO-0.03/t/load.t0000644000175000017500000000040110170673626017373 0ustar ivanivanBEGIN { $| = 1; print "1..1\n"; eval "use Net::SSLeay;"; if ( $@ ) { print "ok 1 # Skipped: Net::SSLeay is not installed\n"; exit; } } END {print "not ok 1\n" unless $loaded;} use Business::OnlinePayment::OpenECHO; $loaded = 1; print "ok 1\n";