summaryrefslogtreecommitdiff
path: root/ext/mcve/mcve_test1.php
blob: a4f7dba8d6d143ae02b26ec585bda7a72b7f0d4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<HTML>
<BODY>
<?php

// MCVE Config stuff
$username="vitale";
$password="test";
// 1:IP or 2:SSL
$method=2;
$host="testbox.mcve.com";
$port=8444;  //8444 is typically SSL and 8333 is standard
// End config stuff


if (!$account) 
  $account="4012888888881";
if (!$exp)
  $exp="0512";
if (!$amount)
  $amount=12.00;

function flush_buffer()
{
  for ($i=0; $i<2048; $i++) {
    echo "  ";
  }
  flush();
}


dl("./php_mcve.so");
  
  echo "Initializing MCVE<BR>";
  flush_buffer(); 
  mcve_initengine("./CAfile.pem");
  $conn=mcve_initconn();
  if ($method == 1)
    $ret=mcve_setip($conn, $host, $port);
  else if ($method == 2)
    $ret=mcve_setssl($conn, $host, $port);
  
  if (!$ret) {
    echo "Could not set method<BR>";
    exit(1);
  } 
  echo "Connection method and location set<BR>";
  flush_buffer();
  if (!mcve_connect($conn)) {
    echo "Connection Failed<BR>";
    exit(1); 
  }
  echo "Connection Established<BR>";
  flush_buffer();
  $identifier=mcve_sale($conn, $username, $password, NULL, $account, $exp,
              $amount, NULL, NULL, NULL, NULL, NULL, NULL, 001);
  echo "Transaction Sent: CC: $account EXP: $exp AMOUNT: $amount<BR>";
  flush_buffer();
  while (mcve_checkstatus($conn, $identifier) != MCVE_DONE) {
    mcve_monitor($conn);
  }
  echo "Transaction Complete<BR>";
  flush_buffer();
  $status=mcve_returnstatus($conn, $identifier);
  if ($status == MCVE_SUCCESS) {
    $text=mcve_transactiontext($conn, $identifier);
    $auth=mcve_transactionauth($conn, $identifier);
    echo "Transaction Authorized<BR>";
    echo "Auth: $auth<BR>";
    echo "Text: $text<BR>";
  }  else if ($status == MCVE_FAIL) {
    $text=mcve_transactiontext($conn, $identifier);
    echo "Transaction Denied<BR>";
    echo "Text: $text<BR>";
  } else 
    echo "Transaction error<BR>";
  flush_buffer();
  mcve_destroyconn($conn);
  mcve_destroyengine();

?>
</BODY>
</HTML>