Skip to content

Commit

Permalink
📃 Rename: mcToken < mpToken
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashu11-A committed Mar 10, 2024
1 parent 5737226 commit f973e9c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/discord/components/config/functions/mercadoPago.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export async function mcConfig (options: {
const taxaCardCredit = fields.getTextInputValue('taxaCardCredit')

if (token !== undefined && token !== '') {
await new Database({ interaction, pathDB: 'config.mcToken', typeDB: 'payments' }).set({
await new Database({ interaction, pathDB: 'config.mpToken', typeDB: 'payments' }).set({
data: token,
text: 'setado para autenticação'
})
Expand Down
4 changes: 2 additions & 2 deletions src/discord/components/config/modals/mpModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ export async function MpModalconfig (options: {
custom_id: 'token',
label: 'Token',
placeholder:
data?.mcToken === undefined
data?.mpToken === undefined
? 'Não compartilhe isso com ninguém.'
: 'Já configurado...',
style: 1,
required: data?.mcToken === undefined
required: data?.mpToken === undefined
})
]
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class PaymentFunction {
const paymentId = await db.payments.get(`${guildId}.process.${channelId}.paymentId`)

if (paymentId !== undefined) {
const token = await db.payments.get(`${guildId}.config.mcToken`)
const token = await db.payments.get(`${guildId}.config.mpToken`)

await axios.post(`http://${settings().Express.ip}:${settings().Express.Port}/payment/delete`, {
mpToken: token,
Expand Down Expand Up @@ -328,15 +328,15 @@ export class PaymentFunction {
const { guildId, message, user, guild, member, channelId } = interaction
const cartData = await db.payments.get(`${guildId}.process.${channelId}`) as cartData
const tokenAuth = await db.tokens.get('token')
const { mcToken, logs } = await db.payments.get(`${guildId}.config`) as { mcToken: string | undefined, logs: string | undefined }
const { mpToken, logs } = await db.payments.get(`${guildId}.config`) as { mpToken: string | undefined, logs: string | undefined }
const valorTotal: number = cartData.products.reduce((allValue, product) => allValue + (product.quantity * product.amount), 0) ?? 0
const coinsTotal: number = cartData.products.reduce((allCoins, product) => allCoins + (((product?.coins ?? 0) * product.quantity) ?? 0), 0) ?? 0
const productsTotal: string = cartData.products.map((product) => product.name).join(' - ')
const logChannel = guild.channels.cache.get(String(logs)) as TextChannel

if (cartData?.paymentId !== undefined) {
const pagamentoRes = await axios.post(`http://${settings().Express.ip}:${settings().Express.Port}/payment`, {
mpToken: mcToken,
mpToken,
paymentId: cartData.paymentId
})
.then((res) => res)
Expand Down
6 changes: 3 additions & 3 deletions src/discord/components/payments/functions/createPayment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export async function createPayment (options: {
) ?? 0
const amountTax =
Math.round((amount + amount * (Number(tax) / 100)) * 100) / 100 // Pode receber numeros quebrados por isso do "* 100) / 100"
const { mcToken, ipn } = await db.payments.get(`${guildId}.config`)
const { mpToken, ipn } = await db.payments.get(`${guildId}.config`)
const PaymentBuilder = new PaymentFunction({ interaction })

let embeds: Array<APIEmbed | JSONEncodable<APIEmbed>> = [] // Inicialize embeds como um array vazio
Expand All @@ -54,7 +54,7 @@ export async function createPayment (options: {
const dataPix: infoPayment = {
userName: user.username,
userId: user.id,
mpToken: mcToken,
mpToken,
channelId,
guildId,
UUID: cartData.UUID as string,
Expand Down Expand Up @@ -150,7 +150,7 @@ export async function createPayment (options: {
const dataCart: infoPayment = {
userName: user.username,
userId: user.id,
mpToken: mcToken,
mpToken,
channelId,
guildId,
UUID: cartData.UUID as string,
Expand Down
2 changes: 1 addition & 1 deletion src/express/routes/payment/ipn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class IPN {
const cartData = await db.payments.get(`${guildId}.process.${channelId}`)

if (cartData?.UUID === UUID) {
const token = await db.payments.get(`${guildId}.config.mcToken`)
const token = await db.payments.get(`${guildId}.config.mpToken`)
const client = new MercadoPagoConfig({ accessToken: token })
const status = await new Payment(client).get(data.id)

Expand Down

0 comments on commit f973e9c

Please sign in to comment.