Add CVV field to payment card update form

This commit is contained in:
L. Bradley LaBoon 2021-03-30 17:02:12 -04:00
parent 498eda243d
commit 1b0727722f
2 changed files with 9 additions and 0 deletions

View File

@ -22,6 +22,7 @@ import { settings, elements, apiGet, apiPost, parseParams, setupHeader } from "/
// Element names specific to this page // Element names specific to this page
elements.ccCurrent = "cc-current"; elements.ccCurrent = "cc-current";
elements.ccNew = "cc-new"; elements.ccNew = "cc-new";
elements.cvv = "cvv";
elements.expiryCurrent = "expiry-current"; elements.expiryCurrent = "expiry-current";
elements.expiryMonth = "expiry-month"; elements.expiryMonth = "expiry-month";
elements.expiryYear = "expiry-year"; elements.expiryYear = "expiry-year";
@ -34,6 +35,7 @@ import { settings, elements, apiGet, apiPost, parseParams, setupHeader } from "/
var ui = {}; var ui = {};
ui.ccCurrent = {}; ui.ccCurrent = {};
ui.ccNew = {}; ui.ccNew = {};
ui.cvv = {};
ui.expiryCurrent = {}; ui.expiryCurrent = {};
ui.expiryMonth = {}; ui.expiryMonth = {};
ui.expiryYear = {}; ui.expiryYear = {};
@ -57,6 +59,7 @@ import { settings, elements, apiGet, apiPost, parseParams, setupHeader } from "/
var req = { var req = {
"card_number": ui.ccNew.value, "card_number": ui.ccNew.value,
"cvv": ui.cvv.value,
"expiry_month": parseInt(ui.expiryMonth.value), "expiry_month": parseInt(ui.expiryMonth.value),
"expiry_year": parseInt(ui.expiryYear.value) "expiry_year": parseInt(ui.expiryYear.value)
}; };
@ -78,6 +81,7 @@ import { settings, elements, apiGet, apiPost, parseParams, setupHeader } from "/
// Get element references // Get element references
ui.ccCurrent = document.getElementById(elements.ccCurrent); ui.ccCurrent = document.getElementById(elements.ccCurrent);
ui.ccNew = document.getElementById(elements.ccNew); ui.ccNew = document.getElementById(elements.ccNew);
ui.cvv = document.getElementById(elements.cvv);
ui.expiryCurrent = document.getElementById(elements.expiryCurrent); ui.expiryCurrent = document.getElementById(elements.expiryCurrent);
ui.expiryMonth = document.getElementById(elements.expiryMonth); ui.expiryMonth = document.getElementById(elements.expiryMonth);
ui.expiryYear = document.getElementById(elements.expiryYear); ui.expiryYear = document.getElementById(elements.expiryYear);

View File

@ -58,6 +58,11 @@ along with Linode Manager Classic. If not, see <https://www.gnu.org/licenses/>.
<td><input id="cc-new" type="text" /></td> <td><input id="cc-new" type="text" /></td>
<td class="info">Linode accepts Visa, MasterCard, American Express, and Discover</td> <td class="info">Linode accepts Visa, MasterCard, American Express, and Discover</td>
</tr> </tr>
<tr class="lmc-tr3">
<td>CVV</td>
<td><input id="cvv" type="text" size="8" /></td>
<td></td>
</tr>
<tr class="lmc-tr3"> <tr class="lmc-tr3">
<td>Expires</td> <td>Expires</td>
<td> <td>