forked from secretrobotron/component-paypal
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcomponent.html
73 lines (72 loc) · 2.71 KB
/
component.html
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
<polymer-element name="ceci-paypal" attributes="amount account currency" extends="ceci-element" currency="BRL" amount="5" account="[email protected]" button="false">
<ceci-definition>
{
"name": "PayPal",
"description": "Donates to the cause of your choice through PayPal.",
"tags": ["paypal", "donate"],
"thumbnail": "./thumbnail.png",
"broadcasts": {
"donate": {
"label": "Donate",
"description": "Occurs when donation process begins."
}
},
"listeners": {
"submit": {
"description": "Submits a donation once settings have been chosen.",
"label": "Submit",
"default": "orange"
}
},
"attributes": {
"amount": {
"label": "Amount",
"description": "Amount of money to donate.",
"editable": "number",
"listener": true,
"max": 3,
"min": 50
},
"account": {
"label": "Account",
"description": "PayPal account which will receive payment.",
"editable": "text"
},
"currency": {
"label": "Currency",
"description": "Currency code for donation amount.",
"editable": "text"
}
}
}
</ceci-definition>
<template>
<link rel="stylesheet" href="component.css"></link>
<h3><span id="donationAmount">Donation Amount:</span> <span>{{amount}}</span> <span>{{currency}}</span></h3>
<p id="account">{{account}}</p>
<form id="form" method="post" action="https://www.paypal.com/cgi-bin/webscr">
<input type="hidden" name="amount" id="pp_amount" value="{{amount}}" />
<input type="hidden" name="business" id="pp_business" value="{{account}}" />
<input type="hidden" name="currency_code" id="pp_currency_code" value="{{currency}}" />
<input type="hidden" name="item_name" id="fundrasingCampaignName" value="Donation from AppMaker App" />
<input type="hidden" name="no_shipping" value="1"/>
<input type="hidden" name="rm" value="1"/>
<input type="hidden" name="cmd" value="_donations" /> <!-- TODO - could switch between donation and payments -->
<input type="hidden" name="return" value="" /> <!-- Return url is the current app url with query param to tell success -->
</form>
<img src="thumbnail.png">
<shadow></shadow>
</template>
<script>
Polymer('ceci-paypal', {
ready: function () {
this.super();
this.$.donationAmount.textContent = this.gettext(this.localName + "/donationAmount") || this.$.donationAmount.textContent;
},
submit: function (value) {
this.$.form.submit();
this.broadcast('donate');
}
});
</script>
</polymer-element>