-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPluginProtxform.php
More file actions
164 lines (152 loc) · 9.43 KB
/
PluginProtxform.php
File metadata and controls
164 lines (152 loc) · 9.43 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<?php
/*
protx vsp form payment module by Chris Bond <chris@logics.co.uk>
If you want to test this payment provider use the Vendor ID of "testvendor"
and Crypt Password of "testvendor".
Test Credit cards are as follows these will all produce a valid transaction.
VISA 4929 0000 0000 6 No Issue No Any Expiry Date
MasterCard 5404 0000 0000 0001 No Issue No Any Expiry Date
DELTA 4462 0000 0000 0001 No Issue No Any Expiry Date
Switch 5641 8200 0000 0005 Issue No 1 Any Expiry Date
Solo 6334 9000 0000 0005 Issue No 1 Any Expiry Date
Amercian Expres 3742 0000 0000 004 No Applicable Any Expiry Date
*/
include("functions.php");
require_once 'modules/admin/models/GatewayPlugin.php';
/**
* @package Plugins
*/
class PluginProtxform extends GatewayPlugin
{
function getVariables()
{
/* Specification
itemkey - used to identify variable in your other functions
type - text,textarea,yesno,password
description - description of the variable, displayed in ClientExec
*/
$variables = array (
lang("Plugin Name") => array (
"type" =>"hidden",
"description" =>lang("How CE sees this plugin (not to be confused with the Signup Name)"),
"value" =>lang("Protx")
),
lang("Vendor ID") => array (
"type" =>"text",
"description" =>lang("Vendor ID used to identify you to protx.<br>NOTE: This ID is required if you have selected protx as a payment gateway for any of your clients."),
"value" => '',
),
lang("Crypt Password") => array (
"type" =>"password",
"description" =>lang("Password used to crypt payment information.<br>NOTE: This password has to match the value set by protx."),
"value" =>""
),
lang("Vendor E-mail") => array (
"type" =>"text",
"description" =>lang("This E-mail is sent from protx to inform the client of the transaction. You need to set this to your E-mail address that you want bills to come from."),
'value' => '',
),
lang("Visa") => array (
"type" =>"yesno",
"description" =>lang("Select YES to allow Visa card acceptance with this plugin. No will prevent this card type."),
"value" =>"1"
),
lang("MasterCard") => array (
"type" =>"yesno",
"description" =>lang("Select YES to allow MasterCard acceptance with this plugin. No will prevent this card type."),
"value" =>"1"
),
lang("AmericanExpress") => array (
"type" =>"yesno",
"description" =>lang("Select YES to allow American Express card acceptance with this plugin. No will prevent this card type."),
"value" =>"0"
),
lang("Discover") => array (
"type" =>"yesno",
"description" =>lang("Select YES to allow Discover card acceptance with this plugin. No will prevent this card type."),
"value" =>"0"
),
lang("Invoice After Signup") => array (
"type" =>"yesno",
"description" =>lang("Select YES if you want an invoice sent to the client after signup is complete."),
"value" =>"1"
),
lang("Signup Name") => array (
"type" =>"text",
"description" =>lang("Select the name to display in the signup process for this payment type. Example: eCheck or Credit Card."),
"value" =>"Credit Card"
),
lang("Accept CC Number") => array (
"type" =>"hidden",
"description" =>lang("Selecting YES allows the entering of CC numbers when using this plugin type. No will prevent entering of cc information"),
"value" =>"0"
),
lang("Dummy Plugin") => array (
"type" =>"hidden",
"description" =>lang("1 = Only used to specify a billing type for a client. 0 = full fledged plugin requiring complete functions"),
"value" =>"0"
),
lang("Auto Payment") => array (
"type" =>"hidden",
"description" =>lang("No description"),
"value" =>"0"
),
lang("Demo Mode") => array (
"type" =>"yesno",
"description" =>lang("Select YES to send all transactions to the demo form processor"),
"value" =>"0"
),
lang("Check CVV2") => array (
"type" =>"hidden",
"description" =>lang("Select YES if you want to accept CVV2 for this plugin."),
"value" =>"0"
)
);
return $variables;
}
public function credit($params)
{
return $this->user->lang("This payment gateway does not support refunds.");
}
function singlepayment($params)
{
//generate post to submit to protx
$strRet = "<html>\n";
$strRet .= "<head></head>\n";
$strRet .= "<body>\n";
if ($params["plugin_protxform_Demo Mode"]==1) {
//Old URL
//$strRet .= "<form name=\"frmProtx\" action=\"https://ukvpstest.protx.com/vspgateway/service/vspform-register.vsp\" method=\"post\">\n";
//New URL
$strRet .= "<form name=\"frmProtx\" action=\"https://test.sagepay.com/gateway/service/vspform-register.vsp\" method=\"post\">\n";
} else {
////Old URL
//$strRet .= "<form name=\"frmProtx\" action=\"https://ukvps.protx.com/vspgateway/service/vspform-register.vsp\" method=\"post\">\n";
//New URL
$strRet .= "<form name=\"frmProtx\" action=\"https://live.sagepay.com/gateway/service/vspform-register.vsp\" method=\"post\">\n";
}
$strRet .= "<input type=\"hidden\" name=\"VPSProtocol\" value=\"2.22\">\n";
$strRet .= "<input type=\"hidden\" name=\"TxType\" value=\"PAYMENT\">\n";
$strRet .= "<input type=\"hidden\" name=\"Vendor\" value=\"".$params["plugin_protxform_Vendor ID"]."\">\n";
$sCrypt = "VendorTxCode=".$params['invoiceNumber']."D".date('Ymdhis');
$sCrypt .= "&Amount=".sprintf("%01.2f", round($params["invoiceTotal"], 2));
$sCrypt .= "&Currency=".$params["currencytype"];
$sCrypt .= "&Description=Invoice Number ".$params['invoiceNumber'];
$sCrypt .= "&SuccessURL=".$params['clientExecURL']."/plugins/gateways/protxform/callback.php?success=1";
$sCrypt .= "&FailureURL=".$params['clientExecURL']."/plugins/gateways/protxform/callback.php?fail=1";
$sCrypt .= "&CustomerEMail=".$params["userEmail"];
$sCrypt .= "&VendorEMail=".$params["plugin_protxform_Vendor E-mail"];
$sCrypt .= "&CustomerName=".$params['userFirstName']." ".$params['userLastName'];
$sCrypt .= "&BillingAddress=".$params["userAddress"] . " ".$params["userCity"] ." ".$params["userZipcode"];
$sCrypt .= "&BillingPostCode=".$params["userZipcode"];
$sCrypt = base64_encode(SimpleXor($sCrypt, $params["plugin_protxform_Crypt Password"]));
$strRet .= "<input type=\"hidden\" name=\"Crypt\" value=\"".$sCrypt."\">";
$strRet .= "<script language=\"JavaScript\">\n";
$strRet .= "document.forms[0].submit();\n";
$strRet .= "</script>\n";
$strRet .= "</form>\n";
$strRet .= "</body></html>";
echo $strRet;
exit;
}
}