-
Notifications
You must be signed in to change notification settings - Fork 1
/
payment-shipping-option.js
94 lines (81 loc) · 2.2 KB
/
payment-shipping-option.js
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
import {PolymerElement} from '@polymer/polymer/polymer-element.js';
const $_documentContainer = document.createElement('template');
$_documentContainer.innerHTML = `<dom-module id="payment-shipping-option">
<template>
<style>
:host {
display: none;
}
</style>
</template>
</dom-module>`;
document.head.appendChild($_documentContainer.content);
export const PaymentShippingOption = class extends PolymerElement {
static get is() {
return 'payment-shipping-option';
}
static get properties() {
return {
id: String,
/**
* This is a human-readable description of the item.
* The user agent may display this to the user.
*/
label: String,
/**
* A valid decimal monetary value containing a monetary amount of the item.
*/
value: Number,
/**
* A string containing a currency identifier of the item.
* The value of currency can be any string that is valid within
* the currency system indicated by currencySystem.
*/
currency: String,
/**
* A URL that indicates the currency system
* that the currency identifier belongs to
*/
currencySystem: {
type: String,
value: 'urn:iso:std:iso:4217'
},
/**
* Contain the monetary amount for the item.
*/
amount: {
type: Object,
readOnly: true,
computed: '_computeAmount(value, currency, currencySystem)'
},
/**
* This is set to true to indicate that this is the default
* selected PaymentShippingOption in a sequence
*/
selected: {
type: Boolean,
value: false
},
dictionary: {
type: Object,
computed: '_computeDictionary(id, label, amount, selected)'
}
};
}
_computeAmount(value, currency, currencySystem) {
return {
value: value,
currency: currency,
currencySystem: currencySystem
};
}
_computeDictionary(id, label, amount, selected) {
return {
id: id,
label: label,
amount: amount,
selected: selected
};
}
};
window.customElements.define(PaymentShippingOption.is, PaymentShippingOption);