Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

7.3 KB
Raw Blame
const successfulNo3DSCardDetails = {
  card_number: "4111111111111111",
  card_exp_month: "03",
  card_exp_year: "30",
  card_holder_name: "John Doe",
  card_cvc: "737",
};

const billingAddress = {
  address: {
    line1: "1467",
    line2: "Harrison Street",
    line3: "Harrison Street",
    city: "San Fransico",
    state: "California",
    zip: "94122",
    country: "IN",
    first_name: "john",
    last_name: "doe",
  },
};

export const connectorDetails = {
  bank_redirect_pm: {
    Ideal: {
      Request: {
        payment_method: "bank_redirect",
        payment_method_type: "ideal",
        payment_method_data: {
          bank_redirect: {
            ideal: {},
          },
        },
        billing: {
          address: {
            line1: "1467",
            line2: "Harrison Street",
            line3: "Harrison Street",
            city: "San Fransico",
            state: "California",
            zip: "94122",
            country: "NL",
            first_name: "john",
            last_name: "doe",
          },
        },
      },
      Response: {
        status: 200,
        body: {
          status: "failed",
          error_code: "BAD_REQUEST",
          error_message: "Payment country has to be enabled on merchant",
        },
      },
    },
  },
  real_time_payment_pm: {
    PaymentIntent: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          specName: ["realTimePayment"],
          value: "connector_2",
        },
      },
      Request: {
        currency: "MYR",
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
        },
      },
    },
    DuitNow: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          specName: ["realTimePayment"],
          value: "connector_2",
        },
      },
      Request: {
        payment_method: "real_time_payment",
        payment_method_type: "duit_now",
        payment_method_data: {
          real_time_payment: {
            duit_now: {},
          },
        },
        billing: {
          ...billingAddress,
          address: {
            ...billingAddress.address,
            country: "MY",
          },
        },
      },
      Response: {
        status: 200,
        body: {
          status: "requires_customer_action",
          net_amount: 6000,
          amount_received: null,
          amount: 6000,
        },
      },
    },
    DuitNowRetrieve: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          specName: ["realTimePayment"],
          value: "connector_2",
        },
      },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
          amount: 6000,
          amount_received: 6000,
          amount_capturable: 0,
        },
      },
    },
  },
  card_pm: {
    // Auto fallback capture method flow (PR #14452) - iatapay does not support
    // manual capture; with auto_fallback_capture_method enabled on the business
    // profile, manual capture payments fall back to automatic capture.
    AutoFallbackCaptureMethod: {
      PaymentIntent: {
        Request: {
          currency: "INR",
        },
        Response: {
          status: 200,
          body: {
            status: "requires_payment_method",
            capture_method_applied: null,
          },
        },
      },
      AutoFallbackDisabled: {
        Configs: {
          skipBillingAssertion: true,
        },
        Request: {
          payment_method: "upi",
          payment_method_type: "upi_collect",
          payment_method_data: {
            upi: {
              upi_collect: {
                vpa_id: "successtest@iata",
              },
            },
          },
          billing: billingAddress,
        },
        Response: {
          status: 400,
          body: {
            error: {
              type: "invalid_request",
              message: "Payment method type not supported",
              code: "IR_19",
              reason: "manual is not supported by iatapay",
            },
          },
        },
      },
      AutoFallbackEnabled: {
        Request: {
          payment_method: "upi",
          payment_method_type: "upi_collect",
          payment_method_data: {
            upi: {
              upi_collect: {
                vpa_id: "successtest@iata",
              },
            },
          },
          billing: billingAddress,
        },
        Response: {
          status: 200,
          body: {
            status: "requires_customer_action",
            capture_method: "manual",
            capture_method_applied: "automatic",
          },
        },
      },
    },
    ZeroAuthMandate: {
      Request: {
        amount: 0,
      },
      Response: {
        status: 501,
        body: {
          error: {
            type: "invalid_request",
            message: "Setup Mandate flow for Iatapay is not implemented",
            code: "IR_00",
          },
        },
      },
    },
    ZeroAuthPaymentIntent: {
      Request: {
        amount: 0,
        setup_future_usage: "off_session",
        currency: "USD",
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
          setup_future_usage: "off_session",
        },
      },
    },
    ZeroAuthConfirmPayment: {
      Request: {
        amount: 0,
        payment_type: "setup_mandate",
        payment_method: "card",
        payment_method_type: "credit",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
      },
      Response: {
        status: 501,
        body: {
          error: {
            type: "invalid_request",
            message: "Setup Mandate flow for Iatapay is not implemented",
            code: "IR_00",
          },
        },
      },
    },
    No3DSFailPayment: {
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        customer_acceptance: null,
        setup_future_usage: "on_session",
      },
      Response: {
        status: 400,
        body: {
          error: {
            type: "invalid_request",
            message:
              "Selected payment method through iatapay is not implemented",
            code: "IR_00",
          },
        },
      },
    },
  },
  upi_pm: {
    PaymentIntent: {
      Request: {
        currency: "INR",
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
        },
      },
    },
    UpiCollect: {
      Request: {
        payment_method: "upi",
        payment_method_type: "upi_collect",
        payment_method_data: {
          upi: {
            upi_collect: {
              vpa_id: "successtest@iata",
            },
          },
        },
        billing: billingAddress,
      },
      Response: {
        status: 200,
        body: {
          status: "requires_customer_action",
        },
      },
    },
    UpiIntent: {
      Request: {
        payment_method: "upi",
        payment_method_type: "upi_intent",
        payment_method_data: {
          upi: {
            upi_intent: {},
          },
        },
      },
      Response: {
        status: 200,
        body: {
          status: "requires_customer_action",
        },
      },
    },
    Refund: {
      Request: {
        amount: 6000,
      },
      Response: {
        status: 200,
        body: {
          status: "pending",
        },
      },
    },
  },
};