Repository navigation
Expand file tree
/
Copy pathPluginCoinpayments.php
More file actions
80 lines (74 loc) · 3.42 KB
/
Copy pathPluginCoinpayments.php
File metadata and controls
80 lines (74 loc) · 3.42 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
<?php
require_once 'modules/billing/models/class.gateway.plugin.php';
class PluginCoinpayments extends GatewayPlugin
{
public function getVariables()
{
$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("CoinPayments")
),
lang("Merchant ID") => array (
"type" => "text",
"description" => lang("Enter your Merchant ID from your <a target='_blank' href='https://www.coinpayments.net/index.php?ref=219a5b5f2eacd21f82e48d267f5bd7dc'>coinpayments.net</a> account"),
"value" => ""
),
lang("IPN Secert") => array (
"type" => "text",
"description" => lang("Enter your IPN Secret from your <a target='_blank' href='https://www.coinpayments.net/index.php?ref=219a5b5f2eacd21f82e48d267f5bd7dc'>coinpayments.net</a> account"),
"value" => ""
),
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" => "CoinPayments"
)
);
return $variables;
}
public function credit($params)
{
return $this->user->lang("This payment gateway does not support refunds.");
}
public function singlepayment($params, $test = false)
{
if ($params['isSignup']==1) {
if ($this->settings->get('Signup Completion URL') != '') {
$returnURL = $this->settings->get('Signup Completion URL'). '?success=1';
$returnURLCancel = $this->settings->get('Signup Completion URL');
} else {
$returnURL = $params["clientExecURL"]."/order.php?step=complete&pass=1";
$returnURLCancel = $params["clientExecURL"]."/order.php?step=3";
}
} else {
$returnURL = $params["invoiceviewURLSuccess"];
$returnURLCancel = $params["invoiceviewURLCancel"];
}
$data = [
'cmd' => '_pay',
'merchant' => $this->settings->get('plugin_coinpayments_Merchant ID'),
'reset' => '1',
'invoice' => $params['invoiceNumber'],
'item_name' => $params['invoiceDescription'],
'amountf' => $params['invoiceTotal'],
'currency' => $params['userCurrency'],
'email' => $params['userEmail'],
'first_name' => $params['userFirstName'],
'last_name' => $params['userLastName'],
'want_shipping' => '',
'ipn_url' => $params['clientExecURL'] . '/plugins/gateways/coinpayments/callback.php',
'success_url' => $returnURL,
'cancel_url' =>$returnURLCancel
];
$html = '<form id="frmCoinPayments" action="https://www.coinpayments.net/index.php" method="POST">';
foreach ($data as $name => $value) {
$html .= '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($value) . '" />';
}
$html .= '</form>';
$html .= "<script>document.forms['frmCoinPayments'].submit();</script>";
echo $html;
exit;
}
}