Skip to content

Commit 0448cfe

Browse files
committed
Merge pull request #19 from jeffharrell/master
Fix for #18
2 parents 53e0361 + 7e27cab commit 0448cfe

7 files changed

Lines changed: 25 additions & 16 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,13 @@ All of PayPal's [HTML button variables](https://cms.paypal.com/us/cgi-bin/?cmd=_
6868
* `data-name` Description of the item.
6969
* `data-number` The number of the item.
7070
* `data-amount` The price of the item.
71+
* `data-currency` The currency of the item (note: these cannot be mixed).
7172
* `data-quantity` Quantity of items to purchase.
7273
* `data-shipping` The cost of shipping this item.
7374
* `data-tax` Transaction-based tax override variable.
7475
* `data-size` For button images: `small` and `large` work. For QR codes enter the pixel length of the longest side.
76+
* `data-locale` The desired locale of the PayPal site.
77+
7578

7679
## Editable fields
7780
Creating editable fields is easy! Just add `-editable` to the name of your variable, e.g. `data-quantity-editable`, and an input field will magically appear for your users.

dist/paypal-button-minicart.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*!
22
* PayPalJSButtons
33
* JavaScript integration for PayPal's payment buttons
4-
* @version 1.0.0 - 2013-03-15
4+
* @version 1.0.0 - 2013-03-17
55
* @author Jeff Harrell <https://github.com/jeffharrell/>
66
*/
77
/*!
@@ -1756,7 +1756,8 @@ PAYPAL.apps = PAYPAL.apps || {};
17561756
prettyParams = {
17571757
name: 'item_name',
17581758
number: 'item_number',
1759-
lang: 'lc',
1759+
locale: 'lc',
1760+
currency: 'currency_code',
17601761
recurrence: 'p3',
17611762
period: 't3'
17621763
},
@@ -1993,7 +1994,7 @@ PAYPAL.apps = PAYPAL.apps || {};
19931994
for (i = 0, len = attrs.length; i < len; i++) {
19941995
attr = attrs[i];
19951996

1996-
if ((matches = /^data-([a-z0-9]+)(-editable)?/i.exec(attr.name))) {
1997+
if ((matches = /^data-([a-z0-9_]+)(-editable)?/i.exec(attr.name))) {
19971998
dataset[matches[1]] = {
19981999
value: attr.value,
19992000
isEditable: !!matches[2]

dist/paypal-button-minicart.min.js

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

dist/paypal-button.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*!
22
* PayPalJSButtons
33
* JavaScript integration for PayPal's payment buttons
4-
* @version 1.0.0 - 2013-03-15
4+
* @version 1.0.0 - 2013-03-17
55
* @author Jeff Harrell <https://github.com/jeffharrell/>
66
*/
77
if (typeof PAYPAL === 'undefined' || !PAYPAL) {
@@ -23,7 +23,8 @@ PAYPAL.apps = PAYPAL.apps || {};
2323
prettyParams = {
2424
name: 'item_name',
2525
number: 'item_number',
26-
lang: 'lc',
26+
locale: 'lc',
27+
currency: 'currency_code',
2728
recurrence: 'p3',
2829
period: 't3'
2930
},
@@ -260,7 +261,7 @@ PAYPAL.apps = PAYPAL.apps || {};
260261
for (i = 0, len = attrs.length; i < len; i++) {
261262
attr = attrs[i];
262263

263-
if ((matches = /^data-([a-z0-9]+)(-editable)?/i.exec(attr.name))) {
264+
if ((matches = /^data-([a-z0-9_]+)(-editable)?/i.exec(attr.name))) {
264265
dataset[matches[1]] = {
265266
value: attr.value,
266267
isEditable: !!matches[2]

dist/paypal-button.min.js

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

src/paypal-button.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ PAYPAL.apps = PAYPAL.apps || {};
1717
prettyParams = {
1818
name: 'item_name',
1919
number: 'item_number',
20-
lang: 'lc',
20+
locale: 'lc',
21+
currency: 'currency_code',
2122
recurrence: 'p3',
2223
period: 't3'
2324
},
@@ -254,7 +255,7 @@ PAYPAL.apps = PAYPAL.apps || {};
254255
for (i = 0, len = attrs.length; i < len; i++) {
255256
attr = attrs[i];
256257

257-
if ((matches = /^data-([a-z0-9]+)(-editable)?/i.exec(attr.name))) {
258+
if ((matches = /^data-([a-z0-9_]+)(-editable)?/i.exec(attr.name))) {
258259
dataset[matches[1]] = {
259260
value: attr.value,
260261
isEditable: !!matches[2]

test/index.html

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ <h2>Buy Now (Spanish)</h2>
3131
data-button="buynow"
3232
data-name="Buy now!"
3333
data-amount="1.00"
34-
data-lang="es_ES"
34+
data-locale="es_ES"
35+
data-currency_code="EUR"
3536
></script>
3637
</div>
3738

@@ -41,7 +42,8 @@ <h2>Buy Now (French)</h2>
4142
data-button="buynow"
4243
data-name="Buy now!"
4344
data-amount="1.00"
44-
data-lang="fr_FR"
45+
data-locale="fr_FR"
46+
data-currency_code="EUR"
4547
></script>
4648
</div>
4749

@@ -51,7 +53,8 @@ <h2>Buy Now (German)</h2>
5153
data-button="buynow"
5254
data-name="Buy now!"
5355
data-amount="1.00"
54-
data-lang="de_DE"
56+
data-locale="de_DE"
57+
data-currency_code="EUR"
5558
></script>
5659
</div>
5760

@@ -62,7 +65,7 @@ <h2>Buy Now (Editable)</h2>
6265
data-name-editable="Buy now!"
6366
data-amount="1.00"
6467
data-quantity-editable="1"
65-
data-lang="en_US"
68+
data-locale="en_US"
6669
></script>
6770
</div>
6871

0 commit comments

Comments
 (0)