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:
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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user