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

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

Loading…
Cancel
Save