AW-1805 Add mollie service
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit

This commit is contained in:
Peter Bastiani 2021-01-11 19:32:08 +01:00
parent a782d8ebe9
commit 30dab68468
3 changed files with 52 additions and 1 deletions

View File

@ -31,6 +31,7 @@ import { StateSerializerService } from './services/state-serializer.service';
import { PackageService } from './services/package.service'; import { PackageService } from './services/package.service';
import { PackagePreloadStrategy } from './services/package-preload-strategy.service'; import { PackagePreloadStrategy } from './services/package-preload-strategy.service';
import { SenmlService } from './services/senml-service'; import { SenmlService } from './services/senml-service';
import { MollieService } from './services/mollie.service';
export { export {
FolderService, FolderService,
@ -53,7 +54,8 @@ export {
SchemaService, SchemaService,
PackageService, PackageService,
SenmlService, SenmlService,
PackagePreloadStrategy PackagePreloadStrategy,
MollieService
}; };
@NgModule({ @NgModule({

View File

@ -0,0 +1,15 @@
export interface IMolliePaymentResponse {
createdAt?: Date,
expiresAt?: Date,
checkoutUrl?: string,
}
export class MolliePaymentResponse implements IMolliePaymentResponse {
public createdAt?: Date;
public expiresAt?: Date;
public checkoutUrl?: string;
constructor() {
}
}

View File

@ -0,0 +1,34 @@
import { Injectable } from '@angular/core';
import { IItem } from '../models/item';
import { IItemTask } from '../models/itemTask';
import { HttpClient } from "@angular/common/http";
import { AppConfig } from "../shared/app.config";
import { Observable } from 'rxjs';
import { IMolliePaymentResponse } from '../models/mollie.payment.response';
@Injectable({
providedIn: 'root',
})
export class MollieService {
constructor(
public httpClient: HttpClient,
public appConfig: AppConfig) {
}
ApiEndpoint() {
return this.appConfig.getConfig("apiEndPoint");
}
createMolliePayment(templatePackage: IItem, redirectUrl: string): Observable<IMolliePaymentResponse> {
let payload = {
"currency": "EUR",
"amount": "100.00",
"redirectUrl": redirectUrl,
"itemCode": templatePackage.code,
"locale": "nl_NL",
"validity": "12m"
};
return this.httpClient.post<IItemTask>(`${this.ApiEndpoint()}/api/v1/items/create`, payload);
}
}