Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
baufaker committed Nov 4, 2024
2 parents 6cc8950 + d0f5d23 commit 1f126e0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
4 changes: 3 additions & 1 deletion actions/getPlans.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { API_URL } from "deco-sites/ecannadeco/sdk/constants.ts";

const getPlans = async (_req: Request): Promise<unknown | null> => {
try {
const response = await fetch(
"https://api.ecanna.com.br/products/subscriptions",
API_URL + "/products/subscriptions",
{
method: "GET",
headers: {
Expand Down
10 changes: 6 additions & 4 deletions components/ui/CheckoutUpsellModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ const CheckoutUpsellModal = (props: Props) => {
paramsCheckoutV2.voucher = voucher;
}

if (isCreditCard) {
if (isCreditCard || plan) {
paramsCheckoutV2.credit_card = {
holder: holderName,
number: creditCardNumber,
Expand Down Expand Up @@ -359,6 +359,7 @@ const CheckoutUpsellModal = (props: Props) => {

function ConfirmOrder() {
const currentPrice = plan ? plan.price : product ? product.price : 0;

return (
<>
<h3 class="text-xl text-[#8b8b8b] font-semibold text-center mb-4">
Expand All @@ -373,7 +374,7 @@ const CheckoutUpsellModal = (props: Props) => {
{plan ? plan.name : product && product.name}
</span>
</span>
{discount !== 1
{!discount || discount !== 1
? (
<span>
{plan
Expand Down Expand Up @@ -446,7 +447,7 @@ const CheckoutUpsellModal = (props: Props) => {

{/* Cartão de crédito */}

{isCreditCard && (
{(isCreditCard || plan) && (
<>
<div>
{
Expand Down Expand Up @@ -498,7 +499,8 @@ const CheckoutUpsellModal = (props: Props) => {
})} */
}
</div>
{discount !== 1

{!discount || discount !== 1
? (
<div class={`${!addNewCard && "hidden"}`}>
<form class="flex flex-wrap gap-[2%]">
Expand Down
3 changes: 2 additions & 1 deletion components/ui/ChoosePlanSignup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Slider from "../../components/ui/Slider.tsx";
import { Plan } from "../../components/ui/Checkout.tsx";
import Icon from "../../components/ui/Icon.tsx";
import { IS_BROWSER } from "$fresh/runtime.ts";
import { API_URL } from "deco-sites/ecannadeco/sdk/constants.ts";

function ConfirmSignup() {
const [newPlan, setNewPlan] = useState<Plan>();
Expand All @@ -12,7 +13,7 @@ function ConfirmSignup() {
useEffect(() => {
try {
const _params = fetch(
`https://api.ecanna.com.br/v1/products/subscriptions?isPrescriber=false`,
`${API_URL}/v1/products/subscriptions?isPrescriber=false`,
).then(async (r) => {
const c = await r.json();
console.log({ plans: c.docs });
Expand Down
3 changes: 2 additions & 1 deletion components/ui/MyAccount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { useUI } from "../../sdk/useUI.ts";
import { IS_BROWSER } from "$fresh/runtime.ts";
import { useHolderInfo } from "deco-sites/ecannadeco/sdk/useHolderInfo.ts";
import { UserData } from "deco-sites/ecannadeco/components/ui/EcannaCardPage.tsx";
import { API_URL } from "deco-sites/ecannadeco/sdk/constants.ts";

export type Address = {
cep: string;
Expand Down Expand Up @@ -115,7 +116,7 @@ function MyAccount() {
});

fetch(
`https://api.ecanna.com.br/v1/products/subscriptions?isPrescriber=false`,
`${API_URL}/v1/products/subscriptions?isPrescriber=false`,
).then(async (r) => {
const c = await r.json();
const plansList = c.docs as Plan[];
Expand Down

0 comments on commit 1f126e0

Please sign in to comment.