Skip to content

Commit

Permalink
Merge pull request #80 from hbm-machines/master
Browse files Browse the repository at this point in the history
BA-639 Add set articles to KlarnaKP Pay function
  • Loading branch information
ShuCh3n authored Nov 27, 2024
2 parents 6b5b5a3 + e34325e commit 7919472
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/PaymentMethods/KlarnaKP/Models/IPay.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
import { IPaymentRequest, Person, ServiceParameter } from '../../../Models';
import { IArticle, IPaymentRequest, Person, ServiceParameter } from '../../../Models';
import Article, { IKlarnaKpArticle } from './Article';

export interface IPay extends IPaymentRequest {
reservationNumber?: string;
articles?: Partial<IKlarnaKpArticle>[];
}

export class Pay extends ServiceParameter {
set reservationNumber(value: string) {
this.set('reservationNumber', value);
}

set articles(articles: IArticle[]) {
this.set(
'articles',
articles.map((article) => new Article(article))
);
}

protected getGroups() {
return super.getGroups({
Articles: 'Article',
});
}

protected getCountable() {
return super.getCountable(['Articles']);
}
}

export class Customer extends Person {
Expand Down

0 comments on commit 7919472

Please sign in to comment.