Skip to content

Commit

Permalink
fix(core): Made addPaymentToOrder channel aware
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnvdbrug committed Mar 18, 2021
1 parent 260d787 commit ce60f83
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packages/core/src/service/services/payment-method.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,13 @@ export class PaymentMethodService {
handler: PaymentMethodHandler;
checker: PaymentMethodEligibilityChecker | null;
}> {
const paymentMethod = await this.connection.getRepository(ctx, PaymentMethod).findOne({
where: {
code: method,
enabled: true,
},
});
const paymentMethod = await this.connection
.getRepository(ctx, PaymentMethod)
.createQueryBuilder('method')
.leftJoin('method.channels', 'channel')
.where('method.code = :code', { code: method })
.andWhere('channel.id = :channelId', { channelId: ctx.channelId })
.getOne();
if (!paymentMethod) {
throw new UserInputError(`error.payment-method-not-found`, { method });
}
Expand Down

0 comments on commit ce60f83

Please sign in to comment.