@@ -6,6 +6,7 @@ import type TransformingNetworkClient from '../../communication/TransformingNetw
6
6
import HelpfulIterator from '../../plumbing/iteration/HelpfulIterator' ;
7
7
import makeAsync from '../../plumbing/iteration/makeAsync' ;
8
8
import renege from '../../plumbing/renege' ;
9
+ import resolveIf from '../../plumbing/resolveIf' ;
9
10
import type Callback from '../../types/Callback' ;
10
11
import type Nullable from '../../types/Nullable' ;
11
12
import { type ThrottlingParameter } from '../../types/parameters' ;
@@ -118,7 +119,7 @@ export default class OrderHelper extends Helper<OrderData, Order> {
118
119
public getPayments ( this : OrderHelper & OrderData ) {
119
120
if ( renege ( this , this . getPayments , ...arguments ) ) return ;
120
121
return (
121
- runIf ( this . embedded ?. payments , Promise . resolve ) ??
122
+ resolveIf ( this . embedded ?. payments ) ??
122
123
// Getting the payments for an order is an odd case, in the sense that the Mollie API only supports it partially.
123
124
// The Mollie API will embed the payments in an order if requested ‒ but unlike with other "embeddables", there
124
125
// is no endpoint to get those payments directly. Therefore, the line below rerequests this order, this time with
@@ -154,6 +155,6 @@ export default class OrderHelper extends Helper<OrderData, Order> {
154
155
// At the time of writing, the Mollie API does not return a link to the shipments of an order. This is why the line
155
156
// below constructs its own URL. If the Mollie API ever starts to return such a link, use it instead for
156
157
// consistency.
157
- return runIf ( this . embedded ?. shipments , Promise . resolve ) ?? this . networkClient . list < ShipmentData , Shipment > ( getOrderShipmentsPathSegments ( this . id ) , 'shipments' ) ;
158
+ return resolveIf ( this . embedded ?. shipments ) ?? this . networkClient . list < ShipmentData , Shipment > ( getOrderShipmentsPathSegments ( this . id ) , 'shipments' ) ;
158
159
}
159
160
}
0 commit comments