Skip to content

Commit c7e9fea

Browse files
committed
Set mandatory query params
1 parent 13a351d commit c7e9fea

File tree

4 files changed

+5
-17
lines changed

4 files changed

+5
-17
lines changed

src/__tests__/checkout.spec.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -563,27 +563,15 @@ describe("Checkout", (): void => {
563563
});
564564

565565
test("Should delete stored paymentMethod", async (): Promise<void> => {
566-
scope.delete("/storedPaymentMethods/12321")
566+
scope.delete("/storedPaymentMethods/12321?shopperReference=myShopperReference&merchantAccount=myMerchantAccount")
567567
.reply(200);
568568

569569
await expect(
570-
checkoutService.RecurringApi.deleteTokenForStoredPaymentDetails("12321"),
570+
checkoutService.RecurringApi.deleteTokenForStoredPaymentDetails("12321", "myShopperReference", "myMerchantAccount"),
571571
).resolves.not.toThrowError();
572572

573573
});
574574

575-
test("Should handle request without query parameters for getResultOfPaymentSession", async(): Promise<void> => {
576-
scope.get("/sessions/mySessionIdMock")
577-
.reply(200, {
578-
"id": "CS12345678",
579-
"status": "completed"
580-
});
581-
582-
const resultOfPaymentSessionResponse = await checkoutService.PaymentsApi.getResultOfPaymentSession("mySessionIdMock");
583-
expect(resultOfPaymentSessionResponse.id).toEqual("CS12345678");
584-
expect(resultOfPaymentSessionResponse.status).toEqual(SessionResultResponse.StatusEnum.Completed);
585-
});
586-
587575
test("Should handle query parameters for getResultOfPaymentSession", async(): Promise<void> => {
588576
scope.get("/sessions/mySessionIdMock?sessionResult=sessionResult")
589577
.reply(200, {

src/services/checkout/paymentsApi.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export class PaymentsApi extends Service {
6262
* @param sessionResult {@link string } The &#x60;sessionResult&#x60; value from the Drop-in or Component.
6363
* @return {@link SessionResultResponse }
6464
*/
65-
public async getResultOfPaymentSession(sessionId: string, sessionResult?: string, requestOptions?: IRequest.Options): Promise<SessionResultResponse> {
65+
public async getResultOfPaymentSession(sessionId: string, sessionResult: string, requestOptions?: IRequest.Options): Promise<SessionResultResponse> {
6666
const endpoint = `${this.baseUrl}/sessions/{sessionId}`
6767
.replace("{" + "sessionId" + "}", encodeURIComponent(String(sessionId)));
6868
const resource = new Resource(this, endpoint);

src/services/checkout/recurringApi.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class RecurringApi extends Service {
3636
* @param shopperReference {@link string } Your reference to uniquely identify this shopper, for example user ID or account ID. Minimum length: 3 characters. &gt; Your reference must not include personally identifiable information (PII), for example name or email address.
3737
* @param merchantAccount {@link string } Your merchant account.
3838
*/
39-
public async deleteTokenForStoredPaymentDetails(storedPaymentMethodId: string, shopperReference?: string, merchantAccount?: string, requestOptions?: IRequest.Options): Promise<void> {
39+
public async deleteTokenForStoredPaymentDetails(storedPaymentMethodId: string, shopperReference: string, merchantAccount: string, requestOptions?: IRequest.Options): Promise<void> {
4040
const endpoint = `${this.baseUrl}/storedPaymentMethods/{storedPaymentMethodId}`
4141
.replace("{" + "storedPaymentMethodId" + "}", encodeURIComponent(String(storedPaymentMethodId)));
4242
const resource = new Resource(this, endpoint);

templates/typescript/api-single.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class {{classname}} extends Service {
2424
{{#operation}}
2525

2626
{{>api_summary}}
27-
public async {{#vendorExtensions.x-methodName}}{{.}}{{/vendorExtensions.x-methodName}}{{^vendorExtensions.x-methodName}}{{nickname}}{{/vendorExtensions.x-methodName}}({{#pathParams}}{{paramName}}: {{{dataType}}}, {{/pathParams}}{{#bodyParams}}{{paramName}}: {{{dataType}}}, {{/bodyParams}}{{#queryParams}}{{paramName}}?: {{{dataType}}}, {{/queryParams}}requestOptions?: IRequest.Options): Promise<{{#returnType}}{{{.}}}{{/returnType}}{{^returnType}}void{{/returnType}}> {
27+
public async {{#vendorExtensions.x-methodName}}{{.}}{{/vendorExtensions.x-methodName}}{{^vendorExtensions.x-methodName}}{{nickname}}{{/vendorExtensions.x-methodName}}({{#pathParams}}{{paramName}}: {{{dataType}}}, {{/pathParams}}{{#bodyParams}}{{paramName}}: {{{dataType}}}, {{/bodyParams}}{{#queryParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/queryParams}}requestOptions?: IRequest.Options): Promise<{{#returnType}}{{{.}}}{{/returnType}}{{^returnType}}void{{/returnType}}> {
2828
const endpoint = `${this.baseUrl}{{{path}}}`{{#pathParams}}
2929
.replace("{" + "{{baseName}}" + "}", encodeURIComponent(String({{paramName}}))){{/pathParams}};
3030
const resource = new Resource(this, endpoint);

0 commit comments

Comments
 (0)