Skip to content

Commit

Permalink
feat: allow Offer to accept a PaymentPKeywordRecord
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Sep 5, 2020
1 parent 5a618b7 commit f5f9c41
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/zoe/src/zoeService/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
*
* @param {ERef<Invitation>} invitation
* @param {Proposal=} proposal
* @param {PaymentKeywordRecord=} paymentKeywordRecord
* @param {PaymentPKeywordRecord=} paymentKeywordRecord
* @returns {Promise<UserSeat>} seat
*/

Expand Down Expand Up @@ -181,7 +181,7 @@
*/

/**
* @typedef {Record<Keyword,Promise<Payment>>} PaymentPKeywordRecord
* @typedef {Record<Keyword,ERef<Payment>>} PaymentPKeywordRecord
* @typedef {Record<Keyword,Payment>} PaymentKeywordRecord
*/

Expand Down
4 changes: 3 additions & 1 deletion packages/zoe/src/zoeService/zoe.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,9 @@ function makeZoe(vatAdminSvc, zcfBundleName = undefined) {
// cleaned proposal's amount that should be the same.
const giveAmount = proposal.give[keyword];
const purse = brandToPurse.get(giveAmount.brand);
return E(purse).deposit(paymentKeywordRecord[keyword], giveAmount);
return E.when(paymentKeywordRecord[keyword], payment =>
E(purse).deposit(payment, giveAmount),
);
// eslint-disable-next-line no-else-return
} else {
// payments outside the give: clause are ignored.
Expand Down

0 comments on commit f5f9c41

Please sign in to comment.