form.phtml 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. // @codingStandardsIgnoreFile
  7. /** @var \Magento\Payment\Block\Transparent\Form $block */
  8. $code = $block->escapeHtml($block->getMethodCode());
  9. $ccExpMonth = $block->getInfoData('cc_exp_month');
  10. $ccExpYear = $block->getInfoData('cc_exp_year');
  11. $ccType = $block->getInfoData('cc_type');
  12. $content = '<img src=\"' . $block->getViewFileUrl('Magento_Checkout::cvv.png') . '\" alt=\"' .
  13. $block->escapeHtml(__('Card Verification Number Visual Reference')) . '\" title=\"' .
  14. $block->escapeHtml(__('Card Verification Number Visual Reference')) . '\" />';
  15. ?>
  16. <!-- IFRAME for request to Payment Gateway -->
  17. <iframe width="0" height="0" id="<?= /* @noescape */ $code ?>-transparent-iframe"
  18. data-container="<?= /* @noEscape */ $code ?>-transparent-iframe" allowtransparency="true"
  19. frameborder="0" name="iframeTransparent" style="display:none;width:100%;background-color:transparent"
  20. src="<?= $block->escapeUrl($block->getViewFileUrl('blank.html')) ?>"></iframe>
  21. <form class="form" id="co-transparent-form" action="#" method="post" data-mage-init='{
  22. "transparent":{
  23. "controller":"<?= $block->escapeHtml($block->getRequest()->getControllerName()) ?>",
  24. "gateway":"<?= /* @noEscape */ $code ?>",
  25. "orderSaveUrl":"<?= $block->escapeUrl($block->getOrderUrl()) ?>",
  26. "cgiUrl":"<?= $block->escapeUrl($block->getCgiUrl()) ?>",
  27. "dateDelim":"<?= $block->escapeHtml($block->getDateDelim()) ?>",
  28. "cardFieldsMap":<?= $block->escapeHtml($block->getCardFieldsMap()) ?>,
  29. "nativeAction":"<?= $block->escapeUrl($block->getUrl('checkout/onepage/saveOrder', ['_secure' => $block->getRequest()->isSecure()])) ?>"
  30. }, "validation":[]}'>
  31. <fieldset class="fieldset ccard <?= /* @noEscape */ $code ?>" id="payment_form_<?= /* @noEscape */ $code ?>">
  32. <legend class="legend">
  33. <span><?= $block->escapeHtml(__('Credit Card Information')) ?></span>\
  34. </legend><br />
  35. <div class="field required type">
  36. <label for="<?= /* @noEscape */ $code ?>_cc_type" class="label">
  37. <span><?= $block->escapeHtml(__('Credit Card Type')) ?></span>
  38. </label>
  39. <div class="control">
  40. <select id="<?= /* @noEscape */ $code ?>_cc_type" data-container="<?= /* @noEscape */ $code ?>-cc-type"
  41. name="payment[cc_type]"
  42. data-validate='{
  43. required:true,
  44. "validate-cc-type-select":"#<?= /* @noEscape */ $code ?>_cc_number"
  45. }'>
  46. <option value=""><?= $block->escapeHtml(__('--Please Select--')) ?></option>
  47. <?php foreach ($block->getCcAvailableTypes() as $typeCode => $typeName): ?>
  48. <option value="<?= $block->escapeHtml($typeCode) ?>"
  49. <?php if ($typeCode == $ccType): ?> selected="selected"<?php endif; ?>>
  50. <?= $block->escapeHtml($typeName) ?></option>
  51. <?php endforeach ?>
  52. </select>
  53. </div>
  54. </div>
  55. <div class="field required number">
  56. <label for="<?= /* @noEscape */ $code ?>_cc_number" class="label">
  57. <span><?= $block->escapeHtml(__('Credit Card Number')) ?></span>
  58. </label>
  59. <div class="control">
  60. <input type="number" id="<?= /* @noEscape */ $code ?>_cc_number"
  61. data-container="<?= /* @noEscape */ $code ?>-cc-number" name="payment[cc_number]"
  62. title="<?= $block->escapeHtml(__('Credit Card Number')) ?>" class="input-text" value=""
  63. data-validate='{
  64. "required-number":true,
  65. "validate-cc-number":"#<?= /* @noEscape */ $code ?>_cc_type",
  66. "validate-cc-type":"#<?= /* @noEscape */ $code ?>_cc_type"
  67. }'
  68. autocomplete="off"/>
  69. </div>
  70. </div>
  71. <div class="field required date" id="<?= /* @noEscape */ $code ?>_cc_type_exp_div">
  72. <label for="<?= /* @noEscape */ $code ?>_expiration" class="label">
  73. <span><?= $block->escapeHtml(__('Expiration Date')) ?></span>
  74. </label>
  75. <div class="control">
  76. <div class="fields group group-2">
  77. <div class="field no-label month">
  78. <div class="control">
  79. <select id="<?= /* @noEscape */ $code ?>_expiration" name="payment[cc_exp_month]"
  80. data-container="<?= /* @noEscape */ $code ?>-cc-month" class="month"
  81. data-validate='{
  82. required:true,
  83. "validate-cc-exp":"#<?= /* @noEscape */ $code ?>_expiration_yr"
  84. }'>
  85. <?php foreach ($block->getCcMonths() as $k => $v): ?>
  86. <option value="<?= /* @noEscape */ $k ? $block->escapeHtml($k) : '' ?>"
  87. <?php if ($k == $ccExpMonth): ?> selected="selected"<?php endif; ?>>
  88. <?= $block->escapeHtml($v) ?>
  89. </option>
  90. <?php endforeach ?>
  91. </select>
  92. </div>
  93. </div>
  94. <div class="field no-label year">
  95. <div class="control">
  96. <select id="<?= /* @noEscape */ $code ?>_expiration_yr" name="payment[cc_exp_year]"
  97. class="year" data-container="<?= /* @noEscape */ $code ?>-cc-year"
  98. data-validate='{required:true}'>
  99. <?php foreach ($block->getCcYears() as $k => $v): ?>
  100. <option value="<?= /* @noEscape */ $k ? $block->escapeHtml($k) : '' ?>"
  101. <?php if ($k == $ccExpYear): ?> selected="selected"<?php endif; ?>>
  102. <?= $block->escapeHtml($v) ?>
  103. </option>
  104. <?php endforeach ?>
  105. </select>
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. </div>
  111. <?php if ($block->hasVerification()): ?>
  112. <div class="field required cvv" id="<?= /* @noEscape */ $code ?>_cc_type_cvv_div">
  113. <label for="<?= /* @noEscape */ $code ?>_cc_cid" class="label">
  114. <span><?= $block->escapeHtml(__('Card Verification Number')) ?></span>
  115. </label>
  116. <div class="control">
  117. <input type="number" title="<?= $block->escapeHtml(__('Card Verification Number')) ?>"
  118. data-container="<?= /* @noEscape */ $code ?>-cc-cvv" class="input-text cvv"
  119. id="<?= /* @noEscape */ $code ?>_cc_cid" name="payment[cc_cid]" value=""
  120. data-validate='{
  121. "required-number":true,
  122. "validate-cc-cvn":"#<?= /* @noEscape */ $code ?>_cc_type"
  123. }' autocomplete="off"/>
  124. <div class="note">
  125. <a href="#" id="<?= /* @noEscape */ $code ?>-cvv-what-is-this" class="action cvv"
  126. title="<?= $block->escapeHtml(__('What is this?')) ?>" data-mage-init='{
  127. "tooltip": {"content": "<?= /* @noEscape */ $content ?>"}
  128. }'>
  129. <span><?= $block->escapeHtml(__('What is this?')) ?></span>
  130. </a>
  131. </div>
  132. </div>
  133. </div>
  134. <?php endif; ?>
  135. <?= $block->getChildHtml() ?>
  136. </fieldset>
  137. </form>