Skip to content

Commit

Permalink
remove sonar issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyagi-Sunny committed Oct 23, 2024
1 parent da3dabd commit d0ecadb
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 35 deletions.
15 changes: 1 addition & 14 deletions src/providers/sdk/chargebee/charge-bee.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export class ChargeBeeService implements IChargeBeeService {
.request();
return this.customerAdapter.convert(result.customer);
} catch (error) {
console.log(error);
throw new Error(JSON.stringify(error));
}
}
Expand All @@ -68,7 +67,6 @@ export class ChargeBeeService implements IChargeBeeService {
const result = await chargebee.customer.retrieve(customerId).request();
return this.customerAdapter.convert(result.customer);
} catch (error) {
console.log(error);
throw new Error(JSON.stringify(error));
}
}
Expand Down Expand Up @@ -104,7 +102,6 @@ export class ChargeBeeService implements IChargeBeeService {

await chargebee.customer.update(customerId, transformedDto).request();
} catch (error) {
console.log(error);
throw new Error(JSON.stringify(error));
}
}
Expand All @@ -113,7 +110,6 @@ export class ChargeBeeService implements IChargeBeeService {
try {
await chargebee.customer.delete(customerId).request();
} catch (error) {
console.log(error);
throw new Error(JSON.stringify(error));
}
}
Expand All @@ -136,7 +132,6 @@ export class ChargeBeeService implements IChargeBeeService {

return this.paymentSource.convert(result.payment_source);
} catch (error) {
console.log(error);
throw new Error(JSON.stringify(error));
}
}
Expand Down Expand Up @@ -176,7 +171,6 @@ export class ChargeBeeService implements IChargeBeeService {
.request();
return this.invoiceAdapter.convert(result.invoice);
} catch (error) {
console.log(error);
throw new Error(JSON.stringify(error));
}
}
Expand All @@ -189,15 +183,13 @@ export class ChargeBeeService implements IChargeBeeService {
.request();
return this.paymentSource.convert(result.payment_source);
} catch (error) {
console.log(error);
throw new Error(JSON.stringify(error));
}
}
async deletePaymentSource(paymentSourceId: string): Promise<void> {
try {
await chargebee.payment_source.delete(paymentSourceId).request();
} catch (error) {
console.log(error);
throw new Error(JSON.stringify(error));
}
}
Expand Down Expand Up @@ -229,7 +221,6 @@ export class ChargeBeeService implements IChargeBeeService {
.request();
return this.invoiceAdapter.convert(result.invoice);
} catch (error) {
console.log(error);
throw new Error(JSON.stringify(error));
}
}
Expand All @@ -238,7 +229,6 @@ export class ChargeBeeService implements IChargeBeeService {
const result = await chargebee.invoice.retrieve(invoiceId).request();
return this.invoiceAdapter.convert(result.invoice);
} catch (error) {
console.log(error);
throw new Error(JSON.stringify(error));
}
}
Expand All @@ -264,24 +254,21 @@ export class ChargeBeeService implements IChargeBeeService {
.request();
return this.invoiceAdapter.convert(result.invoice);
} catch (error) {
console.log(error);
throw new Error(JSON.stringify(error));
}
}
async deleteInvoice(invoiceId: string): Promise<void> {
try {
await chargebee.invoice.delete(invoiceId).request();
} catch (error) {
console.log(error);
throw new Error(JSON.stringify(error));
}
}
async getPaymentStatus(invoiceId: string): Promise<boolean> {
try {
const result = await chargebee.invoice.retrieve(invoiceId).request();
return result.invoice.status === 'paid' ? true : false;
return result.invoice.status === 'paid';
} catch (error) {
console.log(error);
throw new Error(JSON.stringify(error));
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/providers/sdk/chargebee/type/customer.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {TCustomer} from '../../../../types';
import {IAddressDto} from './invoice.type';

export interface IChargeBeeCustomer extends TCustomer {
company?: string | undefined;
phone?: string | undefined;
billingAddress?: IAddressDto | undefined;
company?: string;
phone?: string;
billingAddress?: IAddressDto;
}
18 changes: 9 additions & 9 deletions src/providers/sdk/chargebee/type/invoice.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ export interface IChargeBeeInvoice extends TInvoice {
}

export interface IAddressDto {
firstName?: string | undefined;
lastName?: string | undefined;
email?: string | undefined;
company?: string | undefined;
phone?: string | undefined;
firstName?: string;
lastName?: string;
email?: string;
company?: string;
phone?: string;
line1?: string;
line2?: string;
line3?: string;
city?: string | undefined;
state?: string | undefined;
zip?: string | undefined;
country?: string | undefined;
city?: string;
state?: string;
zip?: string;
country?: string;
}

export interface ICharge {
Expand Down
18 changes: 9 additions & 9 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ export interface TCustomer {

export interface TAddress {
id?: string;
firstName?: string | undefined;
lastName?: string | undefined;
email?: string | undefined;
company?: string | undefined;
phone?: string | undefined;
city?: string | undefined;
state?: string | undefined;
zip?: string | undefined;
country?: string | undefined;
firstName?: string;
lastName?: string;
email?: string;
company?: string;
phone?: string;
city?: string;
state?: string;
zip?: string;
country?: string;
options?: Options;
}

Expand Down

0 comments on commit d0ecadb

Please sign in to comment.