Targetpay (class.ivr.php)
Ik heb een vraagje over het volgende targetpay bestand.
Moet ik overal de gegevens invullen of alleen in het bovenste gedeelte?
Sorry maar heb mijna tot geen verstand van php
Code (php)
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?
include ("class.httprequest.php");
class IVR {
var $rtlo; // TargetPay Layoutcode
var $country; // Country of customer
var $payline; // Phone number returned by TargetPay
var $paycode; // Paycode returned by TargetPay
var $error; // Error....
var $callduration; // Callduration in seconds returned by TargetPay;
var $calltariff; // Call tariff returned by TargetPay;
function IVR ($rtlo, $country) {
$this->rtlo = $rtlo;
$this->country = $country;
}
function PreparePayPerCall ($tariff, $adult) {
$dataToSend = array(
"ct" => "PC",
"rtlo" => $this->rtlo,
"co" => $this->country,
"tb" => $tariff,
"adult" => $adult,
"iphash" => $_SERVER["REMOTE_ADDR"]
);
$api = new httpRequest ("http://api.targetpay.nl/payment/startpayment.asp", $dataToSend);
list ($resultcode, $paycode, $payline) = explode("|", $api->response);
if ($resultcode=="000 OK") {
$this->paycode = $paycode;
$this->payline = $payline;
return true;
} else {
$this->error = $resultcode;
return false;
}
}
function PreparePayPerMinute ($tariff, $adult, $callduration) {
$dataToSend = array(
"ct" => "PM",
"rtlo" => $this->rtlo,
"co" => $this->country,
"tb" => $tariff,
"adult" => $adult,
"cd" => $callduration,
"iphash" => $_SERVER["REMOTE_ADDR"]
);
$api = new httpRequest ("http://api.targetpay.nl/payment/startpayment.asp", $dataToSend);
list ($resultcode, $paycode, $payline) = explode("|", $api->response);
if ($resultcode=="000 OK") {
$this->paycode = $paycode;
$this->payline = $payline;
return true;
} else {
$this->error = $resultcode;
return false;
}
}
function CheckPayment ($paycode, $payline) {
$dataToSend = array(
"rtlo" => $this->rtlo,
"country" => $this->country,
"paycode" => $paycode,
"payline" => $payline,
);
$api = new httpRequest ("http://api.targetpay.nl/payment/checkpayment.asp", $dataToSend);
list ($resultcode, $this->calltariff, $calltype, $this->callduration) = explode("|", $api->response);
if ($resultcode=="000 OK") {
return true;
} else {
return false;
}
}
function CheckPincode ($code, $payline) {
$dataToSend = array(
"rtlo" => $this->rtlo,
"country" => $this->country,
"payline" => $payline,
"code" => $code,
);
$api = new httpRequest ("http://www.targetpay.nl/api/ivr-pincode", $dataToSend);
$resultcode = $api->response;
if ($resultcode=="000 OK") {
return true;
} else {
$this->error = $resultcode;
return false;
}
}
}
?>
include ("class.httprequest.php");
class IVR {
var $rtlo; // TargetPay Layoutcode
var $country; // Country of customer
var $payline; // Phone number returned by TargetPay
var $paycode; // Paycode returned by TargetPay
var $error; // Error....
var $callduration; // Callduration in seconds returned by TargetPay;
var $calltariff; // Call tariff returned by TargetPay;
function IVR ($rtlo, $country) {
$this->rtlo = $rtlo;
$this->country = $country;
}
function PreparePayPerCall ($tariff, $adult) {
$dataToSend = array(
"ct" => "PC",
"rtlo" => $this->rtlo,
"co" => $this->country,
"tb" => $tariff,
"adult" => $adult,
"iphash" => $_SERVER["REMOTE_ADDR"]
);
$api = new httpRequest ("http://api.targetpay.nl/payment/startpayment.asp", $dataToSend);
list ($resultcode, $paycode, $payline) = explode("|", $api->response);
if ($resultcode=="000 OK") {
$this->paycode = $paycode;
$this->payline = $payline;
return true;
} else {
$this->error = $resultcode;
return false;
}
}
function PreparePayPerMinute ($tariff, $adult, $callduration) {
$dataToSend = array(
"ct" => "PM",
"rtlo" => $this->rtlo,
"co" => $this->country,
"tb" => $tariff,
"adult" => $adult,
"cd" => $callduration,
"iphash" => $_SERVER["REMOTE_ADDR"]
);
$api = new httpRequest ("http://api.targetpay.nl/payment/startpayment.asp", $dataToSend);
list ($resultcode, $paycode, $payline) = explode("|", $api->response);
if ($resultcode=="000 OK") {
$this->paycode = $paycode;
$this->payline = $payline;
return true;
} else {
$this->error = $resultcode;
return false;
}
}
function CheckPayment ($paycode, $payline) {
$dataToSend = array(
"rtlo" => $this->rtlo,
"country" => $this->country,
"paycode" => $paycode,
"payline" => $payline,
);
$api = new httpRequest ("http://api.targetpay.nl/payment/checkpayment.asp", $dataToSend);
list ($resultcode, $this->calltariff, $calltype, $this->callduration) = explode("|", $api->response);
if ($resultcode=="000 OK") {
return true;
} else {
return false;
}
}
function CheckPincode ($code, $payline) {
$dataToSend = array(
"rtlo" => $this->rtlo,
"country" => $this->country,
"payline" => $payline,
"code" => $code,
);
$api = new httpRequest ("http://www.targetpay.nl/api/ivr-pincode", $dataToSend);
$resultcode = $api->response;
if ($resultcode=="000 OK") {
return true;
} else {
$this->error = $resultcode;
return false;
}
}
}
?>
Gewijzigd op 22/04/2011 18:31:28 door Leroy schouten
Zoek eens een script uit het heden en niet het verleden. En uiteraard het lieftst een welke gedocumenteerd is.
Ik wil deze ouderen blijven gebruiken
Wat zegt het bijbhorende voorbeeld wat bij deze class geleverd wordt.
Noppes Homeland op 22/04/2011 18:40:08:
Zoek eens een script uit het heden en niet het verleden. En uiteraard het lieftst een welke gedocumenteerd is.
+1
Maar moet dit dan ook bij bijvoorbeeld dit:
Code (php)
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
function PreparePayPerMinute ($tariff, $adult, $callduration) {
$dataToSend = array(
"ct" => "PM",
"rtlo" => $this->rtlo,
"co" => $this->country,
"tb" => $tariff,
"adult" => $adult,
"cd" => $callduration,
"iphash" => $_SERVER["REMOTE_ADDR"]
);
$dataToSend = array(
"ct" => "PM",
"rtlo" => $this->rtlo,
"co" => $this->country,
"tb" => $tariff,
"adult" => $adult,
"cd" => $callduration,
"iphash" => $_SERVER["REMOTE_ADDR"]
);
Toevoeging op 22/04/2011 19:22:09:
Weet mischien waar ik een voorbeeld kan vinden wand dan weet ik het wel.
Toevoeging op 22/04/2011 20:22:28:
Het is me gelukt ;)