fix: improves integration tests (#332)

* fix: improves integration tests

* fix: giftcard order with total 0

* fix: remove breaking eager
This commit is contained in:
Sebastian Rindom
2021-08-11 09:26:25 +02:00
committed by GitHub
parent 8edf8aacfa
commit 9a701ff229
23 changed files with 355 additions and 672 deletions
+1 -1
View File
@@ -51,7 +51,7 @@ export class ReturnItem {
@Column({ nullable: true })
reason_id: string
@ManyToOne(() => ReturnReason, { eager: true })
@ManyToOne(() => ReturnReason)
@JoinColumn({ name: "reason_id" })
reason: ReturnReason
+12 -8
View File
@@ -464,9 +464,11 @@ class OrderService extends BaseService {
.withTransaction(manager)
.confirmInventory(item.variant_id, item.quantity)
} catch (err) {
await this.paymentProviderService_
.withTransaction(manager)
.cancelPayment(payment)
if (payment) {
await this.paymentProviderService_
.withTransaction(manager)
.cancelPayment(payment)
}
throw err
}
}
@@ -534,11 +536,13 @@ class OrderService extends BaseService {
const result = await orderRepo.save(o)
await this.paymentProviderService_
.withTransaction(manager)
.updatePayment(payment.id, {
order_id: result.id,
})
if (total !== 0) {
await this.paymentProviderService_
.withTransaction(manager)
.updatePayment(payment.id, {
order_id: result.id,
})
}
let gcBalance = cart.subtotal
for (const g of cart.gift_cards) {