-
Notifications
You must be signed in to change notification settings - Fork 13
[TASK-14942] feat(manteca-deposit): fix manteca deposit #1249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jjramirezn marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
132 changes: 132 additions & 0 deletions
132
src/components/AddMoney/components/MantecaDepositShareDetails.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| 'use client' | ||
|
|
||
| import NavHeader from '@/components/Global/NavHeader' | ||
| import { useParams, useRouter } from 'next/navigation' | ||
| import React, { useMemo } from 'react' | ||
| import { countryData } from '@/components/AddMoney/consts' | ||
| import ShareButton from '@/components/Global/ShareButton' | ||
| import { MantecaDepositResponseData } from '@/types/manteca.types' | ||
| import { PaymentInfoRow } from '@/components/Payment/PaymentInfoRow' | ||
| import { Icon } from '@/components/Global/Icons/Icon' | ||
| import Image from 'next/image' | ||
| import { Card } from '@/components/0_Bruddle/Card' | ||
|
|
||
| const MantecaDepositShareDetails = ({ | ||
| depositDetails, | ||
| source, | ||
jjramirezn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }: { | ||
| depositDetails: MantecaDepositResponseData | ||
| source: 'bank' | 'regionalMethod' | ||
| }) => { | ||
| const router = useRouter() | ||
| const params = useParams() | ||
| const currentCountryName = params.country as string | ||
|
|
||
| const currentCountryDetails = useMemo(() => { | ||
| // check if we have country params (from dynamic route) | ||
| if (currentCountryName) { | ||
| return countryData.find( | ||
| (country) => country.type === 'country' && country.path === currentCountryName.toLowerCase() | ||
| ) | ||
| } | ||
| // Default to Argentina | ||
| return countryData.find((c) => c.id === 'AR') | ||
| }, [currentCountryName]) | ||
|
|
||
| const countryCodeForFlag = useMemo(() => { | ||
| const countryId = currentCountryDetails?.id || 'AR' | ||
| return countryId.toLowerCase() | ||
| }, [currentCountryDetails]) | ||
|
|
||
| const depositAddressLabel = useMemo(() => { | ||
| switch (currentCountryDetails?.id) { | ||
| case 'AR': | ||
| return 'CBU' | ||
| case 'BR': | ||
| return 'Pix Key' | ||
| default: | ||
| return 'Deposit Address' | ||
| } | ||
| }, [currentCountryDetails]) | ||
|
|
||
| const depositAddress = depositDetails.details.depositAddress | ||
| const depositAlias = depositDetails.details.depositAlias | ||
| const depositAmount = depositDetails.stages['1'].thresholdAmount | ||
| const usdAmount = depositDetails.stages['3'].amount | ||
| const currencySymbol = depositDetails.stages['1'].asset | ||
| const exchangeRate = depositDetails.details.price | ||
|
|
||
| const generateShareText = () => { | ||
jjramirezn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| const textParts = [] | ||
| const currencySymbol = currentCountryDetails?.currency || 'ARS' | ||
|
|
||
| textParts.push(`Amount: ${currencySymbol} ${depositAmount}`) | ||
|
|
||
| if (depositAddress) { | ||
| textParts.push(`${depositAddressLabel}: ${depositAddress}`) | ||
| } | ||
| if (depositAlias) { | ||
| textParts.push(`Alias: ${depositAlias}`) | ||
| } | ||
|
|
||
| return textParts.join('\n') | ||
| } | ||
|
|
||
| return ( | ||
| <div className="flex h-full w-full flex-col justify-start gap-8 self-start"> | ||
| <NavHeader title={'Add Money'} onPrev={() => router.back()} /> | ||
| <div className="my-auto flex h-full w-full flex-col justify-center space-y-4"> | ||
jjramirezn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| {/* Amount Display Card */} | ||
| <Card className="p-4"> | ||
| <div className="flex items-center space-x-3"> | ||
| <div className="relative h-12 w-12"> | ||
| <Image | ||
| src={`https://flagcdn.com/w160/${countryCodeForFlag}.png`} | ||
| alt={`flag`} | ||
| width={48} | ||
| height={48} | ||
| className="h-12 w-12 rounded-full object-cover" | ||
| /> | ||
| <div className="absolute -bottom-1 -right-1 flex h-6 w-6 items-center justify-center rounded-full bg-yellow-1"> | ||
| <Icon name="bank" size={12} /> | ||
| </div> | ||
| </div> | ||
| <div> | ||
| <p className="flex items-center gap-1 text-center text-sm text-gray-600"> | ||
| <Icon name="arrow-down" size={10} /> You're adding | ||
| </p> | ||
| <p className="text-2xl font-bold"> | ||
| {currencySymbol} {depositAmount} | ||
| </p> | ||
| <div className="text-lg font-bold">≈ {usdAmount} USD</div> | ||
| </div> | ||
| </div> | ||
| </Card> | ||
| <h2 className="font-bold">Account details</h2> | ||
| <Card className="space-y-0 rounded-sm px-4"> | ||
| {depositAddress && <PaymentInfoRow label={depositAddressLabel} value={depositAddress} allowCopy />} | ||
| {depositAlias && <PaymentInfoRow label="Alias" value={depositAlias} allowCopy />} | ||
| {currentCountryDetails?.id === 'AR' && ( | ||
| <> | ||
| <PaymentInfoRow label="Razón Social" value="Sixalime Sas" /> | ||
| <PaymentInfoRow label="CUIT" value="30-71678845-3" /> | ||
| </> | ||
| )} | ||
| <PaymentInfoRow label="Exchange Rate" value={`1 USD = ${exchangeRate} ${currencySymbol}`} /> | ||
| <PaymentInfoRow label="Peanut fee" value="Sponsored by Peanut!" hideBottomBorder /> | ||
| </Card> | ||
| </div> | ||
|
|
||
| <ShareButton | ||
| generateText={async () => generateShareText()} | ||
| title="Bank Transfer Details" | ||
| variant="purple" | ||
| className="w-full" | ||
| > | ||
| Share Details | ||
| </ShareButton> | ||
| </div> | ||
| ) | ||
| } | ||
|
|
||
| export default MantecaDepositShareDetails | ||
79 changes: 0 additions & 79 deletions
79
src/components/AddMoney/components/RegionalMethods/MercadoPago/MercadoPagoDepositDetails.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.