Skip to content

Commit

Permalink
fix: Correção em script no formulário legado #12
Browse files Browse the repository at this point in the history
  • Loading branch information
GuilhermeLinkNacional committed Sep 18, 2024
1 parent e6e199e commit 806edcb
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 46 deletions.
50 changes: 27 additions & 23 deletions Public/LknPaymentEredeForGivewpCreditGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,29 +320,33 @@ final public static function credit_card_form($form_id, $args) {
<input type="hidden" name="gatewayData[paymentTimezoneOffset]" value="" />

<script type="text/javascript">
const language = window.navigator.language.slice(0, 2)
const height = screen.height
const width = screen.width
const colorDepth = window.screen.colorDepth
const userAgent = navigator.userAgent
const date = new Date()
const timezoneOffset = date.getTimezoneOffset()

const userAgentInput = document.getElementsByName('gatewayData[paymentUserAgent]')[0]
const deviceColorInput = document.getElementsByName('gatewayData[paymentColorDepth]')[0]
const langInput = document.getElementsByName('gatewayData[paymentLanguage]')[0]
const heightInput = document.getElementsByName('gatewayData[paymentHeight]')[0]
const widthInput = document.getElementsByName('gatewayData[paymentWidth]')[0]
const timezoneInput = document.getElementsByName('gatewayData[paymentTimezoneOffset]')[0]

if (userAgentInput && deviceColorInput && langInput && heightInput && widthInput && timezoneInput) {
userAgentInput.value = userAgent
deviceColorInput.value = colorDepth
langInput.value = language
heightInput.value = height
widthInput.value = width
timezoneInput.value = timezoneOffset
}
function setCreditInfo() {
const language = window.navigator.language.slice(0, 2)
const height = screen.height
const width = screen.width
const colorDepth = window.screen.colorDepth
const userAgent = navigator.userAgent
const date = new Date()
const timezoneOffset = date.getTimezoneOffset()

const userAgentInput = document.getElementsByName('gatewayData[paymentUserAgent]')[0]
const deviceColorInput = document.getElementsByName('gatewayData[paymentColorDepth]')[0]
const langInput = document.getElementsByName('gatewayData[paymentLanguage]')[0]
const heightInput = document.getElementsByName('gatewayData[paymentHeight]')[0]
const widthInput = document.getElementsByName('gatewayData[paymentWidth]')[0]
const timezoneInput = document.getElementsByName('gatewayData[paymentTimezoneOffset]')[0]

if (userAgentInput && deviceColorInput && langInput && heightInput && widthInput && timezoneInput) {
userAgentInput.value = userAgent
deviceColorInput.value = colorDepth
langInput.value = language
heightInput.value = height
widthInput.value = width
timezoneInput.value = timezoneOffset
}
}

setCreditInfo()
</script>

<!-- CARD NUMBER INPUT -->
Expand Down
50 changes: 27 additions & 23 deletions Public/LknPaymentEredeForGivewpDebitGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,29 +296,33 @@ final public static function debit_card_form($form_id, $args) {
<input type="hidden" name="gatewayData[paymentTimezoneOffset]" value="" />

<script type="text/javascript">
const language = window.navigator.language.slice(0, 2)
const height = screen.height
const width = screen.width
const colorDepth = window.screen.colorDepth
const userAgent = navigator.userAgent
const date = new Date()
const timezoneOffset = date.getTimezoneOffset()

const userAgentInput = document.getElementsByName('gatewayData[paymentUserAgent]')[0]
const deviceColorInput = document.getElementsByName('gatewayData[paymentColorDepth]')[0]
const langInput = document.getElementsByName('gatewayData[paymentLanguage]')[0]
const heightInput = document.getElementsByName('gatewayData[paymentHeight]')[0]
const widthInput = document.getElementsByName('gatewayData[paymentWidth]')[0]
const timezoneInput = document.getElementsByName('gatewayData[paymentTimezoneOffset]')[0]

if (userAgentInput && deviceColorInput && langInput && heightInput && widthInput && timezoneInput) {
userAgentInput.value = userAgent
deviceColorInput.value = colorDepth
langInput.value = language
heightInput.value = height
widthInput.value = width
timezoneInput.value = timezoneOffset
}
function setDebitInfo() {
const language = window.navigator.language.slice(0, 2)
const height = screen.height
const width = screen.width
const colorDepth = window.screen.colorDepth
const userAgent = navigator.userAgent
const date = new Date()
const timezoneOffset = date.getTimezoneOffset()

const userAgentInput = document.getElementsByName('gatewayData[paymentUserAgent]')[0]
const deviceColorInput = document.getElementsByName('gatewayData[paymentColorDepth]')[0]
const langInput = document.getElementsByName('gatewayData[paymentLanguage]')[0]
const heightInput = document.getElementsByName('gatewayData[paymentHeight]')[0]
const widthInput = document.getElementsByName('gatewayData[paymentWidth]')[0]
const timezoneInput = document.getElementsByName('gatewayData[paymentTimezoneOffset]')[0]

if (userAgentInput && deviceColorInput && langInput && heightInput && widthInput && timezoneInput) {
userAgentInput.value = userAgent
deviceColorInput.value = colorDepth
langInput.value = language
heightInput.value = height
widthInput.value = width
timezoneInput.value = timezoneOffset
}
}

setDebitInfo()
</script>

<!-- CARD NUMBER INPUT -->
Expand Down

0 comments on commit 806edcb

Please sign in to comment.