AW-1805 Update mollie service (client)
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Peter (extern) 2021-01-13 16:40:35 +01:00
parent cc421742df
commit a08eed7c67
3 changed files with 25 additions and 12 deletions

View File

@ -0,0 +1,16 @@
import { IItem } from "./item";
export interface IMolliePaymentRequest {
templatePackageItem?: IItem,
redirectUrl?: string,
locale?: string,
}
export class MolliePaymentRequest implements IMolliePaymentRequest {
public templatePackageItem?: IItem;
public redirectUrl?: string;
public locale?: string;
constructor() {
}
}

View File

@ -2,12 +2,16 @@
export interface IMolliePaymentResponse {
createdAt?: Date,
expiresAt?: Date,
currency?: string,
amount?: string,
checkoutUrl?: string,
}
export class MolliePaymentResponse implements IMolliePaymentResponse {
public createdAt?: Date;
public expiresAt?: Date;
public currency?: string;
public amount?: string;
public checkoutUrl?: string;
constructor() {

View File

@ -1,10 +1,9 @@
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';
import { IMolliePaymentRequest } from '../models/mollie.payment.request';
@Injectable({
providedIn: 'root',
@ -20,15 +19,9 @@ export class MollieService {
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": templatePackage.data?.validity
};
return this.httpClient.post<IMolliePaymentResponse>(`${this.ApiEndpoint()}/api/v1/payments/create`, payload);
createMolliePayment(paymentRequest: IMolliePaymentRequest): Observable<IMolliePaymentResponse> {
return this.httpClient.post<IMolliePaymentResponse>(
`${this.ApiEndpoint()}/api/v1/payments/create`,
paymentRequest);
}
}