exact4r 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. data/CHANGELOG +6 -1
  2. data/README +71 -3
  3. data/Rakefile +8 -7
  4. data/VERSION +1 -1
  5. data/doc/classes/EWS/Transaction/FakeResponse.html +451 -0
  6. data/doc/classes/EWS/Transaction/Request.html +61 -80
  7. data/doc/classes/EWS/Transaction/Response.html +206 -14
  8. data/doc/classes/EWS/Transaction/Validator.html +182 -0
  9. data/doc/classes/EWS/Transporter.html +269 -0
  10. data/doc/classes/REXML/Document.html +176 -0
  11. data/doc/classes/REXML/Entity.html +150 -0
  12. data/doc/classes/REXML.html +112 -0
  13. data/doc/created.rid +1 -1
  14. data/doc/files/CHANGELOG.html +156 -0
  15. data/doc/files/LICENCE.html +109 -0
  16. data/doc/files/README.html +164 -23
  17. data/doc/files/VERSION.html +107 -0
  18. data/doc/files/lib/ews/transaction/fake_response_rb.html +101 -0
  19. data/doc/files/lib/ews/transaction/mapping_rb.html +1 -1
  20. data/doc/files/lib/ews/transaction/request_rb.html +8 -1
  21. data/doc/files/lib/ews/transaction/response_rb.html +1 -1
  22. data/doc/files/lib/ews/transaction/validator_rb.html +101 -0
  23. data/doc/files/lib/ews/{transaction/transporter_rb.html → transporter_rb.html} +3 -3
  24. data/doc/files/lib/exact4r_rb.html +6 -2
  25. data/doc/fr_class_index.html +6 -1
  26. data/doc/fr_file_index.html +6 -1
  27. data/doc/fr_method_index.html +22 -7
  28. data/lib/ews/transaction/mapping.rb +41 -40
  29. data/lib/ews/transaction/request.rb +3 -4
  30. data/lib/ews/transaction/response.rb +5 -0
  31. data/lib/ews/transaction/validator.rb +44 -34
  32. data/lib/ews/transporter.rb +3 -3
  33. data/lib/exact4r.rb +1 -1
  34. data/test/exhaustive/forced_post_test.rb +75 -0
  35. data/test/exhaustive/online_debit_purchase_test.rb +66 -0
  36. data/test/exhaustive/online_debit_refund_test.rb +66 -0
  37. data/test/exhaustive/pre_auth_completion_test.rb +99 -0
  38. data/test/exhaustive/pre_auth_only_test.rb +68 -0
  39. data/test/exhaustive/pre_auth_test.rb +68 -0
  40. data/test/exhaustive/purchase_correction_test.rb +79 -0
  41. data/test/exhaustive/purchase_test.rb +68 -0
  42. data/test/exhaustive/recurring_seed_pre_auth_test.rb +68 -0
  43. data/test/exhaustive/recurring_seed_purchase_test.rb +68 -0
  44. data/test/exhaustive/refund_correction_test.rb +79 -0
  45. data/test/exhaustive/refund_test.rb +68 -0
  46. data/test/exhaustive/secure_storage_test.rb +75 -0
  47. data/test/exhaustive/tagged_online_debit_refund_test.rb +168 -0
  48. data/test/exhaustive/tagged_pre_auth_completion_test.rb +119 -0
  49. data/test/exhaustive/tagged_pre_auth_test.rb +116 -0
  50. data/test/exhaustive/tagged_purchase_test.rb +116 -0
  51. data/test/exhaustive/tagged_refund_test.rb +144 -0
  52. data/test/exhaustive/transaction_details_test.rb +86 -0
  53. data/test/exhaustive/void_test.rb +75 -0
  54. data/{spec/avs_spec.rb → test/general/avs_test.rb} +33 -44
  55. data/test/general/json_encoding_test.rb +62 -0
  56. data/test/general/request_test.rb +185 -0
  57. data/test/general/rest_encoding_test.rb +174 -0
  58. data/test/general/soap_encoding_test.rb +211 -0
  59. data/test/general/transporter_test.rb +54 -0
  60. data/test/general/validator_test.rb +150 -0
  61. data/test/samples/rest.dodgy.response.xml +60 -0
  62. data/test/samples/rest.everything.response.xml +67 -0
  63. data/test/samples/rest.response.xml +60 -0
  64. data/test/samples/soap.deserialization.fault.xml +10 -0
  65. data/test/samples/soap.dodgy.response.xml +95 -0
  66. data/test/samples/soap.everything.response.xml +75 -0
  67. data/test/samples/soap.generalfailure.fault.xml +13 -0
  68. data/test/samples/soap.nulltransaction.fault.xml +14 -0
  69. data/test/samples/soap.response.xml +95 -0
  70. data/test/test_helper.rb +115 -0
  71. metadata +52 -12
  72. data/doc/classes/EWS/Transaction/Transporter.html +0 -251
  73. data/pkg/exact4r-0.5.gem +0 -0
  74. data/spec/mapping_spec.rb +0 -126
  75. data/spec/request_spec.rb +0 -154
  76. data/spec/spec_helper.rb +0 -55
  77. data/spec/transporter_spec.rb +0 -43
  78. data/spec/validator_spec.rb +0 -150
@@ -0,0 +1,67 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ NOTE: This is a fabricated response, designed so that it has values set for EVERY attribute!
4
+ Its sole purpose is to allow us to test that all values are correctly decoded. The values are
5
+ complete nonsense and do not bear any relation to corresponding values which would be received
6
+ in a real response from the web service.
7
+ -->
8
+ <TransactionResult>
9
+ <Authorization_Num>ET3434</Authorization_Num>
10
+ <AVS>Z</AVS>
11
+ <Bank_Message>APPROVED</Bank_Message>
12
+ <Bank_Resp_Code>000</Bank_Resp_Code>
13
+ <Bank_Resp_Code_2>12</Bank_Resp_Code_2>
14
+ <CardHoldersName>Simon Brown</CardHoldersName>
15
+ <Card_Number>4111111111111111</Card_Number>
16
+ <CAVV>123</CAVV>
17
+ <CAVV_Algorithm>8</CAVV_Algorithm>
18
+ <CAVV_Response>0</CAVV_Response>
19
+ <Client_Email>simon@example.com</Client_Email>
20
+ <Client_IP>127.0.0.1</Client_IP>
21
+ <CTR>This is
22
+ a CTR</CTR>
23
+ <Customer_Ref>REF-123</Customer_Ref>
24
+ <CVD_Presence_Ind>0</CVD_Presence_Ind>
25
+ <CVV2>U</CVV2>
26
+ <DollarAmount>10.13</DollarAmount>
27
+ <Ecommerce_Flag>4</Ecommerce_Flag>
28
+ <Error_Description>Something</Error_Description>
29
+ <Error_Number>650</Error_Number>
30
+ <ExactID>AD0009-01</ExactID>
31
+ <EXact_Message>Transaction Normal</EXact_Message>
32
+ <EXact_Resp_Code>00</EXact_Resp_Code>
33
+ <Expiry_Date>1210</Expiry_Date>
34
+ <Language>4</Language>
35
+ <LogonMessage>Processed by E-Xact</LogonMessage>
36
+ <MerchantAddress>4567 8th ave SE.</MerchantAddress>
37
+ <MerchantCity>Calgary</MerchantCity>
38
+ <MerchantCountry>United States</MerchantCountry>
39
+ <MerchantName>Paymentech Goods Buy and Sell(Calgary) 5300003</MerchantName>
40
+ <MerchantPostal>V6B 2K4</MerchantPostal>
41
+ <MerchantProvince>Alabama</MerchantProvince>
42
+ <MerchantURL>http://somewhere.com/somehow/</MerchantURL>
43
+ <PAN>12345678900987654321</PAN>
44
+ <Password>passw0rd</Password>
45
+ <Reference_3>REF-456</Reference_3>
46
+ <Reference_No>987987</Reference_No>
47
+ <Retrieval_Ref_No>07203434</Retrieval_Ref_No>
48
+ <Secure_AuthRequired>1</Secure_AuthRequired>
49
+ <Secure_AuthResult>9</Secure_AuthResult>
50
+ <SequenceNo>258</SequenceNo>
51
+ <SurchargeAmount>11.12</SurchargeAmount>
52
+ <Tax1Amount>23.23</Tax1Amount>
53
+ <Tax1Number>987654</Tax1Number>
54
+ <Tax2Amount>34.34</Tax2Amount>
55
+ <Tax2Number>123456</Tax2Number>
56
+ <Track1>%B4111111111111111^Jones/Simon ^1309101063510010000000306000000?</Track1>
57
+ <Track2>;4111111111111111=1309101420320192611?</Track2>
58
+ <Transaction_Approved>true</Transaction_Approved>
59
+ <Transaction_Error>0</Transaction_Error>
60
+ <Transaction_Tag>2516</Transaction_Tag>
61
+ <Transaction_Type>00</Transaction_Type>
62
+ <User_Name>Superman</User_Name>
63
+ <VerificationStr1>verified</VerificationStr1>
64
+ <VerificationStr2>6785</VerificationStr2>
65
+ <XID>x678</XID>
66
+ <ZipCode>10100</ZipCode>
67
+ </TransactionResult>
@@ -0,0 +1,60 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <TransactionResult>
3
+ <Authorization_Num>ET3434</Authorization_Num>
4
+ <AVS></AVS>
5
+ <Bank_Message>APPROVED</Bank_Message>
6
+ <Bank_Resp_Code>000</Bank_Resp_Code>
7
+ <Bank_Resp_Code_2></Bank_Resp_Code_2>
8
+ <CardHoldersName>Simon Brown</CardHoldersName>
9
+ <Card_Number>4111111111111111</Card_Number>
10
+ <CAVV></CAVV>
11
+ <CAVV_Algorithm></CAVV_Algorithm>
12
+ <CAVV_Response>0</CAVV_Response>
13
+ <Client_Email></Client_Email>
14
+ <Client_IP></Client_IP>
15
+ <CTR></CTR>
16
+ <Customer_Ref></Customer_Ref>
17
+ <CVD_Presence_Ind>0</CVD_Presence_Ind>
18
+ <CVV2></CVV2>
19
+ <DollarAmount>10.13</DollarAmount>
20
+ <Ecommerce_Flag>0</Ecommerce_Flag>
21
+ <Error_Description></Error_Description>
22
+ <Error_Number></Error_Number>
23
+ <ExactID>AD0008-01</ExactID>
24
+ <EXact_Message>Transaction Normal</EXact_Message>
25
+ <EXact_Resp_Code>00</EXact_Resp_Code>
26
+ <Expiry_Date>1210</Expiry_Date>
27
+ <Language></Language>
28
+ <LogonMessage></LogonMessage>
29
+ <MerchantAddress>4567 8th ave SE.</MerchantAddress>
30
+ <MerchantCity>Calgary</MerchantCity>
31
+ <MerchantCountry>United States</MerchantCountry>
32
+ <MerchantName>Paymentech Goods Buy and Sell(Calgary) 5300003</MerchantName>
33
+ <MerchantPostal>V6B 2K4</MerchantPostal>
34
+ <MerchantProvince>Alabama</MerchantProvince>
35
+ <MerchantURL></MerchantURL>
36
+ <PAN></PAN>
37
+ <Password></Password>
38
+ <Reference_3></Reference_3>
39
+ <Reference_No>987987</Reference_No>
40
+ <Retrieval_Ref_No>07203434</Retrieval_Ref_No>
41
+ <Secure_AuthRequired></Secure_AuthRequired>
42
+ <Secure_AuthResult></Secure_AuthResult>
43
+ <SequenceNo>258</SequenceNo>
44
+ <SurchargeAmount></SurchargeAmount>
45
+ <Tax1Amount></Tax1Amount>
46
+ <Tax1Number></Tax1Number>
47
+ <Tax2Amount></Tax2Amount>
48
+ <Tax2Number></Tax2Number>
49
+ <Track1></Track1>
50
+ <Track2></Track2>
51
+ <Transaction_Approved>true</Transaction_Approved>
52
+ <Transaction_Error></Transaction_Error>
53
+ <Transaction_Tag>2516</Transaction_Tag>
54
+ <Transaction_Type>00</Transaction_Type>
55
+ <User_Name></User_Name>
56
+ <VerificationStr1></VerificationStr1>
57
+ <VerificationStr2></VerificationStr2>
58
+ <XID></XID>
59
+ <ZipCode></ZipCode>
60
+ </TransactionResult>
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
3
+ <soap:Body>
4
+ <soap:Fault>
5
+ <faultcode>soap:Client</faultcode>
6
+ <faultstring>Server was unable to read request. --&gt; There is an error in XML document (1, 406). --&gt; &lt;SendAndCommit xmlns='http://secure2.exact.com/vplug-in/transaction/rpc-enc/'&gt; was not expected.</faultstring>
7
+ <detail />
8
+ </soap:Fault>
9
+ </soap:Body>
10
+ </soap:Envelope>
@@ -0,0 +1,95 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/" xmlns:types="http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/encodedTypes" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
3
+ <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
4
+ <q1:ProcessResponse xmlns:q1="http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/Response">
5
+ <ProcessResult href="#id1">
6
+ </ProcessResult>
7
+ </q1:ProcessResponse>
8
+ <types:TransactionResult id="id1" xsi:type="types:TransactionResult">
9
+ <ExactID xsi:type="xsd:string">AD0008-01</ExactID>
10
+ <Password xsi:nil="true"></Password>
11
+ <Transaction_Type xsi:type="xsd:string">00</Transaction_Type>
12
+ <DollarAmount xsi:type="xsd:string">10.13</DollarAmount>
13
+ <SurchargeAmount xsi:nil="true"></SurchargeAmount>
14
+ <Card_Number xsi:type="xsd:string">4111111111111111666666</Card_Number>
15
+ <Transaction_Tag xsi:type="xsd:string">2517</Transaction_Tag>
16
+ <Track1 xsi:nil="true"></Track1>
17
+ <Track2 xsi:nil="true"></Track2>
18
+ <PAN xsi:nil="true"></PAN>
19
+ <Authorization_Num xsi:type="xsd:string">ET3435</Authorization_Num>
20
+ <Expiry_Date xsi:type="xsd:string">1210</Expiry_Date>
21
+ <CardHoldersName xsi:type="xsd:string">Simon Brown Is Not A Really Long Name But This Is</CardHoldersName>
22
+ <VerificationStr1 xsi:nil="true"></VerificationStr1>
23
+ <VerificationStr2 xsi:nil="true"></VerificationStr2>
24
+ <CVD_Presence_Ind xsi:type="xsd:string">0</CVD_Presence_Ind>
25
+ <ZipCode xsi:nil="true"></ZipCode>
26
+ <Tax1Amount xsi:nil="true"></Tax1Amount>
27
+ <Tax1Number xsi:nil="true"></Tax1Number>
28
+ <Tax2Amount xsi:nil="true"></Tax2Amount>
29
+ <Tax2Number xsi:nil="true"></Tax2Number>
30
+ <Secure_AuthRequired xsi:nil="true"></Secure_AuthRequired>
31
+ <Secure_AuthResult xsi:nil="true"></Secure_AuthResult>
32
+ <Ecommerce_Flag xsi:type="xsd:string">0</Ecommerce_Flag>
33
+ <XID xsi:nil="true"></XID>
34
+ <CAVV xsi:nil="true"></CAVV>
35
+ <CAVV_Algorithm xsi:nil="true"></CAVV_Algorithm>
36
+ <Reference_No xsi:type="xsd:string">987987</Reference_No>
37
+ <Customer_Ref xsi:nil="true"></Customer_Ref>
38
+ <Reference_3 xsi:nil="true"></Reference_3>
39
+ <Language xsi:nil="true"></Language>
40
+ <Client_IP xsi:nil="true"></Client_IP>
41
+ <Client_Email xsi:nil="true"></Client_Email>
42
+ <User_Name xsi:nil="true"></User_Name>
43
+ <LogonMessage xsi:nil="true"></LogonMessage>
44
+ <Error_Number xsi:nil="true"></Error_Number>
45
+ <Error_Description xsi:nil="true"></Error_Description>
46
+ <Transaction_Error xsi:nil="true"></Transaction_Error>
47
+ <Transaction_Approved xsi:type="xsd:boolean">true</Transaction_Approved>
48
+ <EXact_Resp_Code xsi:type="xsd:string">00</EXact_Resp_Code>
49
+ <EXact_Message xsi:type="xsd:string">Transaction Normal</EXact_Message>
50
+ <Bank_Resp_Code xsi:type="xsd:string">000</Bank_Resp_Code>
51
+ <Bank_Message xsi:type="xsd:string">APPROVED</Bank_Message>
52
+ <Bank_Resp_Code_2 xsi:nil="true"></Bank_Resp_Code_2>
53
+ <SequenceNo xsi:type="xsd:string">259</SequenceNo>
54
+ <AVS xsi:nil="true"></AVS>
55
+ <CVV2 xsi:nil="true"></CVV2>
56
+ <Retrieval_Ref_No xsi:type="xsd:string">07203435</Retrieval_Ref_No>
57
+ <CAVV_Response xsi:type="xsd:string">0</CAVV_Response>
58
+ <MerchantName xsi:type="xsd:string">Paymentech Goods Buy and Sell(Calgary) 5300003</MerchantName>
59
+ <MerchantAddress xsi:type="xsd:string">4567 8th ave SE.</MerchantAddress>
60
+ <MerchantCity xsi:type="xsd:string">Calgary</MerchantCity>
61
+ <MerchantProvince xsi:type="xsd:string">Alabama</MerchantProvince>
62
+ <MerchantCountry xsi:type="xsd:string">United States</MerchantCountry>
63
+ <MerchantPostal xsi:type="xsd:string">V6B 2K4</MerchantPostal>
64
+ <MerchantURL xsi:nil="true"></MerchantURL>
65
+ <CTR xsi:type="xsd:string">
66
+ ======== TRANSACTION RECORD ========
67
+
68
+ Goods Buy and Sell(Calgary)
69
+ 4567 8th ave SE.
70
+ Calgary, AL V6B 2K4
71
+ United States
72
+
73
+
74
+ TYPE: Purchase
75
+
76
+ ACCT: Visa $10.13 USD
77
+
78
+ CARD HOLDER : Simon Brown
79
+ EXPIRY DATE : 10/12
80
+ CARD NUMBER : ************1111
81
+ TRANS. REF. : 987987
82
+ DATE/TIME : 20 Jul 08 18:34:35
83
+ REFERENCE # : 001 259 M
84
+ AUTHOR.# : ET3435
85
+
86
+ Approved - Thank You 000
87
+
88
+
89
+
90
+
91
+ ====================================
92
+ </CTR>
93
+ </types:TransactionResult>
94
+ </soap:Body>
95
+ </soap:Envelope>
@@ -0,0 +1,75 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ NOTE: This is a fabricated response, designed so that it has values set for EVERY attribute!
4
+ Its sole purpose is to allow us to test that all values are correctly decoded. The values are
5
+ complete nonsense and do not bear any relation to corresponding values which would be received
6
+ in a real response from the web service.
7
+ -->
8
+ <soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/" xmlns:types="http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/encodedTypes" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
9
+ <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
10
+ <q1:ProcessResponse xmlns:q1="http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/Response">
11
+ <ProcessResult href="#id1">
12
+ </ProcessResult>
13
+ </q1:ProcessResponse>
14
+ <types:TransactionResult id="id1" xsi:type="types:TransactionResult">
15
+ <ExactID xsi:type="xsd:string">AD0009-01</ExactID>
16
+ <Password xsi:type="xsd:string">passw0rd</Password>
17
+ <Transaction_Type xsi:type="xsd:string">00</Transaction_Type>
18
+ <DollarAmount xsi:type="xsd:string">10.13</DollarAmount>
19
+ <SurchargeAmount xsi:type="xsd:string">11.12</SurchargeAmount>
20
+ <Card_Number xsi:type="xsd:string">4111111111111111</Card_Number>
21
+ <Transaction_Tag xsi:type="xsd:string">2516</Transaction_Tag>
22
+ <Track1 xsi:type="xsd:string">%B4111111111111111^Jones/Simon ^1309101063510010000000306000000?</Track1>
23
+ <Track2 xsi:type="xsd:string">;4111111111111111=1309101420320192611?</Track2>
24
+ <PAN xsi:type="xsd:string">12345678900987654321</PAN>
25
+ <Authorization_Num xsi:type="xsd:string">ET3434</Authorization_Num>
26
+ <Expiry_Date xsi:type="xsd:string">1210</Expiry_Date>
27
+ <CardHoldersName xsi:type="xsd:string">Simon Brown</CardHoldersName>
28
+ <VerificationStr1 xsi:type="xsd:string">verified</VerificationStr1>
29
+ <VerificationStr2 xsi:type="xsd:string">6785</VerificationStr2>
30
+ <CVD_Presence_Ind xsi:type="xsd:string">0</CVD_Presence_Ind>
31
+ <ZipCode xsi:type="xsd:string">10100</ZipCode>
32
+ <Tax1Amount xsi:type="xsd:string">23.23</Tax1Amount>
33
+ <Tax1Number xsi:type="xsd:string">987654</Tax1Number>
34
+ <Tax2Amount xsi:type="xsd:string">34.34</Tax2Amount>
35
+ <Tax2Number xsi:type="xsd:string">123456</Tax2Number>
36
+ <Secure_AuthRequired xsi:type="xsd:string">1</Secure_AuthRequired>
37
+ <Secure_AuthResult xsi:type="xsd:string">9</Secure_AuthResult>
38
+ <Ecommerce_Flag xsi:type="xsd:string">4</Ecommerce_Flag>
39
+ <XID xsi:type="xsd:string">x678</XID>
40
+ <CAVV xsi:type="xsd:string">123</CAVV>
41
+ <CAVV_Algorithm xsi:type="xsd:string">8</CAVV_Algorithm>
42
+ <Reference_No xsi:type="xsd:string">987987</Reference_No>
43
+ <Customer_Ref xsi:type="xsd:string">REF-123</Customer_Ref>
44
+ <Reference_3 xsi:type="xsd:string">REF-456</Reference_3>
45
+ <Language xsi:type="xsd:string">4</Language>
46
+ <Client_IP xsi:type="xsd:string">127.0.0.1</Client_IP>
47
+ <Client_Email xsi:type="xsd:string">simon@example.com</Client_Email>
48
+ <User_Name xsi:type="xsd:string">Superman</User_Name>
49
+ <LogonMessage xsi:type="xsd:string">Processed by E-Xact</LogonMessage>
50
+ <Error_Number xsi:type="xsd:string">650</Error_Number>
51
+ <Error_Description xsi:type="xsd:string">Something</Error_Description>
52
+ <Transaction_Error xsi:type="xsd:string">0</Transaction_Error>
53
+ <Transaction_Approved xsi:type="xsd:boolean">true</Transaction_Approved>
54
+ <EXact_Resp_Code xsi:type="xsd:string">00</EXact_Resp_Code>
55
+ <EXact_Message xsi:type="xsd:string">Transaction Normal</EXact_Message>
56
+ <Bank_Resp_Code xsi:type="xsd:string">000</Bank_Resp_Code>
57
+ <Bank_Message xsi:type="xsd:string">APPROVED</Bank_Message>
58
+ <Bank_Resp_Code_2 xsi:type="xsd:string">12</Bank_Resp_Code_2>
59
+ <SequenceNo xsi:type="xsd:string">258</SequenceNo>
60
+ <AVS xsi:type="xsd:string">Z</AVS>
61
+ <CVV2 xsi:type="xsd:string">U</CVV2>
62
+ <Retrieval_Ref_No xsi:type="xsd:string">07203434</Retrieval_Ref_No>
63
+ <CAVV_Response xsi:type="xsd:string">0</CAVV_Response>
64
+ <MerchantName xsi:type="xsd:string">Paymentech Goods Buy and Sell(Calgary) 5300003</MerchantName>
65
+ <MerchantAddress xsi:type="xsd:string">4567 8th ave SE.</MerchantAddress>
66
+ <MerchantCity xsi:type="xsd:string">Calgary</MerchantCity>
67
+ <MerchantProvince xsi:type="xsd:string">Alabama</MerchantProvince>
68
+ <MerchantCountry xsi:type="xsd:string">United States</MerchantCountry>
69
+ <MerchantPostal xsi:type="xsd:string">V6B 2K4</MerchantPostal>
70
+ <MerchantURL xsi:type="xsd:string">http://somewhere.com/somehow/</MerchantURL>
71
+ <CTR xsi:type="xsd:string">This is
72
+ a CTR</CTR>
73
+ </types:TransactionResult>
74
+ </soap:Body>
75
+ </soap:Envelope>
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
3
+ <soap:Body>
4
+ <soap:Fault>
5
+ <faultcode>soap:Server</faultcode>
6
+ <faultstring>System.Web.Services.Protocols.SoapException: Setup Error at rpc-enc.Service.SendAndCommit(Transaction Transaction) in C:\Documents and Settings\defaultuser\VSWebCache\secure2.exact.com\vplug-in\transaction\rpc-enc\Service.asmx.vb:line 99</faultstring>
7
+ <faultactor>http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/Service.asmx</faultactor>
8
+ <detail>
9
+ <error number="500" description="Internal Server Error. An unknown error occurred." xmlns="http://secure2.e-xact.com/vplug-in/transaction/rpc-enc" />
10
+ </detail>
11
+ </soap:Fault>
12
+ </soap:Body>
13
+ </soap:Envelope>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
3
+ <soap:Body>
4
+ <soap:Fault>
5
+ <faultcode>soap:Client</faultcode>
6
+ <faultstring>System.Web.Services.Protocols.SoapException: Setup Error at rpc-enc.Service.SendAndCommit(Transaction Transaction) in C:\Documents and Settings\defaultuser\VSWebCache\ secure.e-xact.com\vplug-in\transaction\rpc-enc\Service.asmx.vb:line 98</faultstring>
7
+ <faultactor>http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/Service.asmx</faultactor>
8
+ <detail>
9
+ <error number="400" description="Bad Request. Object reference not set to an instance of a Transaction object." xmlns="http://secure2.e-xact.com/vplug-in/transaction/rpc-enc" />
10
+ </detail>
11
+ </soap:Fault>
12
+ </soap:Body>
13
+ </soap:Envelope>
14
+
@@ -0,0 +1,95 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/" xmlns:types="http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/encodedTypes" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
3
+ <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
4
+ <q1:ProcessResponse xmlns:q1="http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/Response">
5
+ <ProcessResult href="#id1">
6
+ </ProcessResult>
7
+ </q1:ProcessResponse>
8
+ <types:TransactionResult id="id1" xsi:type="types:TransactionResult">
9
+ <ExactID xsi:type="xsd:string">AD0008-01</ExactID>
10
+ <Password xsi:nil="true"></Password>
11
+ <Transaction_Type xsi:type="xsd:string">00</Transaction_Type>
12
+ <DollarAmount xsi:type="xsd:string">10.13</DollarAmount>
13
+ <SurchargeAmount xsi:nil="true"></SurchargeAmount>
14
+ <Card_Number xsi:type="xsd:string">4111111111111111</Card_Number>
15
+ <Transaction_Tag xsi:type="xsd:string">2517</Transaction_Tag>
16
+ <Track1 xsi:nil="true"></Track1>
17
+ <Track2 xsi:nil="true"></Track2>
18
+ <PAN xsi:nil="true"></PAN>
19
+ <Authorization_Num xsi:type="xsd:string">ET3435</Authorization_Num>
20
+ <Expiry_Date xsi:type="xsd:string">1210</Expiry_Date>
21
+ <CardHoldersName xsi:type="xsd:string">Simon Brown</CardHoldersName>
22
+ <VerificationStr1 xsi:nil="true"></VerificationStr1>
23
+ <VerificationStr2 xsi:nil="true"></VerificationStr2>
24
+ <CVD_Presence_Ind xsi:type="xsd:string">0</CVD_Presence_Ind>
25
+ <ZipCode xsi:nil="true"></ZipCode>
26
+ <Tax1Amount xsi:nil="true"></Tax1Amount>
27
+ <Tax1Number xsi:nil="true"></Tax1Number>
28
+ <Tax2Amount xsi:nil="true"></Tax2Amount>
29
+ <Tax2Number xsi:nil="true"></Tax2Number>
30
+ <Secure_AuthRequired xsi:nil="true"></Secure_AuthRequired>
31
+ <Secure_AuthResult xsi:nil="true"></Secure_AuthResult>
32
+ <Ecommerce_Flag xsi:type="xsd:string">0</Ecommerce_Flag>
33
+ <XID xsi:nil="true"></XID>
34
+ <CAVV xsi:nil="true"></CAVV>
35
+ <CAVV_Algorithm xsi:nil="true"></CAVV_Algorithm>
36
+ <Reference_No xsi:type="xsd:string">987987</Reference_No>
37
+ <Customer_Ref xsi:nil="true"></Customer_Ref>
38
+ <Reference_3 xsi:nil="true"></Reference_3>
39
+ <Language xsi:nil="true"></Language>
40
+ <Client_IP xsi:nil="true"></Client_IP>
41
+ <Client_Email xsi:nil="true"></Client_Email>
42
+ <User_Name xsi:nil="true"></User_Name>
43
+ <LogonMessage xsi:nil="true"></LogonMessage>
44
+ <Error_Number xsi:nil="true"></Error_Number>
45
+ <Error_Description xsi:nil="true"></Error_Description>
46
+ <Transaction_Error xsi:nil="true"></Transaction_Error>
47
+ <Transaction_Approved xsi:type="xsd:boolean">true</Transaction_Approved>
48
+ <EXact_Resp_Code xsi:type="xsd:string">00</EXact_Resp_Code>
49
+ <EXact_Message xsi:type="xsd:string">Transaction Normal</EXact_Message>
50
+ <Bank_Resp_Code xsi:type="xsd:string">000</Bank_Resp_Code>
51
+ <Bank_Message xsi:type="xsd:string">APPROVED</Bank_Message>
52
+ <Bank_Resp_Code_2 xsi:nil="true"></Bank_Resp_Code_2>
53
+ <SequenceNo xsi:type="xsd:string">259</SequenceNo>
54
+ <AVS xsi:nil="true"></AVS>
55
+ <CVV2 xsi:nil="true"></CVV2>
56
+ <Retrieval_Ref_No xsi:type="xsd:string">07203435</Retrieval_Ref_No>
57
+ <CAVV_Response xsi:type="xsd:string">0</CAVV_Response>
58
+ <MerchantName xsi:type="xsd:string">Paymentech Goods Buy and Sell(Calgary) 5300003</MerchantName>
59
+ <MerchantAddress xsi:type="xsd:string">4567 8th ave SE.</MerchantAddress>
60
+ <MerchantCity xsi:type="xsd:string">Calgary</MerchantCity>
61
+ <MerchantProvince xsi:type="xsd:string">Alabama</MerchantProvince>
62
+ <MerchantCountry xsi:type="xsd:string">United States</MerchantCountry>
63
+ <MerchantPostal xsi:type="xsd:string">V6B 2K4</MerchantPostal>
64
+ <MerchantURL xsi:nil="true"></MerchantURL>
65
+ <CTR xsi:type="xsd:string">
66
+ ======== TRANSACTION RECORD ========
67
+
68
+ Goods Buy and Sell(Calgary)
69
+ 4567 8th ave SE.
70
+ Calgary, AL V6B 2K4
71
+ United States
72
+
73
+
74
+ TYPE: Purchase
75
+
76
+ ACCT: Visa $10.13 USD
77
+
78
+ CARD HOLDER : Simon Brown
79
+ EXPIRY DATE : 10/12
80
+ CARD NUMBER : ************1111
81
+ TRANS. REF. : 987987
82
+ DATE/TIME : 20 Jul 08 18:34:35
83
+ REFERENCE # : 001 259 M
84
+ AUTHOR.# : ET3435
85
+
86
+ Approved - Thank You 000
87
+
88
+
89
+
90
+
91
+ ====================================
92
+ </CTR>
93
+ </types:TransactionResult>
94
+ </soap:Body>
95
+ </soap:Envelope>
@@ -0,0 +1,115 @@
1
+ $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
2
+
3
+ require 'test/unit'
4
+ require 'lib/exact4r'
5
+ require 'ruby-debug'
6
+ require 'mocha'
7
+
8
+ # address & authentication for testing against api.e-xact.com
9
+ # LOCATION = "https://api.e-xact.com/" unless defined?(LOCATION)
10
+ # EMERGIS_BASIC_AUTH = {:gateway_id => "A04052-01", :password => "2b1jvtds"} unless defined?(EMERGIS_BASIC_AUTH)
11
+ # CHASE_BASIC_AUTH = {:gateway_id => "A05296-01", :password => "exactbatchdemo"} unless defined?(CHASE_BASIC_AUTH)
12
+ # VITAL_BASIC_AUTH = {:gateway_id => "A05296-01", :password => "exactbatchdemo"} unless defined?(VITAL_BASIC_AUTH)
13
+ # MONERIS_BASIC_AUTH = {:gateway_id => "A00049-01", :password => "test1"} unless defined?(MONERIS_BASIC_AUTH)
14
+
15
+ # address & authentication for local testing
16
+ LOCATION = "http://ws.local/" unless defined?(LOCATION) # I am a Passenger...
17
+ EMERGIS_BASIC_AUTH = {:gateway_id => "AD0009-01", :password => "8L588rmd"} unless defined?(EMERGIS_BASIC_AUTH)
18
+ CHASE_BASIC_AUTH = {:gateway_id => "AD0008-01", :password => "7nfcpc7n"} unless defined?(CHASE_BASIC_AUTH)
19
+ VITAL_BASIC_AUTH = {:gateway_id => "AD0007-01", :password => "3uLi726f"} unless defined?(VITAL_BASIC_AUTH)
20
+ MONERIS_BASIC_AUTH = {:gateway_id => "AD0154-01", :password => "77hgy56y"} unless defined?(MONERIS_BASIC_AUTH)
21
+
22
+ TEST_CARD_NUMBER = "4111111111111111" unless defined?(TEST_CARD_NUMBER)
23
+ TEST_CARD_EXPIRY = "0913" unless defined?(TEST_CARD_EXPIRY)
24
+ TEST_CARD_HOLDER = "Simon Jones" unless defined?(TEST_CARD_HOLDER)
25
+ TEST_TRACK1 = "%B4111111111111111^Jones/Simon ^1309101063510010000000306000000?" unless defined?(TEST_TRACK1)
26
+ TEST_TRACK2 = ";4111111111111111=1309101420320192611?" unless defined?(TEST_TRACK2)
27
+
28
+ def cc_number_params
29
+ {
30
+ :cc_number => TEST_CARD_NUMBER,
31
+ :cc_expiry => TEST_CARD_EXPIRY,
32
+ :cardholder_name => TEST_CARD_HOLDER
33
+ }.merge(EMERGIS_BASIC_AUTH)
34
+ end
35
+
36
+ def track1_params
37
+ {
38
+ :track1 => TEST_TRACK1
39
+ }.merge(EMERGIS_BASIC_AUTH)
40
+ end
41
+
42
+ def track2_params
43
+ {
44
+ :track2 => TEST_TRACK2,
45
+ :cardholder_name => TEST_CARD_HOLDER
46
+ }.merge(EMERGIS_BASIC_AUTH)
47
+ end
48
+
49
+ def assert_details_correct(request, response)
50
+ assert_not_nil response, "response should not be nil"
51
+ assert response.approved?, "#{response.error_number} / #{response.error_description} / #{response.exact_message} / #{response.bank_message}"
52
+
53
+ assert_not_nil response.transaction_tag
54
+ assert_not_nil response.authorization_num
55
+
56
+ assert_equal request.amount.to_s, response.amount.to_s
57
+
58
+ assert_card_details response
59
+ end
60
+
61
+ def assert_card_details(response)
62
+ assert_match /............1111/, response.cc_number
63
+ assert_equal TEST_CARD_HOLDER, response.cardholder_name
64
+ assert_equal TEST_CARD_EXPIRY, response.cc_expiry unless %w(35 50 54).include?(response.transaction_type)
65
+ end
66
+
67
+ def basic_params(options = {})
68
+ {
69
+ :transaction_type => :purchase,
70
+ :amount => "10.13",
71
+ :cardholder_name => "Simon Brown",
72
+ :cc_number => "4111111111111111",
73
+ :cc_expiry => "1012"
74
+ }.merge(EMERGIS_BASIC_AUTH).merge(options)
75
+ end
76
+
77
+ # sample values for every request parameter
78
+ def sample_everything_params
79
+ {
80
+ :amount => 10.12,
81
+ :authorization_num => "12345",
82
+ :cardholder_name => TEST_CARD_HOLDER,
83
+ :cavv => "123456789",
84
+ :cavv_algorithm => 11,
85
+ :cc_expiry => TEST_CARD_EXPIRY,
86
+ :cc_number => TEST_CARD_NUMBER,
87
+ :cc_verification_str1 => "Some String",
88
+ :cc_verification_str2 => "1234",
89
+ :client_email => "simon@example.com",
90
+ :client_ip => "127.0.0.1",
91
+ :customer_ref => "REF-321",
92
+ :cvd_presence_ind => 2,
93
+ :ecommerce_flag => 9,
94
+ :gateway_id => EMERGIS_BASIC_AUTH[:gateway_id],
95
+ :language => 4,
96
+ :pan => "12345678900987654321",
97
+ :password => EMERGIS_BASIC_AUTH[:password],
98
+ :reference_3 => "REF-123",
99
+ :reference_no => "REF-456",
100
+ :secure_auth_required => 2,
101
+ :secure_auth_result => 5,
102
+ :surcharge_amount => 11.34,
103
+ :tax1_amount => 9.87,
104
+ :tax1_number => "789",
105
+ :tax2_amount => 1.23,
106
+ :tax2_number => "321",
107
+ :track1 => TEST_TRACK1,
108
+ :track2 => TEST_TRACK2,
109
+ :transaction_tag => 5678,
110
+ :transaction_type => "00", # :purchase
111
+ :user_name => "user name",
112
+ :xid => "x678",
113
+ :zip_code => "10010"
114
+ }
115
+ end