feat(medusa): Payment Collection endpoints (#2525)

This commit is contained in:
Carlos R. L. Rodrigues authored and GitHub committed 2022-11-11 18:28:45 +01:00
1 parent 27184f3878
commit 755ba90c05
58 files changed
+1190 -484

No files matched your search

@@ -70,18 +70,15 @@ export default async (req, res) => {
})
}
async function autorizePaymentCollection(req, payColId) {
async function autorizePaymentCollection(req, id, orderId) {
const manager = req.scope.resolve("manager")
const paymentCollectionService = req.scope.resolve(
"paymentCollectonService"
)
await manager.transaction(async (m) => {
const payCol = await paymentCollectionService
.withTransaction(m)
.retrieve(payColId)
await manager.transaction(async (manager) => {
await paymentCollectionService.withTransaction(manager).authorize(id)
})
// TODO: complete authorization
}
try {
@@ -100,7 +97,8 @@ export default async (req, res) => {
}
if (isPaymentCollection(customId)) {
await autorizePaymentCollection(req, customId)
const orderId = order.id
await autorizePaymentCollection(req, customId, orderId)
} else {
await autorizeCart(req, customId)
}
@@ -77,7 +77,7 @@ class PayPalProviderService extends PaymentService {
* Not supported
*/
async retrieveSavedMethods(customer) {
return Promise.resolve([])
return []
}
/**