Skip to content

@sourceloop/payment-service / Exports / PaypalProvider

Class: PaypalProvider

Implements

Table of contents

Constructors

Properties

Methods

Constructors

constructor

• new PaypalProvider(transactionsRepository, ordersRepository, subscriptionsRepository, logger, config?)

Parameters

Name Type
transactionsRepository TransactionsRepository
ordersRepository OrdersRepository
subscriptionsRepository SubscriptionsRepository
logger ILogger
config? IPayPalConfig

Defined in

services/payment-service/src/providers/paypal/paypal-provider.service.ts:28

Properties

client

• client: PayPalHttpClient

Defined in

services/payment-service/src/providers/paypal/paypal-provider.service.ts:27


config

• Private Optional Readonly config: IPayPalConfig

Defined in

services/payment-service/src/providers/paypal/paypal-provider.service.ts:37


environment

• environment: SandboxEnvironment | LiveEnvironment

Defined in

services/payment-service/src/providers/paypal/paypal-provider.service.ts:26


logger

• logger: ILogger

Defined in

services/payment-service/src/providers/paypal/paypal-provider.service.ts:35


ordersRepository

• Private Readonly ordersRepository: OrdersRepository

Defined in

services/payment-service/src/providers/paypal/paypal-provider.service.ts:32


subscriptionsRepository

• Private Readonly subscriptionsRepository: SubscriptionsRepository

Defined in

services/payment-service/src/providers/paypal/paypal-provider.service.ts:34


transactionsRepository

• Private Readonly transactionsRepository: TransactionsRepository

Defined in

services/payment-service/src/providers/paypal/paypal-provider.service.ts:30

Methods

value

▸ value(): Object

The value function in the TypeScript code handles payment processing, including creating orders, capturing charges, and processing refunds.

Returns

Object

The value() function returns an object with several asynchronous functions for handling payment-related operations. These functions include create for creating a payment order, charge for capturing payment for an order, refund for processing refunds, subscriptionCreate for creating subscriptions (to be developed), subscriptionCharge for charging subscriptions (to be developed), and subscriptionWebHook for handling subscription

Name Type
charge (chargeResponse: { orderId: string }) => Promise<{ orderId: undefined | string = orderDetails.id; res: ResponseMessage = ResponseMessage.Sucess }>
create (payorder: Orders, paymentTemplate: string) => Promise<{ orderId: undefined | string = payorder.id; orderPayLink: undefined = payorder.metaData.paypalOrderPayLink; payOrderId: undefined = order.id; res: string = 'Payment already Done for this Order'; status: Status = Status.AlreadyPaid } | { orderId: undefined | string = payorder.id; orderPayLink: any = payorder.metaData.paypalOrderPayLink; payOrderId: any = order.id; res: undefined = 'Payment already Done for this Order'; status: undefined = Status.AlreadyPaid }>
refund (transactionId: string, note?: string) => Promise<any>
subscriptionCharge (chargeResponse: AnyObject) => Promise<void>
subscriptionCreate (subscriptions: Subscriptions, paymentTemplate: string) => Promise<{ res: string = '' }>
subscriptionWebHook (sub: DataObject<{}>) => Promise<void>

Implementation of

Provider.value

Defined in

services/payment-service/src/providers/paypal/paypal-provider.service.ts:66