fix(#2386): change url request for brasil payment

keep-around/87c78c9d73943179f26bbafe8c20385ec61c221d
Andrei Dekterev 4 years ago
parent 42fa36f223
commit 87c78c9d73
  1. 4
      src/features/BuyMatchPopup/components/BrazilPayment/index.tsx
  2. 8
      src/requests/getBrazilPaymentUrl.tsx

@ -24,7 +24,7 @@ type ResponsePayment = {
url: string,
}
type ResponsePaymentArray =Array<ResponsePayment | null>
type ResponsePaymentArray = ResponsePayment | null
export const BrazilPayment = ({
open,
@ -51,7 +51,7 @@ export const BrazilPayment = ({
if (open) {
(async () => {
const json: ResponsePaymentArray = await getBrazilPaymentUrl({ item: originalObject, product_name: `${pack} ${teams}` })
setSrc(json[0]?.url || '')
setSrc(json?.url || '')
})()
}
// eslint-disable-next-line react-hooks/exhaustive-deps

@ -10,12 +10,16 @@ type Props = {
export const getBrazilPaymentUrl = async ({ item, product_name }: Props) => {
const config = {
body: {
item: { ...item, product_name },
action: 'create_subscription',
data: {
item: { ...item, product_name },
},
service: 'pag_brasil',
},
}
return callApi({
config,
url: `${API_ROOT}/account/payment/pagbrasil`,
url: `${API_ROOT}/account/payments`,
})
}

Loading…
Cancel
Save