Skip to content

Commit

Permalink
Use embedded captures ‒ if present ‒ in payment.getCaptures.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pimm committed Sep 20, 2023
1 parent 88deca6 commit 81de71c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/data/payments/PaymentHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,11 @@ export default class PaymentHelper extends Helper<PaymentData, Payment> {
* @since 3.6.0
*/
public getCaptures(parameters?: ThrottlingParameter): HelpfulIterator<Capture> {
return runIf(this.links.captures, ({ href }) => this.networkClient.iterate<CaptureData, Capture>(href, 'captures', undefined, parameters?.valuesPerMinute)) ?? emptyHelpfulIterator;
return (
runIf(this.embedded?.captures, captures => new HelpfulIterator(makeAsync(captures[Symbol.iterator]()))) ??
runIf(this.links.captures, ({ href }) => this.networkClient.iterate<CaptureData, Capture>(href, 'captures', undefined, parameters?.valuesPerMinute)) ??
emptyHelpfulIterator
);
}

/**
Expand Down

0 comments on commit 81de71c

Please sign in to comment.