Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
mclmax committed Oct 31, 2024
1 parent ef84f1b commit 55aa2b0
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 31 deletions.
2 changes: 1 addition & 1 deletion canarytokens/credit_card_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Customer:
class CreditCardTrigger(BaseModel):
canarytoken: Canarytoken
masked_card_number: Optional[str]
merchant: Optional[dict]
merchant: Optional[str]
transaction_amount: Optional[str]
transaction_currency: Optional[str]
transaction_date: Optional[str]
Expand Down
2 changes: 1 addition & 1 deletion canarytokens/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1726,7 +1726,7 @@ class WireguardTokenHit(TokenHit):


class CreditCardV2AdditionalInfo(BaseModel):
merchant: Optional[dict]
merchant: Optional[str]
transaction_amount: Optional[str]
transaction_currency: Optional[str]
masked_card_number: Optional[str]
Expand Down
6 changes: 6 additions & 0 deletions canarytokens/tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,12 @@ def _parse_credit_card_v2_trigger(
request: Request,
) -> CreditCardV2TokenHit:
request_data = json.loads(request.content.read().decode())

merchant = request_data["merchant"]
request_data[
"merchant"
] = f"{merchant.get('name')}, {merchant.get('city')}, {merchant.get('country')}"

trigger_data = CreditCardTrigger(**request_data)

hit_time = datetime.utcnow().strftime("%s.%f")
Expand Down
6 changes: 3 additions & 3 deletions frontend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1231,9 +1231,9 @@ def _(
auth=download_request_details.auth,
content=textwrap.dedent(
f"""
Name on card: {canarydrop.cc_v2_name_on_card}
Card number: {canarydrop.cc_v2_card_number}
Expiry: {canarydrop.cc_v2_expiry_month}/{canarydrop.cc_v2_expiry_year}
Card Name: {canarydrop.cc_v2_name_on_card}
Card Number: {canarydrop.cc_v2_card_number}
Expires: {canarydrop.cc_v2_expiry_month}/{canarydrop.cc_v2_expiry_year}
CVV: {canarydrop.cc_v2_cvv}
"""
).strip(),
Expand Down
42 changes: 21 additions & 21 deletions frontend_vue/src/components/base/BaseContentBlock.vue
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
<template>
<span
class="content-block flex items-center justify-between gap-8 sm:gap-24 py-8 px-[1em] text-grey-500 border border-grey-100 rounded-xl bg-white hover:text-grey-700">
<div class="flex items-center">
<font-awesome-icon class="text-grey-200 mr-8 sm:mr-[.75em] text-lg sm:text-xl" aria-hidden="true" :icon="iconName" />
<div>
<span class="block text-xs font-light text-grey-800 mb-1.5">{{ props.label }}</span>
<span class="block text-grey-800 font-medium" :class="{ copied }">{{ props.text }}</span>
</div>
</div>
<BaseCopyButton v-if="copyContent" :content="props.text" class="ring-white ring-4" @click="handleCopyText()" />
</span>
<span
class="content-block flex items-center justify-between gap-8 sm:gap-24 py-8 px-[1em] text-grey-500 border border-grey-100 rounded-xl bg-white hover:text-grey-700">
<div class="flex items-center">
<font-awesome-icon class="min-w-[32px] text-grey-200 text-lg sm:text-xl mr-[8px]" aria-hidden="true" :icon="iconName" />
<div>
<span class="block text-xs font-light text-grey-800 mb-1.5">{{ props.label }}</span>
<span class="block text-grey-800 font-medium" :class="{ copied }">{{ props.text }}</span>
</div>
</div>
<BaseCopyButton v-if="copyContent" :content="props.text" class="ring-white ring-4" @click="handleCopyText()" />
</span>
</template>

<script setup lang="ts">
import { ref } from "vue";
const props = defineProps<{
label: string;
text: string;
copyContent: boolean;
iconName: string;
label: string;
text: string;
copyContent: boolean;
iconName: string;
}>();
const copied = ref(false)
const handleCopyText = () => {
copied.value = true;
setTimeout(() => {
copied.value = false;
}, 1750);
copied.value = true;
setTimeout(() => {
copied.value = false;
}, 1750);
}
</script>
<style lang="scss" scoped>
span.copied {
background-color: #0393b3;
color: white;
background-color: #0393b3;
color: white;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<TokenDisplay v-else :token-data="tokenData" />
<base-message-box
class="mt-24" variant="info"
:message="`If the card is ever used in an authorization, the transaction will be declined, but you will be alerted.'`" />
:message="`If the card is ever used in an authorization, the transaction will be declined, but you will be alerted.`" />
<p class="mt-24 text-sm"></p>
</template>

Expand Down
4 changes: 2 additions & 2 deletions frontend_vue/src/components/ui/CardIncident.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
:key="key"
class="block"
>
<span class="capitalize text-grey-400">{{ key }}: </span>
<span class="mr-8 font-semibold">{{ val }}</span>
<span v-if="val !== null" class="capitalize text-grey-400">{{ key }}: </span>
<span v-if="val !== null" class="mr-8 font-semibold">{{ val }}</span>
</span>
</span>
</span>
Expand Down
1 change: 1 addition & 0 deletions frontend_vue/src/utils/tokenServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export const tokenServices: TokenServicesType = {
'We send you an alert when that Credit Card is used.',
],
category: TOKEN_CATEGORY.OTHER,
keywords: ['cc'],
},
[TOKENS_TYPE.QRCODE]: {
label: 'QR code',
Expand Down
4 changes: 3 additions & 1 deletion templates/emails/notification.html
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,9 @@
<img align="center" src="https://{{ BasicDetails['public_domain'] }}/resources/notification-email/transaction.png" width="40px">
</td> {% if BasicDetails['additional_info']['merchant'] %} <td style="vertical-align: top;">
<p style="font-weight:600;display:block;line-height:1;margin:0;">Authorizing merchant</p>
<p style="font-weight:400;color:#060606;margin:0 0 16px 0;">{{BasicDetails['additional_info']['merchant']['name']}}</p>
<p style="font-weight:400;color:#060606;margin:0 0 16px 0;">
<a href style="text-decoration:none !important; color:#060606">{{BasicDetails['additional_info']['merchant'] | e}}</a>
</p>
</td> {% endif %} <td style="vertical-align: top;"> {% if BasicDetails['additional_info']['transaction_amount'] %} <p style="font-weight:600;display:block;line-height:1;margin:0;">Transaction amount</p>
<p style="font-weight:400;color:#060606;margin:0;">{{BasicDetails['additional_info']['transaction_amount']}} {{BasicDetails['additional_info']['transaction_currency']}}</p>
</td> {% endif %}
Expand Down
4 changes: 3 additions & 1 deletion templates/emails/notification.mjml
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,9 @@
{% if BasicDetails['additional_info']['merchant'] %}
<td style="vertical-align: top;">
<p style="font-weight:600;display:block;line-height:1;margin:0;">Authorizing merchant</p>
<p style="font-weight:400;color:#060606;margin:0 0 16px 0;">{{BasicDetails['additional_info']['merchant']['name']}}</p>
<p style="font-weight:400;color:#060606;margin:0 0 16px 0;">
<a href="" style="text-decoration:none !important; color:#060606">{{BasicDetails['additional_info']['merchant'] | e}}</a>
</p>
</td>
{% endif %}
<td style="vertical-align: top;">
Expand Down

0 comments on commit 55aa2b0

Please sign in to comment.