0.0.1 • Published 1 year ago

@vigilio/payments v0.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

NUMERO A LETRAS

NIUBIZ

const { onAntifraude, onAuthorization, onConfirmacion, onYape, getIp } = niubiz(
    {
        merchantId,
        user,
        password,
        sandbox,
    }
);

const antifraude = await onAntifraude({
    channel: "web", // tipo
    order,
    clientIp: ip, // ip de usuario
    merchantDefineData,
    card,
    cardHolder,
});

const tokenId = antifraude.token.tokenId;
const authorization = await onAuthorization({
    channel: "web",
    captureType: "manual",
    countable: true,
    order: { ...order, tokenId },
    card,
    cardHolder,
});
const confirmation = await onConfirmacion({
    channel: "web",
    captureType: "manual",
    order: {
        ...order,
        transactionId: authorization.order.transactionId,
    },
});

PAYPA

const { createOrder, captureOrder } = paypal({
    client_id,
    secret_key,
    sandbox,
});

const result = await createOrder({
    intent: "CAPTURE",
    purchase_units: [
        {
            amount: {
                currency_code: "USD",
                value: String(total.toFixed(2)),
            },
        },
    ],
    application_context: {
        brand_name: information!.name,
        // payment_method: "IMMEDIATE_PAYMENT_REQUIRED",
        // locale: "en-US",
        landing_page: "NO_PREFERENCE",
        // shipping_preference: "SET_PROVIDED_ADDRESS",
        user_action: "PAY_NOW",
        return_url: `/paypal/success`,
        cancel_url: `/paypal/cancel`,
    },
});
if (result.status !== "CREATED")
    throw new BadRequestException(
        "Hubo un problema al realizar esta orden. Intentalo de nuevo más tarde."
    );
0.0.1

1 year ago