Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 6b389a7

Browse files
butikdenDenys Butynskyy
and
Denys Butynskyy
authored
fix: Confirm endpoint body changed to which is in docs (#746)
* fix: Confirm endpoint body changed to which is in docs * fix: unit test updated * fix: test * fix: test fixed Co-authored-by: Denys Butynskyy <[email protected]>
1 parent 588b93b commit 6b389a7

File tree

2 files changed

+19
-23
lines changed

2 files changed

+19
-23
lines changed

src/types/order.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,15 +451,15 @@ export interface OrdersEndpoint
451451

452452
/**
453453
* Confirm payment intent
454-
* DOCS: https://documentation.elasticpath.com/commerce-cloud/docs/api/payments/transactions.html#post-confirm-payment-intent
454+
* DOCS: https://documentation.elasticpath.com/commerce-cloud/docs/api/payments/paying-for-an-order/elastic-path-payments-stripe.html#confirmation---post-confirm-the-security-validation-succeeded
455455
* @param orderId - The ID of the order.
456456
* @param transactionId - The ID of the transaction you want to confirm.
457-
* @param body - The body of the order.
457+
* @param body - The empty data object.
458458
*/
459459
Confirm(
460460
orderId: string,
461461
transactionId: string,
462-
body: ConfirmPaymentBody
462+
body: {}
463463
): Promise<ConfirmPaymentResponse>
464464

465465
/**

test/unit/orders.ts

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,17 @@ describe('Moltin orders', () => {
130130
Authorization: 'Bearer a550d8cbd4a4627013452359ab69694cd446615a'
131131
}
132132
})
133-
.get('/orders/order-1?include=account,account_member')
134-
.reply(200, orders[0])
133+
.get('/orders/order-1?include=account,account_member')
134+
.reply(200, orders[0])
135135

136-
return Moltin.Orders.With(['account', 'account_member']).Get(orders[0].id).then((response:any) => {
137-
assert.propertyVal(response, 'id', 'order-1')
138-
assert.propertyVal(response, 'status', 'complete')
139-
assert.lengthOf(response.included.accounts, 1)
140-
assert.lengthOf(response.included.account_members, 1)
141-
})
136+
return Moltin.Orders.With(['account', 'account_member'])
137+
.Get(orders[0].id)
138+
.then((response: any) => {
139+
assert.propertyVal(response, 'id', 'order-1')
140+
assert.propertyVal(response, 'status', 'complete')
141+
assert.lengthOf(response.included.accounts, 1)
142+
assert.lengthOf(response.included.account_members, 1)
143+
})
142144
})
143145

144146
it('should return a single order using a JWT', () => {
@@ -225,23 +227,17 @@ describe('Moltin orders', () => {
225227
}
226228
})
227229
.post('/orders/order-2/transactions/1/confirm', {
228-
data: {
229-
gateway: 'purchase',
230-
payment: 'test',
231-
method: 'payment_intents'
232-
}
230+
data: {}
233231
})
234232
.reply(201, {
235233
status: 'complete'
236234
})
237235

238-
return Moltin.Orders.Confirm(orders[1].id, transactionId, {
239-
gateway: 'purchase',
240-
payment: 'test',
241-
method: 'payment_intents'
242-
}).then(response => {
243-
assert.propertyVal(response, 'status', 'complete')
244-
})
236+
return Moltin.Orders.Confirm(orders[1].id, transactionId, {}).then(
237+
response => {
238+
assert.propertyVal(response, 'status', 'complete')
239+
}
240+
)
245241
})
246242

247243
it('should update an order', () => {

0 commit comments

Comments
 (0)