Skip to content

Commit

Permalink
Merge pull request #41 from juspay/payment-filter-addition
Browse files Browse the repository at this point in the history
add payment method filters
  • Loading branch information
mrudulvajpayee4935 authored Aug 22, 2024
2 parents 0398b6a + c4e71c0 commit 67f2b99
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion juspay-payments.json
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@
"source_object_id": { "type": "string", "nullable": true },
"amount_info": { "type": "string", "nullable": true },
"offer_details": { "type": "string", "nullable": true },
"payment_filter": { "type": "string", "nullable": true },
"payment_filter": { "type": "object", "nullable": true },
"options_get_payment_collection_link": { "type": "string", "nullable": true },
"payment_collection_link_details": { "type": "string", "nullable": true },
"virtual_account_references": { "type": "string", "nullable": true },
Expand Down
4 changes: 4 additions & 0 deletions src/modules/api-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ const PaymentCreateRequestSchema = z.object({
returnUrl: z.string().nullable().optional(),
manualRetryAllowed: z.boolean().nullable().optional(),
gatewayReferenceId: z.string().nullable().optional(),
allowedPaymentMethods: z
.union([z.record(z.any()).nullable(), z.array(z.string()).nullable()])
.nullable()
.optional(),
});

// Type definition for PaymentCreateRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export const TransactionInitializeSessionHyperswitchWebhookHandler = async (
description: normalizeValue(requestData?.description),
billing: buildAddressDetails(event.sourceObject.billingAddress, userEmail),
shipping: buildAddressDetails(event.sourceObject.shippingAddress, requestData?.shippingEmail),
allowed_payment_method_types: normalizeValue(requestData?.allowedPaymentMethods),
metadata: {
transaction_id: event.transaction.id,
saleor_api_url: saleorApiUrl,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export const TransactionInitializeSessionJuspayWebhookHandler = async (
shipping_address_postal_code: normalizeValue(shippingAddress?.address?.zip),
"metadata.JUSPAY:gateway_reference_id": requestData?.gatewayReferenceId,
"metadata.txns.auto_capture": normalizeValue(captureMethod),
payment_filter: normalizeValue(requestData?.allowedPaymentMethods),
};
const createOrderResponse = await createJuspayPayment(createOrderPayload);

Expand Down

0 comments on commit 67f2b99

Please sign in to comment.