Skip to content

Commit 1bf81bf

Browse files
committed
init proejct
0 parents commit 1bf81bf

9 files changed

+616
-0
lines changed

assets/payments.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
function requestPayment(token) {
2+
if (typeof web3 !== 'undefined') {
3+
web3 = new Web3(web3.currentProvider);
4+
} else {
5+
alert("请先安装 Metamask !");
6+
}
7+
var xmlhttp;
8+
var formData = new FormData();
9+
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
10+
xmlhttp = new XMLHttpRequest();
11+
}
12+
else {// code for IE6, IE5
13+
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
14+
}
15+
xmlhttp.onreadystatechange = function () {
16+
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
17+
location.reload();
18+
}
19+
}
20+
var erc_contract = web3.eth.contract(abiArray);
21+
var erc_contract_instance = erc_contract.at(contract_address);
22+
console.log('目标钱包:',target_address)
23+
console.log('合约地址',contract_address)
24+
erc_contract_instance.transfer(target_address, token * 10e17,function(error,result){
25+
if (error === null && result !== null) {
26+
console.log("交易完成",result);
27+
formData.append('orderid',order_id);
28+
formData.append('tx',result);
29+
xmlhttp.open("POST", "/hook/wc_erc20", true);
30+
xmlhttp.send(formData);
31+
}
32+
})
33+
}

assets/web3.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

includes/create-new-currency.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
/**
3+
* 创建一个新的 Token
4+
*/
5+
add_filter('woocommerce_currencies', 'inkerk_add_my_currency');
6+
7+
function inkerk_add_my_currency($currencies) {
8+
$currencies['ERC20'] = 'ERC20';
9+
return $currencies;
10+
}
11+
12+
add_filter('woocommerce_currency_symbol', 'inkerk_add_my_currency_symbol', 10, 2);
13+
14+
function inkerk_add_my_currency_symbol($currency_symbol, $currency) {
15+
switch ($currency) {
16+
case 'ERC20':$currency_symbol = '𝘾';
17+
break;
18+
}
19+
return $currency_symbol;
20+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
function inkerk_erc20_add_settings_link($links) {
3+
$settings_link = '<a href="admin.php?page=wc-settings&tab=checkout">' . __('Settings') . '</a>';
4+
array_push($links, $settings_link);
5+
return $links;
6+
}
7+
add_filter("plugin_action_links_woocommerce-erc20-payment-gateway/woocommerce-erc20-payment-gateway.php", 'inkerk_erc20_add_settings_link');
3.25 KB
Binary file not shown.
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
msgid ""
2+
msgstr ""
3+
"Project-Id-Version: WooCommerce ERC20 Payment Gateway\n"
4+
"POT-Creation-Date: 2018-10-26 15:14+0800\n"
5+
"PO-Revision-Date: 2018-10-26 18:57+0800\n"
6+
"Last-Translator: Bestony <xiqingongzi@gmail.com>\n"
7+
"Language-Team: Bestony <xiqingongzi@gmail.com>\n"
8+
"Language: zh_CN\n"
9+
"MIME-Version: 1.0\n"
10+
"Content-Type: text/plain; charset=UTF-8\n"
11+
"Content-Transfer-Encoding: 8bit\n"
12+
"X-Generator: Poedit 1.8.1\n"
13+
"X-Poedit-Basepath: ..\n"
14+
"X-Poedit-WPHeader: woocommerce-erc20-payment-gateway.php\n"
15+
"X-Poedit-SourceCharset: UTF-8\n"
16+
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
17+
"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
18+
"_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
19+
"Plural-Forms: nplurals=1; plural=0;\n"
20+
"X-Poedit-SearchPath-0: .\n"
21+
"X-Poedit-SearchPathExcluded-0: *.js\n"
22+
23+
#: includes/register-plugin-settings.php:3
24+
msgid "Settings"
25+
msgstr "设置"
26+
27+
#: woocommerce-erc20-payment-gateway.php:41
28+
msgid "Order payment completed"
29+
msgstr "订单支付完成"
30+
31+
#: woocommerce-erc20-payment-gateway.php:61
32+
msgid "Pay with ERC20 Token"
33+
msgstr "使用 ERC20 Token 支付"
34+
35+
#: woocommerce-erc20-payment-gateway.php:62
36+
msgid "Use Token Payment"
37+
msgstr "使用 Token 完成支付"
38+
39+
#: woocommerce-erc20-payment-gateway.php:63
40+
msgid ""
41+
"If you want to use this Payment Gateway, We suggest you read <a href=\"#"
42+
"\">our guide </a> before."
43+
msgstr ""
44+
"如果您想使用此支付网关,我们建议您之前阅读<a href=“#”>我们的指南</a> 。"
45+
46+
#: woocommerce-erc20-payment-gateway.php:94
47+
msgid "Enable/Disable"
48+
msgstr "开启/关闭"
49+
50+
#: woocommerce-erc20-payment-gateway.php:95
51+
msgid "Enable ERC20 Payment Gateway"
52+
msgstr "启用ERC20支付网关"
53+
54+
#: woocommerce-erc20-payment-gateway.php:100
55+
msgid "Title"
56+
msgstr "标题"
57+
58+
#: woocommerce-erc20-payment-gateway.php:102
59+
msgid "Title Will Show at Checkout Page"
60+
msgstr "标题将在结帐页面显示"
61+
62+
#: woocommerce-erc20-payment-gateway.php:107
63+
msgid "Description"
64+
msgstr "描述"
65+
66+
#: woocommerce-erc20-payment-gateway.php:109
67+
msgid "Description Will Show at Checkout Page"
68+
msgstr "描述将在结帐页面显示"
69+
70+
#: woocommerce-erc20-payment-gateway.php:110
71+
msgid "Please make sure you already install Metamask && enable it."
72+
msgstr "请确保您已安装Metamask 并启用它。"
73+
74+
#: woocommerce-erc20-payment-gateway.php:113
75+
msgid "Wallet Address"
76+
msgstr "钱包地址"
77+
78+
#: woocommerce-erc20-payment-gateway.php:115
79+
msgid "Token Will Transfer into this Wallet"
80+
msgstr "Token 将转移到此钱包"
81+
82+
#: woocommerce-erc20-payment-gateway.php:118
83+
msgid "Contract ABI"
84+
msgstr "合约 ABI"
85+
86+
#: woocommerce-erc20-payment-gateway.php:120
87+
msgid "You Can get ABI From Etherscan.io"
88+
msgstr "你可以从 Etherscan 得到合约 ABI"
89+
90+
#: woocommerce-erc20-payment-gateway.php:123
91+
msgid "Contract Address"
92+
msgstr "合约地址"
93+
94+
#: woocommerce-erc20-payment-gateway.php:127
95+
msgid "Payment icon"
96+
msgstr "支付方式图标"
97+
98+
#: woocommerce-erc20-payment-gateway.php:130
99+
msgid "Image Height:25px"
100+
msgstr "建议图片高度:25px"
101+
102+
#: woocommerce-erc20-payment-gateway.php:173
103+
msgid "create order ,wait for payment"
104+
msgstr "订单创建完成,等待付款。"
105+
106+
#: woocommerce-erc20-payment-gateway.php:174
107+
msgid "Wait For Payment"
108+
msgstr "等待支付"
109+
110+
#: woocommerce-erc20-payment-gateway.php:185
111+
#, php-format
112+
msgid ""
113+
"<strong>%s</strong> is enabled and WooCommerce is not forcing the SSL "
114+
"certificate on your checkout page. Please ensure that you have a valid SSL "
115+
"certificate and that you are <a href=\"%s\">forcing the checkout pages to be "
116+
"secured.</a>"
117+
msgstr ""
118+
119+
#: woocommerce-erc20-payment-gateway.php:197
120+
msgid "<h2 class=\"h2thanks\">Use Metamask Pay this Order</h2>"
121+
msgstr "<h2 class=\"h2thanks\">使用 Metamask 支付订单</h2>"
122+
123+
#: woocommerce-erc20-payment-gateway.php:198
124+
msgid "Click Button Below, Pay this order.<br>"
125+
msgstr "点击下方的按钮,并支付订单.<br>"
126+
127+
#: woocommerce-erc20-payment-gateway.php:199
128+
msgid "Open Metamask"
129+
msgstr "打开 Metamask 支付"
130+
131+
#: woocommerce-erc20-payment-gateway.php:202
132+
msgid "<h2>Your Order is already Payment done.</h2>"
133+
msgstr "<h2>您的订单已经支付完成</h2>"
134+
135+
#: woocommerce-erc20-payment-gateway.php:209
136+
msgid "Please Pay for you order at bottom :)"
137+
msgstr "请留步,还剩下最后的支付!"
138+
139+
#. Plugin Name of the plugin/theme
140+
msgid "WooCommerce ERC20 Payment Gateway"
141+
msgstr "WooCommerce ERC20 Token 支付网关"
142+
143+
#. Plugin URI of the plugin/theme
144+
msgid "http://www.inkerk.com/woocommerce-erc20-payment-gateway"
145+
msgstr "http://www.inkerk.com/woocommerce-erc20-payment-gateway"
146+
147+
#. Description of the plugin/theme
148+
msgid "This Plugin will add ERC20 Token Payment Gateway"
149+
msgstr "这个插件将为你提供 ERC20 支付网关的支持。"
150+
151+
#. Author of the plugin/theme
152+
msgid "Inkerk Inc."
153+
msgstr "Inkerk Inc."
154+
155+
#. Author URI of the plugin/theme
156+
msgid "http://www.inkerk.com/"
157+
msgstr "http://www.inkerk.com/"
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
#, fuzzy
2+
msgid ""
3+
msgstr ""
4+
"Project-Id-Version: WooCommerce ERC20 Payment Gateway\n"
5+
"POT-Creation-Date: 2018-10-26 10:23+0800\n"
6+
"PO-Revision-Date: 2018-10-26 09:38+0800\n"
7+
"Last-Translator: Bestony <xiqingongzi@gmail.com>\n"
8+
"Language-Team: Bestony <xiqingongzi@gmail.com>\n"
9+
"MIME-Version: 1.0\n"
10+
"Content-Type: text/plain; charset=UTF-8\n"
11+
"Content-Transfer-Encoding: 8bit\n"
12+
"X-Generator: Poedit 1.8.1\n"
13+
"X-Poedit-Basepath: ..\n"
14+
"X-Poedit-WPHeader: woocommerce-erc20-payment-gateway.php\n"
15+
"X-Poedit-SourceCharset: UTF-8\n"
16+
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
17+
"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
18+
"_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
19+
"X-Poedit-SearchPath-0: .\n"
20+
"X-Poedit-SearchPathExcluded-0: *.js\n"
21+
22+
#: includes/register-plugin-settings.php:3
23+
msgid "Settings"
24+
msgstr ""
25+
26+
#: woocommerce-erc20-payment-gateway.php:41
27+
msgid "Order payment completed"
28+
msgstr ""
29+
30+
#: woocommerce-erc20-payment-gateway.php:61
31+
msgid "Pay with ERC20 Token"
32+
msgstr ""
33+
34+
#: woocommerce-erc20-payment-gateway.php:62
35+
msgid "Use Token Payment"
36+
msgstr ""
37+
38+
#: woocommerce-erc20-payment-gateway.php:63
39+
msgid ""
40+
"If you want to use this Payment Gateway, We suggest you read <a href=\"#"
41+
"\">our guide </a> before."
42+
msgstr ""
43+
44+
#: woocommerce-erc20-payment-gateway.php:94
45+
msgid "Enable/Disable"
46+
msgstr ""
47+
48+
#: woocommerce-erc20-payment-gateway.php:95
49+
msgid "Enable ERC20 Payment Gateway"
50+
msgstr ""
51+
52+
#: woocommerce-erc20-payment-gateway.php:100
53+
msgid "Title"
54+
msgstr ""
55+
56+
#: woocommerce-erc20-payment-gateway.php:102
57+
msgid "Title Will Show at Checkout Page"
58+
msgstr ""
59+
60+
#: woocommerce-erc20-payment-gateway.php:107
61+
msgid "Description"
62+
msgstr ""
63+
64+
#: woocommerce-erc20-payment-gateway.php:109
65+
msgid "Description Will Show at Checkout Page"
66+
msgstr ""
67+
68+
#: woocommerce-erc20-payment-gateway.php:110
69+
msgid "Please make sure you already install Metamask && enable it."
70+
msgstr ""
71+
72+
#: woocommerce-erc20-payment-gateway.php:113
73+
msgid "Wallet Address"
74+
msgstr ""
75+
76+
#: woocommerce-erc20-payment-gateway.php:115
77+
msgid "Token Will Transfer into this Wallet"
78+
msgstr ""
79+
80+
#: woocommerce-erc20-payment-gateway.php:118
81+
msgid "Contract ABI"
82+
msgstr ""
83+
84+
#: woocommerce-erc20-payment-gateway.php:120
85+
msgid "You Can get ABI From Etherscan.io"
86+
msgstr ""
87+
88+
#: woocommerce-erc20-payment-gateway.php:123
89+
msgid "Contract Address"
90+
msgstr ""
91+
92+
#: woocommerce-erc20-payment-gateway.php:127
93+
msgid "Payment icon"
94+
msgstr ""
95+
96+
#: woocommerce-erc20-payment-gateway.php:130
97+
msgid "Image Height:25px"
98+
msgstr ""
99+
100+
#: woocommerce-erc20-payment-gateway.php:173
101+
msgid "create order ,wait for payment"
102+
msgstr ""
103+
104+
#: woocommerce-erc20-payment-gateway.php:174
105+
msgid "Wait For Payment"
106+
msgstr ""
107+
108+
#: woocommerce-erc20-payment-gateway.php:185
109+
#, php-format
110+
msgid ""
111+
"<strong>%s</strong> is enabled and WooCommerce is not forcing the SSL "
112+
"certificate on your checkout page. Please ensure that you have a valid SSL "
113+
"certificate and that you are <a href=\"%s\">forcing the checkout pages to be "
114+
"secured.</a>"
115+
msgstr ""
116+
117+
#: woocommerce-erc20-payment-gateway.php:197
118+
msgid "<h2 class=\"h2thanks\">Use Metamask Pay this Order</h2>"
119+
msgstr ""
120+
121+
#: woocommerce-erc20-payment-gateway.php:198
122+
msgid "Click Button Below, Pay this order.<br>"
123+
msgstr ""
124+
125+
#: woocommerce-erc20-payment-gateway.php:199
126+
msgid "Open Metamask"
127+
msgstr ""
128+
129+
#: woocommerce-erc20-payment-gateway.php:202
130+
msgid "<h2>Your Order is already Payment done.</h2>"
131+
msgstr ""
132+
133+
#: woocommerce-erc20-payment-gateway.php:209
134+
msgid "Please Pay for you order at bottom :)"
135+
msgstr ""
136+
137+
#. Plugin Name of the plugin/theme
138+
msgid "WooCommerce ERC20 Payment Gateway"
139+
msgstr ""
140+
141+
#. Plugin URI of the plugin/theme
142+
msgid "http://www.inkerk.com/woocommerce-erc20-payment-gateway"
143+
msgstr ""
144+
145+
#. Description of the plugin/theme
146+
msgid "This Plugin will add ERC20 Token Payment Gateway"
147+
msgstr ""
148+
149+
#. Author of the plugin/theme
150+
msgid "Inkerk Inc."
151+
msgstr ""
152+
153+
#. Author URI of the plugin/theme
154+
msgid "http://www.inkerk.com/"
155+
msgstr ""

0 commit comments

Comments
 (0)