Vipps Donations #33
|
|
@ -49,6 +49,7 @@ export const DonationSection = function () {
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
{/* @ts-ignore */}
|
||||||
<vipps-mobilepay-button
|
<vipps-mobilepay-button
|
||||||
type="submit"
|
type="submit"
|
||||||
brand="vipps"
|
brand="vipps"
|
||||||
|
|
@ -60,6 +61,7 @@ export const DonationSection = function () {
|
||||||
branded="true"
|
branded="true"
|
||||||
loading="false"
|
loading="false"
|
||||||
>
|
>
|
||||||
|
{/* @ts-ignore */}
|
||||||
</vipps-mobilepay-button>
|
</vipps-mobilepay-button>
|
||||||
</a>
|
</a>
|
||||||
valid: {emailValid.toString()}
|
valid: {emailValid.toString()}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
// deno-lint-ignore-file ban-ts-comment
|
||||||
import "jsr:@std/dotenv/load";
|
import "jsr:@std/dotenv/load";
|
||||||
import { getHostUrl } from "../utils.ts";
|
import { getHostUrl } from "../utils.ts";
|
||||||
import { STATUS_CODE } from "$fresh/server.ts";
|
import { STATUS_CODE } from "$fresh/server.ts";
|
||||||
|
|
@ -30,6 +31,7 @@ const getAccessToken = async function () {
|
||||||
console.log(`Fetching ${`${config.baseUrl}/accesstoken/get`}`);
|
console.log(`Fetching ${`${config.baseUrl}/accesstoken/get`}`);
|
||||||
const response = await fetch(`${config.baseUrl}/accesstoken/get`, {
|
const response = await fetch(`${config.baseUrl}/accesstoken/get`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
// @ts-ignore
|
||||||
headers: {
|
headers: {
|
||||||
"client_id": config.clientId,
|
"client_id": config.clientId,
|
||||||
"client_secret": config.clientSecret,
|
"client_secret": config.clientSecret,
|
||||||
|
|
@ -45,6 +47,7 @@ export const createAgreement = async function (email: string) {
|
||||||
const token = await getAccessToken();
|
const token = await getAccessToken();
|
||||||
const response = await fetch(`${config.baseUrl}/recurring/v3/agreements/`, {
|
const response = await fetch(`${config.baseUrl}/recurring/v3/agreements/`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
// @ts-ignore
|
||||||
headers: {
|
headers: {
|
||||||
authorization: `Bearer ${token}`,
|
authorization: `Bearer ${token}`,
|
||||||
"Idempotency-Key": `${email}-${Date.now()}`,
|
"Idempotency-Key": `${email}-${Date.now()}`,
|
||||||
|
|
@ -83,6 +86,7 @@ export const createAgreement = async function (email: string) {
|
||||||
export const getAgreement = async function (agreementId: string) {
|
export const getAgreement = async function (agreementId: string) {
|
||||||
const token = await getAccessToken();
|
const token = await getAccessToken();
|
||||||
const response = await fetch(`${config.baseUrl}/recurring/v3/agreements/${agreementId}`, {
|
const response = await fetch(`${config.baseUrl}/recurring/v3/agreements/${agreementId}`, {
|
||||||
|
// @ts-ignore
|
||||||
headers: {
|
headers: {
|
||||||
authorization: `Bearer ${token}`,
|
authorization: `Bearer ${token}`,
|
||||||
...standardVippsHeaders,
|
...standardVippsHeaders,
|
||||||
|
|
@ -102,6 +106,7 @@ export const cancelAgreement = async function (agreementId: string) {
|
||||||
const token = await getAccessToken();
|
const token = await getAccessToken();
|
||||||
const response = await fetch(`${config.baseUrl}/recurring/v3/agreements/${agreementId}`, {
|
const response = await fetch(`${config.baseUrl}/recurring/v3/agreements/${agreementId}`, {
|
||||||
method: "PATCH",
|
method: "PATCH",
|
||||||
|
// @ts-ignore
|
||||||
headers: {
|
headers: {
|
||||||
authorization: `Bearer ${token}`,
|
authorization: `Bearer ${token}`,
|
||||||
"Idempotency-Key": `${agreementId}-${Date.now()}`,
|
"Idempotency-Key": `${agreementId}-${Date.now()}`,
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import * as vipps from "../lib/vipps/vipps.ts";
|
||||||
import { validateEmail } from "../lib/utils.ts";
|
import { validateEmail } from "../lib/utils.ts";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
email: string;
|
email: string | null;
|
||||||
error: string | null;
|
error: string | null;
|
||||||
cancelled: boolean;
|
cancelled: boolean;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue