Skip to content

Commit

Permalink
Fix billing info position in request body
Browse files Browse the repository at this point in the history
  • Loading branch information
ikprk committed Jul 2, 2024
1 parent 299693e commit 932af82
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export const GuardarianModalBillingInfoStep = ({
required: 'Field is required',
}}
render={({ field: { onChange, value } }) => {
const selected = countriesOptions?.find((row) => row.code_iso_alpha_3 === value)
const selected = countriesOptions?.find((row) => row.code_iso_alpha_2 === value)
return (
<FormField error={errors.country?.message} label="Select your country">
<ComboBox
Expand All @@ -177,7 +177,7 @@ export const GuardarianModalBillingInfoStep = ({
selectedItem={selected}
placeholder="Poland"
onSelectedItemChange={(e) => {
onChange(e?.code_iso_alpha_3)
onChange(e?.code_iso_alpha_2)
}}
items={countriesOptions}
/>
Expand Down
28 changes: 17 additions & 11 deletions packages/atlas/src/utils/GuardarianService/GuardarianService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import {
GuardarianEstimation,
} from './GuardarianService.types'

import { formatDateGuardarian } from '../time'

type TransactionType = 'sell' | 'buy'

Check warning on line 13 in packages/atlas/src/utils/GuardarianService/GuardarianService.ts

View workflow job for this annotation

GitHub Actions / Tests and Linting (ubuntu-latest, 18.x)

'TransactionType' is defined but never used. Allowed unused vars must match /^_+$/u

// export const JOYSTREAM_CHANGENOW_TICKER = 'joystream'
Expand Down Expand Up @@ -144,7 +146,6 @@ class GuardarianService {
dob: string
}
}) {
console.log('inside', from, to)
return axiosInstance.post<GuardarianCreateTransactionResponse>(
`${GUARDARIAN_URL}/transaction`,
{
Expand All @@ -156,16 +157,21 @@ class GuardarianService {
payout_info: {
extra_id: extraId,
},
billing_info: {
country_alpha_2: billingInfo.country,
region: billingInfo.region,
city: billingInfo.city,
street_address: billingInfo.street,
apt_number: billingInfo.apartment,
post_index: billingInfo.postIndex,
first_name: billingInfo.firstName,
last_name: billingInfo.lastName,
date_of_birthday: billingInfo.dob,
customer: {
contact_info: {
email: billingInfo.email,
},
billing_info: {
country_alpha_2: billingInfo.country,
region: billingInfo.region,
city: billingInfo.city,
street_address: billingInfo.street,
apt_number: billingInfo.apartment,
post_index: billingInfo.postIndex,
first_name: billingInfo.firstName,
last_name: billingInfo.lastName,
date_of_birthday: formatDateGuardarian(new Date(billingInfo.dob)),
},
},
},
{
Expand Down
1 change: 1 addition & 0 deletions packages/atlas/src/utils/time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const MINUTES_IN_HOUR = 60
const SECONDS_IN_HOUR = MINUTES_IN_HOUR * 60

export const formatDate = (date: Date) => format(date, 'd MMM yyyy')
export const formatDateGuardarian = (date: Date) => format(date, 'dd:MM:yyyy')
export const formatTime = (date: Date) => format(date, 'HH:mm')
export const formatDateTime = (date: Date) => format(date, 'd MMM yyyy, HH:mm')
export const formatDateTimeAt = (date: Date) => format(date, "d MMM yyyy 'at' HH:mm")
Expand Down

0 comments on commit 932af82

Please sign in to comment.