AW-1805 Add mollie service
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
This commit is contained in:
parent
a782d8ebe9
commit
30dab68468
@ -31,6 +31,7 @@ import { StateSerializerService } from './services/state-serializer.service';
|
||||
import { PackageService } from './services/package.service';
|
||||
import { PackagePreloadStrategy } from './services/package-preload-strategy.service';
|
||||
import { SenmlService } from './services/senml-service';
|
||||
import { MollieService } from './services/mollie.service';
|
||||
|
||||
export {
|
||||
FolderService,
|
||||
@ -53,7 +54,8 @@ export {
|
||||
SchemaService,
|
||||
PackageService,
|
||||
SenmlService,
|
||||
PackagePreloadStrategy
|
||||
PackagePreloadStrategy,
|
||||
MollieService
|
||||
};
|
||||
|
||||
@NgModule({
|
||||
|
15
projects/common/src/fm/models/mollie.payment.response.ts
Normal file
15
projects/common/src/fm/models/mollie.payment.response.ts
Normal 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() {
|
||||
}
|
||||
}
|
34
projects/common/src/fm/services/mollie.service.ts
Normal file
34
projects/common/src/fm/services/mollie.service.ts
Normal 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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user