Skip to content

Commit

Permalink
DON-998: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Dorota Hawro committed Dec 13, 2024
1 parent 3244891 commit 09a8a98
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 25 deletions.
3 changes: 2 additions & 1 deletion src/app/app-routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const LoggedInPersonResolver: ResolveFn<Person | null> = async () => {
const mandateResolver: ResolveFn<Mandate> = async (route: ActivatedRouteSnapshot) => {
const mandateService = inject(MandateService);
const mandateId = route.paramMap.get('mandateId');
console.log({mandateId});
if (!mandateId) {
throw new Error('mandateId param missing in route');
}
Expand Down Expand Up @@ -287,7 +288,7 @@ if (flags.regularGivingEnabled) {
)

routes.unshift({
path: `${myRegularGivingPath}/:mandateId`,
path: 'my-account/regular-giving/:mandateId',
pathMatch: 'full',
component: MandateComponent,
canActivate: [
Expand Down
59 changes: 35 additions & 24 deletions src/app/mandate/mandate.component.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Component } from '@angular/core';
import {Component, OnInit} from '@angular/core';
import {ComponentsModule} from "@biggive/components-angular";
import {DatePipe} from "@angular/common";
import {Mandate} from "../mandate.model";
import {Donation} from "../donation.model";
import {ExactCurrencyPipe} from "../exact-currency.pipe";
import {ActivatedRoute} from "@angular/router";

@Component({
selector: 'app-mandate',
Expand All @@ -16,36 +17,46 @@ import {ExactCurrencyPipe} from "../exact-currency.pipe";
templateUrl: './mandate.component.html',
styleUrl: './mandate.component.scss'
})
export class MandateComponent {
export class MandateComponent implements OnInit {
complete: boolean = true;
encodedShareUrl: string = '';
encodedPrefilledText: string = '';
donation: Donation;
mandate: Mandate;

constructor(
private route: ActivatedRoute
) {}

ngOnInit() {
this.mandate = this.route.snapshot.data.mandate;
}

// @todo-regular-giving: calculate the total in matchbot and show on template
// totalPaid: number = 0;

// @todo-regular-giving : replace this with a mandate fetched from matchbot
mandate: Mandate = {
id: 'f7037101-b555-4482-afff-43145fac78bb',
campaignId: 'a056900002TPVz5AAH',
charityName: '0011r00002Hoe8lAAB',
donationAmount: {
amountInPence: 10_00,
currency: "GBP"
},
matchedAmount: {
amountInPence: 10_00,
currency: "GBP"
},
giftAid: false,
numberOfMatchedDonations: 3,
status: 'active',
schedule: {
type: "monthly",
dayOfMonth: 1,
activeFrom: '2024-12-06 11:00:17',
expectedNextPaymentDate: '2025-01-01 11:00:17'
}
};
// mandate: Mandate = {
// id: 'f7037101-b555-4482-afff-43145fac78bb',
// campaignId: 'a056900002TPVz5AAH',
// charityName: '0011r00002Hoe8lAAB',
// donationAmount: {
// amountInPence: 10_00,
// currency: "GBP"
// },
// matchedAmount: {
// amountInPence: 10_00,
// currency: "GBP"
// },
// giftAid: false,
// numberOfMatchedDonations: 3,
// status: 'active',
// schedule: {
// type: "monthly",
// dayOfMonth: 1,
// activeFrom: '2024-12-06 11:00:17',
// expectedNextPaymentDate: '2025-01-01 11:00:17'
// }
// };

}

0 comments on commit 09a8a98

Please sign in to comment.