Skip to content

Commit

Permalink
fix: readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Govind Diwakar committed Oct 25, 2023
1 parent 74222ad commit 347663c
Showing 1 changed file with 326 additions and 0 deletions.
326 changes: 326 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,333 @@ export function createPostCheckSumHeader(
return { checksum, encodedBody: payload };
}
```
###### phone-pe types

```
export interface PhonePeOptions {
mode: "production" | "test" | "uat";
redirectUrl: string;
callbackUrl: string;
merchant_id: string;
salt: string;
/**
* Use this flag to capture payment immediately (default is false)
*/
capture?: boolean;
/**
* set `automatic_payment_methods` to `{ enabled: true }`
*/
automatic_payment_methods?: boolean;
/**
* Set a default description on the intent if the context does not provide one
*/
payment_description?: string;
}
export interface PaymentIntentOptions {
capture_method?: "automatic" | "manual";
setup_future_usage?: "on_session" | "off_session";
payment_method_types?: string[];
}
export const ErrorCodes = {
PAYMENT_INTENT_UNEXPECTED_STATE: "payment_intent_unexpected_state",
UNSUPPORTED_OPERATION: "unsupported_operation",
};
export const ErrorIntentStatus = {
SUCCEEDED: "succeeded",
CANCELED: "canceled",
};
export const PaymentProviderKeys = {
PHONEPE: "phonepe",
};
export type PaymentRequest =
| PaymentRequestUPI
| PaymentRequestUPICollect
| PaymentRequestUPIQr
| PaymentRequestWebFlow;
export type PaymentResponse =
| PaymentResponseUPI
| PaymentResponseUPICollect
| PaymentResponseUPIQr
| PaymentResponseWebFlow;
export interface PaymentRequestUPI {
merchantId: string;
merchantTransactionId: string;
merchantUserId: string;
redirectUrl: string;
redirectMode: string;
amount: number;
callbackUrl: string;
mobileNumber?: string;
deviceContext?: DeviceContext;
paymentInstrument: PaymentInstrumentUPI;
}
export interface PaymentResponseUPI {
success: boolean;
code: PaymentStatusCodeValues;
message: string;
data: PaymentResponseData;
}
export interface PaymentResponseData {
merchantId: string;
merchantTransactionId: string;
instrumentResponse: InstrumentResponse;
customer: { id: string };
}
export interface DeviceContext {
deviceOS: string;
}
export interface AccountConstraint {
accountNumber: string;
ifsc: string;
}
export interface PaymentRequestUPICollect {
merchantId: string;
merchantTransactionId: string;
merchantUserId: string;
redirectUrl: string;
redirectMode: string;
amount: number;
callbackUrl: string;
mobileNumber: string;
paymentInstrument: PaymentInstrument;
}
export interface AccountConstraint {
accountNumber: string;
ifsc: string;
}
export interface PaymentResponseUPICollect {
success: boolean;
code: PaymentStatusCodeValues;
message: string;
data: PaymentResponseUPICollectData;
}
export interface PaymentResponseUPICollectData {
merchantId: string;
merchantTransactionId: string;
instrumentResponse: InstrumentResponse;
}
export interface PaymentRequestUPIQr {
merchantId: string;
merchantTransactionId: string;
merchantUserId: string;
redirectUrl: string;
redirectMode: string;
amount: number;
callbackUrl: string;
mobileNumber: string;
paymentInstrument: PaymentInstrument;
}
export interface AccountConstraint {
accountNumber: string;
ifsc: string;
}
export interface PaymentResponseUPIQr {
success: boolean;
code: PaymentStatusCodeValues;
message: string;
data: PaymentResponseUPIQrData;
}
export interface PaymentResponseUPIQrData {
merchantId: string;
merchantTransactionId: string;
instrumentResponse: InstrumentResponse;
}
export interface InstrumentResponse {
type: string;
qrData?: string;
intentUrl?: string;
redirectInfo?: RedirectInfo;
}
export interface PaymentRequestWebFlow {
merchantId: string;
merchantTransactionId: string;
merchantUserId: string;
amount: number;
redirectUrl: string;
redirectMode: string;
callbackUrl: string;
mobileNumber: string;
paymentInstrument: PaymentInstrument;
}
export interface PaymentResponseWebFlow {
success: boolean;
code: PaymentStatusCodeValues;
message: string;
data: PaymentResponseWebFlowData;
}
export interface PaymentResponseWebFlowData {
merchantId: string;
merchantTransactionId: string;
instrumentResponse: InstrumentResponse;
}
export interface RedirectInfo {
url: string;
method: string;
}
export interface RefundRequest {
merchantId: string;
merchantUserId: string;
originalTransactionId: string;
merchantTransactionId: string;
amount: number;
callbackUrl: string;
}
export interface RefundResponse {
success: boolean;
code: PaymentStatusCodeValues;
message: string;
data: RefundResponseData;
}
export interface RefundResponseData {
merchantId: string;
merchantTransactionId: string;
transactionId: string;
amount: number;
state: string;
responseCode: string;
}
export type PaymentCheckStatusResponse =
| PaymentCheckStatusResponseUPI
| PaymentCheckStatusResponseCard
| PaymentCheckStatusResponseNetBanking;
export interface PaymentCheckStatusResponseUPI {
success: boolean;
code: PaymentStatusCodeValues;
message: string;
data?: PaymentCheckStatusResponseUPIData;
}
export interface PaymentCheckStatusResponseUPIData {
merchantId: string;
merchantTransactionId: string;
transactionId: string;
amount: number;
state: string;
responseCode: string;
paymentInstrument: PaymentInstrument;
}
export interface PaymentCheckStatusResponseCard {
success: boolean;
code: PaymentStatusCodeValues;
message: string;
data: PaymentCheckStatusResponseCardData;
}
export interface PaymentCheckStatusResponseCardData {
merchantId: string;
merchantTransactionId: string;
transactionId: string;
amount: number;
state: string;
responseCode: string;
paymentInstrument: PaymentInstrument;
}
export type PaymentInstrument = PaymentInstrumentNetBanking &
PaymentInstrumentCard &
PaymentInstrumentUPI &
PaymentInstrumentWeb;
export enum PaymentStatusCodeValues {
"BAD_REQUEST" = "BAD_REQUEST",
"AUTHORIZATION_FAILED" = "AUTHORIZATION_FAILED",
"INTERNAL_SERVER_ERROR" = "INTERNAL_SERVER_ERROR",
"TRANSACTION_NOT_FOUND" = "TRANSACTION_NOT_FOUND",
"PAYMENT_ERROR" = "PAYMENT_ERROR",
"PAYMENT_PENDING" = "PAYMENT_PENDING",
"PAYMENT_DECLINED" = "PAYMENT_DECLINED",
"TIMED_OUT" = "TIMED_OUT",
"PAYMENT_SUCCESS" = "PAYMENT_SUCCESS",
"PAYMENT_CANCELLED" = "PAYMENT_CANCELLED",
"PAYMENT_INITIATED" = "PAYMENT_INITIATED",
}
export interface PaymentCheckStatusResponseNetBanking {
success: boolean;
code: PaymentStatusCodeValues;
message: string;
data: PaymentCheckStatusResponseNetBankingData;
}
export interface PaymentCheckStatusResponseNetBankingData {
merchantId: string;
merchantTransactionId: string;
transactionId: string;
amount: number;
state: string;
responseCode: string;
paymentInstrument: PaymentInstrumentNetBanking;
}
export interface PaymentInstrumentNetBanking {
type: string;
pgTransactionId: string;
pgServiceTransactionId: string;
bankTransactionId: any;
bankId: string;
}
export interface PaymentInstrumentCard {
type: string;
cardType: string;
pgTransactionId: string;
bankTransactionId: string;
pgAuthorizationCode: string;
arn: string;
bankId: string;
brn: string;
}
export interface PaymentInstrumentWeb {
type: string;
}
export interface PaymentInstrumentUPI {
type: string;
utr?: string;
targetApp?: string;
accountConstraints?: AccountConstraint[];
}
```



```
```

Expand Down

0 comments on commit 347663c

Please sign in to comment.